Cheapness and their flexibility are placing LEGO MindStrom in the middle of many university research projects. The Robotic Inventor System allows you to create everything, from a simple robot that follows a light source to a complex robotic harm who plays chess. The only limit is represented by its hardware endowment ( a single RCX can manage only three motors and three sensors, the communication is provided by Infrared signals and 32 Kbs of RAM are very few keeping in mind that a tiny JVM have to run inside ). Afterwards, thinking to develop complex algorithms in this environment it still seems an utopia. As a consequence, to solve this problem we develop a framework that allows the remote control of the RCX Brick. The leRCoS project ( lego Remote Control System ) moves the execution logic into PC side environment rising RCX Brick burden. leRCoS also abstract the RCX Brick into a standard Java Object that can execute in a full java environment taking advances of it.

The leRCoS project is a small middleware acting between LEGO RCX bricks and a J2SE environment. With leRCoS, the robot logic can be moved inside a JRE in a very simple way. leRCoS is based on leJOS (in the RCX side) and exposes the same API on the server side; this makes very simple porting leJOS applications on leRCoS.

Project is divided into two main parts: The leRCoS application depicted in the figure produces commands that the rcxCommander packs and sends to the RCX Brick (via IR communication system) using an efficient custom protocol. Commands are then interpreted and executed inside the RCX brik by the rcxInterpreter. The protocol allows commands to be packed into a multi-threading way; for example is it possible to start two or three motors contemporary using a single command.

The main features of leRCoS project are:
Furhermore, the leRCoS client introduces a simple GUI console allowing monitoring and controlling a single RCX brick.

Official project page

The leRCoS is also posted in the open source Java community Java.net. Source code and documentation can be found here.

Downloads

Installation Guide

Install on your RCX brick the leJOS firmware (usefull information about the procedure can be founded here). Unzip the rcxinterpreter.jar file using the command:

jar -xf rcxinterpreter.jar
then download the bytecode into the RCX using the command:
lejos lercos.Main
The rcxInterpreter can be executed just pressing the RUN button in your RCX.
In the server side you need the rcxCommander.jar file. In order to work rcxCommander needs the pcrcxcomm.jar (provided from leJOS 2.1 version) and of course the irtower.dll driver to use the IR tower (placed in the same directory). You can open the RCX Controller GUI typing:
java -jar rcxCommander.jar lercos.gui.GuiController
(or double-click on the rcxCommander.jar file)

Developer Guide

Using leRCoS is very simple, once your system is configured you can write your first program. leRCoS API structure is very similar to the leJOS one, this make easy porting old leJOS application upon the new framework.

Here it is an example of a NerdBot program running on leRCoS.

import java.io.IOException;
import lercos.remote.rcx.*;

public class NerdBot {
    public static void main(String[] args){
        RCX rcx = null;
        try {
            rcx = new RCX();    // instantiate RCX Object
         } catch (IOException e) {
            System.out.println("LEGO Tower - Access Denied");
            return;
        }
        rcx.Motor.A.forward();  // start motor A
        try {
            Thread.sleep(2000); // wait 2 seconds
        } catch (InterruptedException e1) {
            e1.printStackTrace();
        }
        rcx.Motor.A.stop(); // stop motor A
        rcx.Button.RUN.waitForPressAndRelease();
     }
}
Compile this Java class using the javac compiler including the rcxCommander.jar in the classpath.
javac -cp rcxCommander.jar NerdBot.java
Execute the Java program in the JRE using the command:
java -cp rcxCommander.jar NerdBot
And now, use your immagination ans enjoy leRCoS.