Slashdot Mirror


Controlling Robots with Linux?

propain asks: "I've recently heard of a few robots controlled with Pentium processors run by the Linux kernel. I would love to build a robot with Linux-for-brains and write my control code in C. What are the various challenges one must undertake in receiving input from various sensors and sending certain electrical voltage and current pulses to actuators and other output devices? I assume the answer lies in device driver programming and embedded Linux systems?" Anyone have pointers to webpages with useful information on this subject?

1 of 6 comments (clear)

  1. Distributed sensor/actuator control by roystgnr · · Score: 4, Informative

    Are you sure you need a Linux kernel controlling every tiny change of every low level actuator in your robot? Probably not. In general, you need Linux because of it's available software tools (being able to ssh to your robot, run gdb on your control software, etc. is nice) and because of the relatively heavy CPU power you can run it on.

    For those sensors and actuators, you may want more low level control. You can get a 25Mhz PIC for $5-10, for example, and compile C code (a few kilobytes of it, anyway, with 8 and 16 bit integer arithmetic) to control a dozen A/D and D/A channels with latency in the hundreds of microseconds. You basically use the microcontrollers running your raw code (no OS) to handle closed-loop control of individual subsystems, then have them controlled in turn (by serial, I2C, or something else you can hook up to a PC easily) by a microprocessor running Linux.

    And you might be surprised in the end. Our robot was originally intended to work as above... but when time pressures hit, we discovered that our requirements for the master controller weren't as great as we estimated, and we managed to get away with using a PIC for that too.

    The PIC isn't the only microprocessor out there... and it's got lots of limitations. The program memory is frighteningly small, the arithmetic precision is lousy, we had to try about three compilers before we found one that worked to our satisfaction... but it worked fine in the end. A piece of advice: even more important than these worries about your original design is *getting it prototyped early* and working out all the bugs. Our robot, for example, kept failing because a few damn interconnection wires kept coming loose... Some friends of mine never got much in the way of working hardware because they just didn't realize that this was a multi-thousand man-hour project, and didn't have enough available time budgeted.