RoombaComm: Roomba Control & Communications API, release 0

Update:
new version of RoombaComm released

As mentioned previously, I’ve started on a library to make Roomba-to-host-computer interfacing easier. This is the zeroth release of such a library.

The goals of this library are:

  • provide full access to the entire Roomba SCI protocol
  • provide a set of higher-level functionality on top of the SCI protocol
  • create a library that is as cross-platform as possible
  • provide interfaces to high-level languages/environments like Java, Flash, Processing, Max/MSP, etc.
  • allow someone who’s not an expert programmer utilize a rapid development environment like Processing to quickly manipulate the Roomba.

Java was chosen as a language, since the RXTX serial library seems well-developed on many platforms and has been tested thouroughly in Processing. Java also has good network connectivity, making it possible to create a net-to-serial adapter for the other languages.

And so the RoombaComm API:

RoombaComm In Use
In both Java and Processing, usage is very similar. Here is an example in Processing, which also forms the core of one of the Java examples:

RoombaCommSerial roombacomm = new RoombaCommSerial(this);

if( roombacomm.connect("/dev/cu.KeySerial1") ) {
    println("connected!");
    roombacomm.startup();

    println("Playing some notes");
    roombacomm.playNote( 72, 10 );
    roombacomm.pause( 200 );
    roombacomm.playNote( 79, 10 );
    roombacomm.pause( 200 );
    roombacomm.playNote( 76, 10 );
    roombacomm.pause( 200 );

    println("Spinning left, then right");
    roombacomm.spinLeft();
    roombacomm.pause(1000);
    roombacomm.spinRight();
    roombacomm.pause(1000);
    roombacomm.stop();

    println("Going forward, then backward");
    roombacomm.goForward();
    roombacomm.pause(2000);
    roombacomm.goBackward();
    roombacomm.pause(2000);
    roombacomm.stop();

    println("Disconnecting");
    roombacomm.disconnect();
}
else {
  println("could not connect! :(");
}

If all goes well with the above, you should see and hear something like this:

The API functions used above allow for a very Logo-like programming experience. The API has also more detailed commands, including the ability to read the Roomba’s sensors. As there is no documentation, see the examples and source for now.

Expect a new version of this API with more examples and documentation within a week or so.

2 Replies to “RoombaComm: Roomba Control & Communications API, release 0”

  1. Hi,
    Great project!
    Are any of the source codes of your work available? I’m working on a similar project of controlling a RC car through a Keyspan usb serial adaptor and could use some help / examples of programming the serial communications. More specifically, from my mac I need to send on/off or high/low signals to 4 different serial ports that are hooked up to the forward/back left/right buttons of the RC car transmitter.
    Thanks, Jim

Leave a Reply

Your email address will not be published. Required fields are marked *