|Control Roomba with Python
||[02 Jan 2006|09:21pm]
Lemonodor has a Python fragment demonstrating the Roomba serial interface API
(recently released by the manufacturer). A vacuuming robot that you can program in
Python? That sounds pretty fun to me.
You can download the specs from iRobot's hacker page.
In fact, reading the spec, the Python is right in there.
This one looks good:
"Enables unrestricted control of Roomba through the SCI and turns off the
safety features." (Does this include the Asimov Laws? Muhahaha...)
Controls Roomba's drive wheels. The command takes four data bytes, which are
interpreted as two 16 bit signed values using twos-complement. The first two
bytes specify the average velocity of the drive wheels in millimeters per
second (mm/s), with the high byte sent first. The next two bytes specify the
radius, in millimeters, at which Roomba should turn. The longer radii make
Roomba drive straighter; shorter radii make it turn more. A Drive command
with a positive velocity and a positive radius will make Roomba drive forward
while turning toward the left. A negative radius will make it turn toward the
right. Special cases for the radius make Roomba turn in place or drive
straight, as specified below.
It can even play simple MIDI songs.