Currently available for full-time roles in the experiential media space!
Resumé
Skip to main content

Real-time location tracking for Der Kritzler wall plotters

May 26, 2012

While working on my own wall plotter, I came up with a list of features I’d like to see. Two days ago, I actually got my wall plotter working correctly, so I’ve been thinking more about how to actually execute these features myself. Yesterday I was able to add the first of these features: real-time tracking of the pen while the plotter is running.

Overview of code changes

The source code for my project is heavily based on the code written by Alex Weber for his Der Kritzler wall plotter. He was nice enough to release all of his source code on Github, and after a little bit of comparing and contrasting with other wall plotter projects out there, I felt that Der Kritzler made a lot of sense to me. However, the original author only was trying to get a skeleton in place to operate his wall plotter, not necessarily create a system packed with extra features. I felt that a good way for me to learn about the code is to contribute something to it, so I immediately forked his repo and got to work.

First, I added a simple drawing method (drawMarker()) to the Java class that represents the connection to the Arduino hardware (Kritzler.java). In order to make this work, I implemented a simple internal state system inside the class, with an externally accessible setter method. This drawMarker() method draws a small, semi-transparent circle on the canvas at the last known location of the bot, which is obtained directly from the existing Serial data stream. The marker actually changes colors based on the state of the Kritzler class:

  • Blue: actively moving the pen around
  • Red: currently paused
  • Green: plotting has finished successfully

In my approach, the last known location of the bot is received directly from the bot itself thanks to an existing serial message that it sends (#idle, xy: {number} {number}). This means that no new code has to be uploaded to the Arduino to support this new feature! And because we’re obtaining information from the wall plotter directly, we can be very confident that it is correct. After all, we’re not estimating anything here!

Real-time pen tracking in action

Here is a video of the system running, hopefully you can see the real-time tracking on the screen as I pan to it.

Open source project contributions

I’m a big fan of the open-source hardware (OSHW) and open-source software movements, so when I realized that my changes could be contributed back to the original Kritzler project on Github, I cleaned up my code and sent a pull request. I’m brand new to git, so there were a few wonky things about my commits, but nevertheless my contributions were accepted and integrated into the original Kritzler repository! From now on, anyone who downloads the official source code from Tinkerlog’s master repo will benefit from the code I’ve contributed – how cool is that?

Believe it or not, this was actually my first ever Github pull request, and first ever open-source project contribution. Why oh why was this kind of activity never discussed in my traditional computer science education?