RoombaComm
RoombaComm is Java library for communicating and controlling the Roomba. It works on any operating system that RXTX supports. This includes Mac OS X, Linux, and Windows. It also works with Processing. It will soon work with Flash and Max/MSP.
It’s been a work in progress for several months and has gotten a little better as I work through improving it for the book.
Several bugs have been fixed, particularly with respect to Bluetooth on Windows. See the README for some info on that.
Tested systems:
- Mac OS X 10.4 (Tiger) : usb serial & bluetooth
- Mac OS X 10.3 (Panther) : usb serial & bluetooth
- Windows 2000 : usb serial & bluetooth
- Gumstix Linux : built-in serial
Tested adapters:
- Homemade RS-232 adapter
- Homemade Bluetooth adapter
- RooStick USB adapter
Demo command-line programs include:
- DriveRealTime — Drive your Roomba with cursor keys
- RTTTLPlay — Play monophonic ringtones on your Roomba
- Spiral — Roomba drives in ever expanding spiral
- Waggle — Roomba wags like a dog
- BumpTurn — Roomba drives around by itself, avoiding things
- Spy — Read your Roomba’s mind while it works
- Tribble — Roomba purrs and sometimes barks
- RoombaCommTest — Roomba GUI remote control panel (not command-line)
Processing demos include:
- RoombaTune — Play your Roomba like a musical instrument
- RoombaRing — Play RTTTL ringtones on a Roomba
- RoombaView — Full instrument panel and remote control
This is what RoombaView looks like:

Download:
- full package: roombacomm-0.95.zip
- Processing library: roombacomm-processing-0.95.zip
Docs:
- javadoc
- README-0.95
- the source tree
30 Comments so far
Leave a reply

