Thursday, November 22, 2007

The Making of Sparky II - Preparing the Brain


See Part I if you want to read the preceding article. Lots of progress made recently, and the picture shows the current look of Sparky.

Though the Roomba has an on-board processor, to use as the main 'brain' for a roomba-based autonomous robot requires a lot of contortions. The iRobot folks provide a nice API, and underlying control algorithms that run on this processor, but do not provide any direct way to download arbitrary software to it. The best way to use the roomba is to allow its processor to do the low-level motor/sensor control, and add a 'brain' to it.

Even a small form-factor computer is too much weight for the roomba, and often too much of a power hog. The best thing to use is a device made for low-power, small form-factor, embedded situations. It turns out that a typical Linksys wireless AP/router is an ideal device to use for this. It can be made to run GNU/Linux, has built in wired and wireless ethernet, a built in switch, and through the SDK of the OpenWRT project, a semi-easy way to develop custom code.

The Linksys WRTSL54GS model also has a USB hub, and extra flash memory, which makes it a little more expensive than the generic WRT54G routers, but worth it for this application.

Installing GNU/Linux on the Linksys routers is pretty simple and safe IF you do not get too adventurous. You download the image from OpenWRT, go to ther Linksys admin page on the routers web pages, choose to install new firmware, and that's it.

The pitfalls to avoid that resulted in two 'bricked' routers for me:
  • even when the software reports that the firmware is upgraded and ready, do not believe it: don't reboot the thing or otherwise look the wrong way at it if it still has flashing lights;
  • do not use the 2.6 Linux kernel;
  • avoid building your own kernel/image unless you absolutely need it.
I am not sure exactly which ones of these was the cause of my failures, but by avoiding these, you can save yourself some money. Keep in mind, every one of these I did successfully more than one time before I hosed up the router, so these are things that can safely be done, but something in this space of things also caused the problems.

There are a number of ways to salvage a 'bricked' router. I tried them all, multiple times, with no success (including some very tricky soldering for the last-resort JTAG method).

My final call was to use the newer Kamikaze openwrt build, but with the 2.4 kernel. That runs fine and has the right module for operation of the webcam that will serve as the robot's eye(s).
Instead of trying to make a custom image, I just use the SDK to cross-compile any software that is not already available that I need.

No comments: