Make your own robot with Java

author-image
CIOL Bureau
Updated On
New Update

Vilasini Bharadwaj

At the recently concluded Sun Tech Days in Bangalore, a huge developer community learnt how to build robots with Java. The demo showed how robots can be controlled remotely and can be programmed to suit specific needs of users. The applications that are used in building robots are- Java Speech, Lejos and Java TWAIN

Advertisment

Sun technology evangelist, Peter Karlsson demonstrated a working model of a robot that can see, speak and respond to sound.

The Lego Robot

Lejos is a Java-based replacement firmware for the Lego Mindstorms RCX microcontroller. The RCX microcontroller is a key component of any robot. Java Speech helps in easing various speech processes, it is powered with command & control recognizers, dictation systems, speech synthesizers, grammar formats and cross platform control of speech recognizers.

Java speech example grammar

grammar robot;
public = stop {stop};
public = < Turn > left {left};
public = < Turn > right {right};
public = < Go > Forward {forward};
public = < Go > Back {back};
public = (< Good > Bye) | So long {bye};

Java TWAIN Interface helps you in grabbing images from a camera or a scanner. Lejos is the operating system that runs on a Java runtime environment of just 14kb. It supports simple APIs and multiple threads.

Working of the robot

This specifications of this robot would be a programmable RCX "Brick", Hitachi 8-bit processor (16MHz), 16 Kb ROM/32 Kb RAM. The RCX can control three motors, three sensors (touch, light, and temperature, or a combination thereof), and an infrared communications device. User-written programs for the RCX take the form of bytecode that the user downloads into the unit over an infrared link. The set includes 727 Lego pieces -- ranging from the normal Lego pieces everyone is familiar with to more esoteric pieces such as gears, axles, power bricks, and sensors.

The RCX microcontroller

The total memory capacity of the RCX (the micro computer in the robot) is 32 kilobytes. The RCX demonstrates that you don't need a huge amount of memory and a huge amount of power to actually do straightforward tasks. The challenge is to get a full Java environment into that kind of space.

Advertisment

If you want your robot to perform certain functions, you can write custom programs accordingly. The Lego tool kit enables developers to build a program by connecting stacks of blocks in a builder. Each block corresponds to some programmatic construct. Once you write the program, it can be compiled into bytecode and transmitted to the RCX by an ActiveX component over an infrared serial link.

tech-news