Page 48 - Hacking Roomba
P. 48
Chapter 2 — Interfacing Basics 29
BAUD: The BAUD command sets the baud rate (the speed of data transferal) in bits per
second (bps). The data byte is the baud code (0–11) of the baud rate to use. See the ROI
specification in Appendix C or at http://irobot.com/developers for getting the
right baud code for a baud rate. The default rate is 57,600 bps, which has a baud code
of 10. This speed is well-supported and fast enough for most every use. Changing the
baud rate can lead to the age-old problem of never being sure at what speed each side is
transferring data. In general do not change the baud rate unless 57,600 bps will not work
for your application. All the projects in this book that use a PC to talk to Roomba use
57,600 bps.
CONTROL: The CONTROL command enables control of Roomba. It is almost always sent
immediately after the START command. This command puts the robot in the safe mode.
SAFE: The SAFE command returns Roomba to the safe mode if it isn’t already in it. This
is only relevant if Roomba is in the full mode.
FULL: The FULL command puts the robot in the full mode if it isn’t already in it.
Roomba must be in the safe mode for this command to work.
POWER: This is a virtual button-press command. It is equivalent to pushing the Power
button on the Roomba. This command puts Roomba in the sleep mode.
SPOT: This is a virtual button-press command. It is equivalent to pushing the Spot but-
ton on Roomba. It starts the Spot cleaning algorithm.
CLEAN: This is a virtual button-press command. It is equivalent to pushing the Clean
button. It starts the Clean cleaning algorithm.
MAX: This is a virtual button-press command. It is equivalent to pushing the Max button.
It starts the Max cleaning algorithm.
DOCK: This turns on the force-seeking dock algorithm of the robot. It is equivalent to
pressing both Spot and Clean buttons simultaneously. Roomba stops whatever it was
doing and tries to find the charging dock.
Drive Motors
The DRIVE command controls the drive wheels. It takes four bytes of data: two for velocity and
two for direction, each treated as 16-bit signed values using two’s complement. (Two’s comple-
ment is a way of representing negative numbers in computers, accomplished by counting back-
ward from the maximum value in the range. For example, -5 in a 16-bit range is 2^16-5 =
65536-5 = 65531 = 0xFFFB.)
The velocity is simply the speed, forward or back, at which Roomba should move. The direc-
tion is a bit trickier. It’s mostly the turn radius, but has some special case values, as seen below.
(The values in parentheses are the hexadecimal representation of the values shown.)
Velocity: from -500 to 500 mm/s (0xFE0C to 0x01F4)
Direction: either a radius or some special purpose values
■ Turn on a radius: -2000 to 2000 mm (0xF830 to 0x07D0)