Control a Linux robot from the Web

Web Wonder


You can test drive the mini robot in Michael Shiloh's apartment via an SSH connection.

By Ulrich Bantle

Peter Kaminsky

When the servo motors of a small four-wheeled vehicle start to whir in Michael Shiloh's apartment in California, nobody knows what is going to happen next. At least, nobody knows except for a user who has just logged on via the Linuxrobots.org [1] website and passed a set of pre-programmed actions to the robot on wheels. "Programing the robot is fairly easy," says Michael Shiloh (Figure 2). But Shiloh hasn't witnessed all that many skillful maneuvers down the hallway and through the living room. "I hear the drive start up, run at low speed for awhile and switch off again," says Shiloh, describing typical attempts by visitors to put the robot through its paces. He suspects that people don't have enough time or expect some kind of joystick controls.

Scott Beale (Laughing Squid)
Figure 2: Michael Shiloh presenting the Linux robot at an event [5]in San Francisco.

Shiloh has been fascinated with electronics ever since childhood. As a boy he continually leafed through the pages of an electronics catalog. But it wasn't until the early 60s, when Shiloh moved from Israel to the USA at the age of nine, that he actually got his hands on discarded electronic components. A robot of his own remained a dream for many years. As an electronics engineer, he later had to deal with industrial robots as part of his job.

Keeping a robot in your apartment, and letting strangers take it for a spin, may sound slightly strange, but Shiloh considers himself part of the project. The robot benefits from open source components, and Shiloh decided that, in addition to publishing the source code and construction details for his project, he would make the machine itself available to the public.

According to Shiloh, some attempts to control the robot are truly fascinating. "Just a short while ago, somebody wrote a program to get my robot to dance," he said happily.

Shiloh stumbled across the Survival Research Labs [2] group in the 90s; the group uses machines for spectacular shows. One of the major lessons from this period is that a machine does not need to have a practical use. And Michael's robot follows this principle - visitors can steer the robot around his apartment or just let it run round in circles, depending on their programing skills and personal taste.

Getting Up to Speed

You don't need a degree in computer science to control Michael's robot, but you do need some understanding of programing. To log in to robot@robots.linuxrobots.org via SSH, just enter "robot" as your username and password. This takes you straight to the robot's Linux prompt. Now change to the /src directory, which has a few C program files that you can edit and recompile. Michael invites you to be creative; the robot has a vi editor to help you out. And you can track the robot's progress via the webcam at [3].

The code in Listing 1 tells the robot to turn in a circle. Shiloh adds that it would be nice for people to switch off the servo before logging off. The robot is disabled at night to stop it from waking up Shiloh's family, so the robot is a nocturnal creature for visitors from Europe.

Listing 1: Circle
01 #include "librobot.h"
02
03  int main( int argc, char* argv[] )
04  {
05  robot_libInit();
06
07  robot_controlMotors(70, -70);
08  return 0;
09  }

Do-It-Yourself Robot

The materials - controller, photocells, sensors, and servos - are all available from your local electronics and hardware stores. You need a saw, a wood drill, and a hot glue gun. The communication between the PC and the robot electronics uses a USB interface. The Linux driver comes with the interface. The robot doesn't have a hard disk to keep it light and save power. Gentoo Linux runs from a compact flash card. The robot's core is a VIA Epia board. The robot receives external signals via a WLAN card in the Epia board's PCI slot. The list of parts is available at [4].

Two modules handle drive control and interfacing with the computer's USB port. One module additionally has four analog and two digital inputs and outputs. The mess of cables on the top (Figure 1) is mainly due to the wires from the four photocells that are connected to the analog inputs. Light-sensitive sensors located on all four sides react to changing light sources and let you maneuver the robot towards areas with brighter lighting.

Figure 1: Wire routing is easy with insulating tape.

The boards come with a library for controlling the modules. The inventor managed to control the robot's components using a simple wrapper. Shiloh chose to name this librobot, although, strictly speaking, it isn't a library, as he admits. If you are interested, you will find the librobot sources on the robot's compact flash card.

Two twelve-volt batteries provide power for the servos, the controller, and the computer. Shiloh had to ditch his original plans to use a single battery for the robot. When the drives revved too high, the computer ran out of power, and this caused an involuntary reboot. Now, one rechargeable battery is used to power the servo and controller modules, while a second battery powers the computer.

Building the robot is more a matter of practicality than planning. The platform is made of plywood, the axle suspension with the servos, too. PU foam is used for most of the remaining construction, and the whole thing is held together by glue. Shiloh admits that the construction looks a bit rickety, but he was more interested in getting the robot working quickly than in striving for perfection.

Portal for Linux Robots

As the name suggests, Linuxrobots.org is an umbrella organization for information on Linux-based robots. Although Michael Shiloh lists various robotics sources - and leveraged these sources for his own work - he did not find a source that specialized in Linux robots. He was amazed to discover that the linuxrobots.org domain was still free, although the website is still short on content.

Figure 3: Visit inuxrobots.org to take the robot for a drive.

Shiloh is relying on the Linux community, which always has been keen on experimenting, to start contributing to linuxrobots.org.

INFO
[1] Shiloh's website: http://www.linuxrobots..org
[2] Survival Research Labs: http://www.srl.org
[3] Webcam: http://robot.linuxrobots.org
[4] Parts list: http://www.linuxrobots.org/wiki/Parts_List
[5] Dorkbot presentation in San Francisco: http://www.dorkbot.org/dorkbotsf/archive/200510/