ONLamp.com    
 Published on ONLamp.com (http://www.onlamp.com/)
 See this if you're having trouble printing code examples


Python News

TuxBot Programming with Python

03/21/2001

Also in Python News:

BitTorrent Style

Twisted Python

Python Escapes Classroom

Humongous Python

Py in Print

Jonathan Pennington works with Legos. Specifically, he works with Lego Mindstorms, the robotics invention system. Pennington uses Lego robots and robots built with Handyboard kits to teach geological science to 8th grade kids -- in a program he calls Science Programs and Robotics for Kids (SPARK). The program has been good, but Pennington wants more power for his robots, more flexibility for the kids. He wants to program his robots in Python. He can't do it with Mindstorms. A small Hitachi microprocessor with only 32k of memory controls Lego Mindstorms. That's a processor so small, even the bugs are hunchbacked. It's too small for Pippy, the version of Python recently ported to the PalmOS. Even if Pippy fit a device that small, it wouldn't be the power bot Pennington imagines. What does Pennington want instead? He wants a PC running real time Linux. He wants Linux robots you can program with Python.

That isn't too far fetched. He knows the controller he wants to use, a PC/104. PC/104 is a relatively new IEEE standard for creating embedded personal computers. They measure about 3.5" x 3.8". They're new, they're hot, and, unfortunately, they're still a bit pricey (about $250-$300). Undaunted, Pennington thinks that prices will soon come down. Available at a good price and accompanied by a simple Python interface, Pennington believes these Linux-powered robots with a Python interface will be an easy sell for educational purposes. He calls the project the EGg0 Educational Robotics System, and it is one of 100 finalists in the Embedded Linux Journal's "Hack Linux for Fun and Prizes" contest. It is one of a dozen or so Linux robot proposals.

A recent discussion of robots, Python, and education on the Python Edu-sig mailing list made me curious about other Python robot projects. Lee Smithson created a Python tool called PyLnp. It allows you to communicate with your Mindstorms robot through your computer's infrared port. There's a catch: your Mindstorms robot has to be running the free alternative operating system LegOS and your IR equipped computer has to be running Linux. LegOS is a nice advancement over Lego's OS. With LegOS, you can program your robot in C or C++. If you have a little skill in C, you can write procedures, store them in the Mindstorms controller, then invoke them remotely from your computer using PyLnp. To pull this off you have to know some C, but it sounds like loads of fun.

A group of programmers have ported the Java virtual machine to the Mindstorms' controller. The Java VM was written to fit on tiny embedded processors, so it can fit where Python cannot. The Java-based Lego operating system is called leJos. Since you can compile Jython to Java byte code, it might be possible to program your Lego Mindstorms in Python. I may have to go out and buy a Lego Mindstorms set just to give this a try.

PyKhep is a Python remote control library for the K-Team's Khepera robots. I love the looks of these fancy little robots. They are modular and expandable. You plug them into a serial port and control them right from the desktop. I am drooling over these, but with a high price tag of 3000 Swiss franks, or about $1,800 USD for just the base system, I won't be getting one anytime soon. A couple of these would cost more than I paid for my car!

These all seem weak compared to Pennington's plan for a Linux robot. I wish him plenty of success, and I hope he is right about the PC/104 boards coming down in price. If he can manage to bring together Lego modularity with a powerful embedded PC controller, I want one. Programming a TuxBot with Python sounds like too much fun to pass up.

Stephen Figgins administrates Linux servers for Sunflower Broadband, a cable company.


Read more Python News columns.

Copyright © 2009 O'Reilly Media, Inc.