Working with LEGO

Thanks to Calum Tsang, I've been able to play around with the LEGO
Mindstorms robotics kit without actually having to mess around with
anything that requires spatial visualization. I've never really gotten
the hang of getting gears and whatnot to work together. Fortunately,
Calum is absolutely brilliant when it comes to that sort of stuff, so
all I really need to worry about is just making sure that I produce
the right output given the input.

LEGO presents quite a challenge. We use Not Quite C (nqc) to program
the robot, and it _really_ is not quite C. I've run into the parser's
limitations a gazillion times, from wondering why on earth some of the
binary operators don't accept variables to wishing I could define a
function that returns a value instead of having to pass everything
around in global variables. It's fun working within those constraints,
though.

Debugging is a mission, too. No println debugging here! Numbers and
beeps are all I have, and the compile-download-run cycle can be a bit
slow. We're still having problems with the infrared communication
between two of the control modules, but Calum thinks it's because I'm
flooding the communication buffer. We'll try twiddling that on Friday
to see if we can get it to work before the competition on Saturday.

Maybe he can teach me how to put together some of the really simple
assemblies – the bumper, perhaps? I'm completely pfft when it comes to
spatial things, but that could be a way for me to ease into it. Just
as Kathy's circus stuff helped me learn coordination and rhythm, maybe
LEGO can help me learn how to hold spatial structures in my head. In
the meantime, I actually enjoy working within the constraints of the
system.

It's also a refreshing break from the kind of programming work I
normally like doing. As Calum pointed out earlier, I'm one of the
near-mythical programmers who actually prefers maintaining other
people's code and (gasp) writing a little documentation here and
there. For these little LEGO contests, all I need to do is hack
together some code that will be thrown away afterwards. It feels more
like a logic puzzle than a proper program. I don't have the feeling of
working on something that makes someone's life easier and better, but
I do feel that it exercises my brain and keeps me limber.

So, yeah. LEGO is fun. =)

You can comment with Disqus or you can e-mail me at sacha@sachachua.com.