Newer links
Some links to existing program development sites include:
http://lejos.sourceforge.net/
and the mindstorms own site, which applies only to their newest NXT brick
http://mindstorms.lego.com/Overview/nxtreme.aspx
Older links
these were some old links from Autumn 2006...
in case you haven't checked it out yourself,
or have missed it for any reason...
There's a pile of open-source and other stuff on robots..
http://www.google.com/Top/Computers/Robotics/Software/
including
http://rossum.sourceforge.net/
http://www.orocos.org/
and
http://www.robotcub.org/index.php/robotcub/platform/software/yarp_an_open_source_library_for_robotics
as well as another repository of links
http://dmoz.org/Computers/Robotics/Software/Simulation/
but most are in C/C++
But not to worry,
there's even a pile of stuff in Java for robots...
http://www.cs.cmu.edu/~trb/TeamBots/
and even Java for Lego Mindstorms...
http://lejos.sourceforge.net/
just came across this which might be of interest to you..
- including applications
- and an interesting
At least you'd be programming in a familiar environment,
but with a restricted AWT - due to memory constraints on the robot.
http://java.sun.com/developer/technicalArticles/Programming/robotics/
Java Technology Powered Mobile Robots -- the LEGO Mindstorms Robotics Invention System

Figure 1: LEGO RCX "Brick
For all
those who might assume that mobile robotics is not
something the average Java programmer can readily explore,
you have to experience the LEGO Mindstorms Robotics
Invention System. "LEGO came up with the Mindstorms system
about three years ago," says Ritter. "It was developed in
conjunction with MIT."
At the
heart of the system is the programmable RCX "brick," a
small computer contained within a yellow LEGO brick. The
brick consists of a Hitachi 8-bit processor (16 MHz), 16 Kb
of ROM, 32 Kb of RAM, 3 sensor inputs, 3 motor outputs, a
5-character LCD display, and an infrared serial data
communications port. The brick is a small and extremely
resource-constrained computing device -- particularly by
today's desktop standards of GHz processors and hundreds of
Mb of memory. "On the other hand," notes Ritter with
amusement, "I realized that it's just as powerful as my
first personal computer."
The
three outputs of the brick can be connected to motors and
other devices, and the three inputs can be connected to
such varied sensor devices as light, touch, rotation, and
even heat. The system can process over 1000 commands a
second, and features a fully multitasking operating system
(allowing up to ten simultaneous tasks).
The
brick was initially designed by LEGO to be programmed via a
PC-based system that allows the visual assembly of
on-screen functional components. This component-driven
system then generates a completed program that can be
downloaded into the brick.
But what
opened the brick up to whole new vistas of innovation and
functionality was the development of the open source leJOS
environment. The creators of leJOS have managed to squeeze
an actual Java Runtime Environment (including
multi-threading) into 14 KB on the brick. But leJOS is
obviously not a complete implementation of the Java
platform. "You can't really expect that," says Ritter.
"Having the AWT on the brick doesn't make much sense." Due
to memory constraints, leJOS also lacks garbage collection,
but the hooks are there for future implementations.
With
leJOS, Java developers now have an inexpensive (yet
multi-threaded) robotics platform available to them. The
basic kit starts at only about $200.
In order
to accommodate future versions of the brick, the system was
designed to allow for the easy loading of new LEGO
firmware. But that also makes it very simple to replace the
firmware with the leJOS environment. The first step toward
enabling the brick to run Java programs is to load
leJOS.
lejosfirmdl
"That's
about 14 KB," says Ritter, "and is effectively your Java
runtime environment."
The next
step in running a program on the (now) Java
technology-enabled brick, is to create and compile a Java
program.
lejosc MyClass.java
Lejosc
sets a new bootclasspath, picks up various things from
other classpath-specific places, and runs javac," explains
Ritter. "That generates a class file in the same way you'd
get if you compiled a normal piece of Java code." But to
make the program executable on the resource-constrained
brick, you must create an RCX-specific binary file. This
entails stripping out any unnecessary information.
lejos -o MyClass.bin MyClass
Finally,
the binary file is loaded (via infrared serial port) onto
the brick.
lejosrun MyClass.bin
To
actually execute the program, you simply push the brick's
"start" button. But with a five-character LCD display as
the only output device, debugging programs can sometimes be
challenging!
There
are currently three versions of the RCX brick. Versions 1.0
and 1.5 are essentially the same, and employ an infrared
serial communications link to connect the PC to the brick
(2400-baud). With the leJOS environment, the Java
Communications API can be used for communicating with the
brick. "Somebody's even written a web server that runs on
the brick!" says Ritter.
The RCX
version 2.0 uses a USB communications port. And while leJOS
can be installed onto the system, there is no current
support for the Java USB API (JSR-080). LeJOS now supports
the USB connection on both Windows and Linux and includes a
communications API that provides the same functionality as
the JavaComm API.
Innovation on Parade
The
exciting innovations that have been created using Java
technology-enabled LEGO robots is truly impressive. In May
of 2001, the Java technology evangelists at Sun staged a
competition at Bay Area universities to see who would come
up with the most innovative LEGO brick robot. UC Santa Cruz
turned in the "SlugBot," a robot that played one-finger
melodies on a small keyboard. Stanford produced the
"MazeBot," which solved a JSP (JavaServer Pages) generated
maze. And UC Berkeley developed the winning entry, the
"PaperBot," a robot that selected and sorted paper by
color.
Figure
2: UC Santa Cruz's Music Playing SlugBot
|

Figure 3: UC Berkeley's Paper Sorting PaperBot
Figure 4: Stanford's Maze Solving MazeBot
|
Robots, Ante Up!
Ritter
demonstrated several of his LEGO robots at the 2002
SunNetwork Conference in San Francisco. One of them, a LEGO
brick on wheels, was programmed to detect and follow an
irregular black trail on a field of white. "One thread
detects events," says Ritter, "and the other thread
controls the motors and figure out the directions."
Another
of Ritter's "LEGO-bots" acts as a command-driven/speech
synthesizer-enabled robot blackjack dealer. The system
recognizes commands, vocalizes activities, and visually
interprets dealt hands. "Ready to play," the robot
announces. "Dealing cards for new hand. Player gets six of
spades," it says.
Figure 5: Simon Ritter's Demonstration LEGO Robot
With the
limited processing constraints of the LEGO brick, for many
of Ritter's demonstration robots, it's not feasible to have
all of the functionality located entirely on the brick. On
the other hand, the brick is being utilized as far more
than just a PC-controlled set of motors. "Obviously, the
vision side of things is done on the PC," says Ritter. "For
my demo where the LEGO robot fetches a certain color ball,
the PC uses the camera to locate the position of the ball,
and then it sends the coordinates of the ball to the robot.
But it's up to the LEGO to figure out how to actually get
the ball, pick it up, and bring it back. Plus, it has to
remember its position, so that it knows how to get back to
the starting point."
And the same is true of the blackjack dealer robot. While
the speech synthesis and visual processing is being handled
on the PC, the brick is handling the movement of all the
motors, figuring out where the card is in the machine, and
so forth.
And such
systems really do seem to have a life of their own at
times. While detailing a technical aside during the
SunNetwork Conference demonstration, Ritter forgot that the
dealer-bot was still in command mode. Assuming it was being
spoken to, the robot responded -- "Sorry, you must ask me
to deal a hand of cards first."
Ritter's
code for many of his demonstration robots, as well as his
robotics SDK, are available online (see links at end of
article).