The books says there should be a Windows version of RoombaCommTest, but there is only a Mac version under roombacomm/packaging/RoombaCommTest.app/Contents for roombacomm-0.95.zip.
Where can I find the Windows version?
Hi Pat,
I’m tardy in doing an updated release of RoombaComm. I’ll see if I can produce an updated one soon.
For now, you can access the SVN repository for RoombaComm at:
http://roombahacking.com/roombahacks/roombacomm/.
I just did a full checkout and made a tarball of to download here: roombacomm-20070201.tar.gz.
Neither of those contain the PC-specific stuff, but if you have Java installed, you can run the roombacomm.RoombaCommTest Java program from the command line like any other.
I downloaded RoombaComm, unzipped it to a file but cannot find the install icon. I would apprciate any help anyone could give.
Thanks
I’m using roombacomm and it works great, bought the book too - but the only sensor update command that seems to be working is the default updateSensors(), which updates all the sensors. I tried to make a method called updatePhysicalSensors(), calling sensors(SENSORS_PHYSICAL) but it won’t update, even if I’m holding down on the bump sensor the entire time. Why might this be happening?
thanks for any help.
Hi Isaac,
I’m glad things are (mostly) working for you. The RoombaComm code only supports getting all the sensor data. You can send the SENSORS command just fine, but you’ll need to subclass
RoombaCommSerial.serialEvent()to receive the appropriate number of bytes for the packet you want instead of the 26 bytes comprising the entire set of sensor data. You’ll also need to make sure you place those bytes in the right place in the internalsensor_bytesarray so that the other functions can get at it.I experimented with making a general sensors reading system in RoombaComm that dealt with the various sizes of sensor packets. The additional complexity on what was already a complex bit of logic for code meant for a book for novices made me remove it.
In practice I found the overhead of getting all 26 bytes at 57.6kbps didn’t prevent any of the tasks I wanted.
I bought the book and am also looking for the windows version of roombacomm. I don’t want to order the parts from jameco until I am sure I have all the software in place. Perhaps I am missing something here, but is there a version of roombacomm available for downloading that will work with windows XP?
There is no Windows version, per se. RoombaComm is all Java, which works on all computer platforms. There is a Windows application wrapper for RoombaCommTest, but it got lost in a disk crash. I’ll see if I can put it back together again. It’s not required, as you can run all the Java examples from the command-line.
If you’d like a Windows application right now to test out your interface, try out the “SCITester” app you can download from SparkFun.
For WinXP users:
First you have to install the JAVA JDK and configure the PATH variable.
Then, using the command prompt from the folder \roombacomm-0.95\roombacomm
type this (it is a single line)
java -Djava.library.path=rxtxlib -classpath ".;rxtxlib/RXTXcomm.jar" roombacomm.RoombaCommTestVoila. I also test the RoombaCommTest with my Roomba and it works like a charm.
However, I noticed that the button for turn left/right do not work (the rotate left/right work). Probably it’s because they were not programmed to do something.
I found these instructions here:
http://gicl.cs.drexel.edu/wiki/Connecting_Roomba_to_Your_Computer
Argyrios
Hey todd, I recently bought the book, and there’s lots of great projects. I’m working on the bluetooth configuration and I’m trying to run RoombaComm from WinXP. And like a few others who posted there is not an application for windows in the zip file. Can you update everyone on how to call the java functions from the command line. I’ve tried using Argyrios’ method but get an error of ‘Exception in thread “main” java.lang.NoClassDefFoundError: roombacomm/RoombaCommTest’. And the README file isnt any help since it is for the serial tether. Any help would be much appreciated. Thanks
Hi Bill,
The RS-232 and Bluetooth adapters are the same from the software point of view, because they both appear as serial ports.
I’ll admit to not being too savvy about Windows, but the invocation of Java commands is almost identical across all platforms. Just colons turn into semi-colons when specifying classpaths.
The Java invocation and link Argyrios has above which contains it should work just fine. It’s what I use.
Some things to check:
- Are you in the top “roombacomm” directory, which has “rxtxlib” and “roombacomm” as subdirectories? The library path and classpath statements are relative.
- Do the .class files exist? You should have them, but if somehow you do not, you can regenerate them from the .java files with:
javac -Xlint:unchecked -classpath ".;rxtxlib/RXTXcomm.jar" roombacomm/*.java(also all on one line)
[…] http://hackingroomba.com/code/roombacomm/ […]
Hey Todd, I recently bought the book and have made the serial interface. Everything seems to be correct, RealTerm sends back info, RombaCommTest is up and running, but nothing happens. It states it’s connected you can send the different commands to move, but nothing. I’m using a different type of USB-serial interface, WinXP and the Roomba was made after 12-05-05. Thanks
Hi Pete,
You might have some oddness with your Java installation. Since you’re on Windows, one way to remove that as a possibility is to download the “SCI Tester” program from RoombaDevTools.com. It’s a Visual Basic program, so uses different code to access the serial port.
I assume when you say that RealTerm sends back info, you’re referring to connecting the TX & RX pins together on your adapter before hooking it to a Roomba to create a loopback so you can see yourself type?
Or are you referring to how the Roomba will emit text on its ROI port when it boots up after its battery is inserted. That’s always a good way to check that at least the sending from Roomba to PC is working.
If the loopback is working, but the Roomba isn’t sending text when its battery is inserted, try flipping the TX & RX lines to the ROI port, you may have them swapped. Otherwise, you might have ended up with a Roomba that doesn’t have the ROI firmware in it.
Todd, Thanks for replying right back.
I have tried the SCItester with no luck.
Yes I can see myself typing when I use the Loopback in RealTerm. Roomba does emit text on its ROI port when it boots up after its battery is inserted.
I have several Roomba’s. Some will emit a tone after you keep holding down the power button, I have read that means they have the ROI firmware in it. Thanks
hi. i downloaded the roombacomm and unzipped it but the jar apps is not opening. I’m using win2k. any help is appreciated.BTW, i’m using the serial tether on the irobot create and it works fine. thank’s in advance
I have two roomba. One day I accidentally make a short circuit to the vacuum motor ,and the motor did not work since then. Another roomba’s vaccum motor also disfunctioned when cleanning the wet floor. Is there anything I can do to make motor work again through the roomba open interface (ROI) commands or the panel buttons or any other way except back to the repair shop?
Hi Kevin,
Oh no! I’ve zapped a Roomba too. It’s a real bummer. Unfortunately, once you cause a physical problem with the Roomba, no amount of talking to it with software will fix it.
But you can look at this as an excellent reason to poke around inside your Roombas to see how they work. You may even be able to find a replacement motor on the net. Check out the forums on http://www.roombareview.com/; there are lots of people who have repaired or taken apart their Roombas there.
Otherwise, yes, the only solution is to take it to the repair shop.
hi tod:
I have a 500 series Roomba 535 which use 115200 as default baud rate.
I’ve changed the rate string in RoombaCommSerial.java code and re-compile it with JDK 1.6.0_05. There’s no error during compile, but it shown 23 warnings.
I repackaged the .jar file and use it to replace the one in the “processing\libraries\roombacomm\library” folder.
When I execute the roombatune.pde sample code, the processing reported the following error message:
java.lang.UnsupportedClassVersionError: roombacomm/RoombaCommSerial (Unsupported major.minor version 50.0)
Could you tell me how to fix this problem? Thanks in advanced!
Jeffrey
Hi Jeffrey,
Thanks for the research on the Roomba 500 series.
I think that error is because a Java class stores a version number for every class it calls. In this case, there are other Java classes in the RoombaComm library that you’ll need to recompile too. I just do “javac *java” or similar. The “makeit.sh” does this, and could be turned into a .bat file with minimal changes (mostly change the classpath separater to ‘;’ instead of ‘:’)
And since Processing is all Java as well, you’ll need to recompile the Processing sketch. Just clicking ‘Run’ or re-exporting the application should be fine.
Hi Tod:
Thanks very much for quick reply.
I’ve recompile every Java file, and execute the RoombaCommTest class. However, it didn’t work on my Roomba 535.
I’ll rebuilt a RS-232 to TTL cable and try again, thanks a lot!
Jeffrey
Hello Tod,
I purchased ‘the book’, and built a nice little serial tether following your schematic. I have a 500-series Roomba, and changed the baud speed in RoombaCommSerial.java to 115200 as per the 500series ROI pdf, recompiled, launched RoombaCom Test, and cannot get any command to send.
Have you had a chance to play around with any of the 500 Roombas? Do you have any suggestions?
Thanks!
Hi Clayton,
I’ve not had a chance to play with the newer Roombas. I recall seeing a post on the RoombaReview.com forums that they’ve gotten them to work.
I’ve not had a chance to update the RXTX Java serial library in the RoombaComm distribution, so you might want to try that, in case it’s a software problem. The easiest way to do the update is to grab the three files here:
http://todbot.com/arduino/rxtx/
and plop them into the ‘rxtx’ directory of your RoombaComm folder.
Hi Tod,
Thanks for the quick reply!
I gave it a go, but still no success. I’ll poke around roombareview.com forums for a while and see what I can find. I’ll most definitely report back for everyone’s benefit if I get it all worked out.
-Clayton
Hi Clayton, Thanks! All my Roomba stuff is in storage right now and I feel bad I can help out directly.
It appears as though goBackward(int) and goForward(int) in your provided roombacomm aren’t working. Has this issue been addressed?
Hi Jesse,
Those functions worked. What problems are you having? I must admit the solution for goBackward(int), goForward(int) and goStraight(int) (the method the previous two call) is somewhat hacky, based purely on time-based dead-reckoning. But it still should have done something approximately correct.
When I call the functions, the robot doesn’t seem to do anything (eg. roombacomm.goBackward(100) just sits there).
Now, roombacomm.goBackward(1000) causes the roomba to move forward. Quite interesting, if you ask me. I’m just using goFoward() with a pause for now. If I find that I really need to use goForward(int), I’ll modify roombacomm to make it work.
Other than that, I am very pleased with the package!
Hmmm, that’s weird. Although I do admit to not testing those methods much. I don’t suppose you call “setSpeed(int)” at some point beforehand? That’s about the only thing I could think of could cause a problem. That is, assuming that code works. More likely there’s a bug in there. :) If it bugs you, feel free to poke around the source.
Nope, don’t call setSpeed. I may poke around a bit if the need comes up. Have a good one.
Hi Tod & Jesse,
The reason goBackward(int) and goStraight(-int) are alway moving forward is because there is a bug in goStraight(int distance). The ideal case is to move forward at positive speed when the distance is positive, and to move backward at negative speed when the distance is negative (or move backward at given distance in goBackward(). However, the code is missing an if statement to check whether the goStraight(int) should pass a negative speed or positive speed to goStraightAt() method.
Hope this will help.