Page 438 - Hacking Roomba
P. 438

Appendix C — iRobot Roomba Open Interface (ROI) Specification                    419





                                                    iRobot® Roomba® Open Interface (ROI) Specification
                           Roomba Open Interface Modes             Roomba Open Interface Commands
                                                                   Listed below are the commands that users send to the ROI over
                           The Roomba ROI has four operating modes: off, passive, safe,
                           and full. On a battery change or other loss of power, the ROI will   to the serial port in order to control Roomba. Each command
                           be turned off. When it is off, the ROI will listen at the default   is specified by a one-byte opcode. Some commands must also
                           baud bps for an ROI Start command. Once it receives the Start   be followed by data bytes. The meaning of the data bytes for
                           command, the ROI will be enabled in passive mode. In passive   each command are specified with the commands below. The
                           mode, users can do the following:       serial byte sequence for each command is also shown with each
                                                                   separate byte enclosed in brackets. Roomba will not respond
                            • Request and receive sensor data using the   to any ROI commands when it is asleep. Users can wake up
                             Sensors command                       Roomba by setting the state of the Device Detect pin low for
                            • Execute virtual button pushes to start and stop cleaning   500ms. The Device Detect line is on Roomba external Mini-DIN
                             cycles (Power, Spot, Clean, and Max commands)  connector.
                            • Define a song (but not play one)
                            • Set force-seeking-dock mode          Start  Command opcode: 128  Number of data bytes: 0
                                                                   Starts the ROI. The Start command must be sent before any
                           Users cannot control any of Roomba’s actuators when in passive
                           mode, but Roomba will continue to behave normally, including   other ROI commands. This command puts the ROI in passive
                           performing cleaning cycles, charging, etc. When in passive mode,   mode.
                           users can then send the Control command to put the robot into   Serial sequence: [128]
                           safe mode.
                                                                   Baud  Command opcode: 129  Number of data bytes: 1
                           In safe mode, the users have full control of the robot, except for
                           the following safety-related conditions:  Sets the baud rate in bits per second (bps) at which ROI
                            • Detection of a cliff while moving forward (or moving backward   commands and data are sent according to the baud code sent
                             with a small turning radius)          in the data byte. The default baud rate at power up is 57600
                                                                   bps. (See Serial Port Settings, above.) Once the baud rate is
                            • Detection of wheel drop (on any wheel)
                                                                   changed, it will persist until Roomba is power cycled by removing
                            • Charger plugged in and powered       the battery (or until the battery voltage falls below the minimum
                                                                   required for processor operation). You must wait 100ms after
                           When one of the conditions listed above occurs, the robot stops   sending this command before sending additional commands
                           all motors and reverts to passive mode.
                                                                   at the new baud rate. The ROI must be in passive, safe, or full
                                                                   mode to accept this command. This command puts the ROI in
                           For complete control of the robot, users must send the Full
                           command while in safe mode to put the ROI into full mode. Full   passive mode.
                           mode shuts off the cliff and wheel-drop safety features. (The   Serial sequence: [129] [Baud Code]
                           robot will still not run with a powered charger plugged in.) This   Baud data byte 1: Baud Code (0 – 11)
                           mode gives users unrestricted control of the robot’s actuators.
                           To put the ROI back into safe mode, users can send the Safe   Baud code  Baud rate in bps
                           command.                                0      300
                                                                   1      600
                           If no commands are sent to the ROI when it is in safe or full
                                                                   2      1200
                           mode, Roomba will wait with all motors off and will not respond
                                                                   3      2400
                           to button presses or other sensor input.
                                                                   4      4800
                           To go back to passive mode from safe or full mode, users can   5  9600
                           send any one of the four virtual button commands (Power, Spot,   6  14400
                           Clean, or Max). These button commands are equivalent to the   7  19200
                           corresponding button press in normal Roomba behavior. For
                                                                   8      28800
                           instance, the Spot command will start a spot cleaning cycle.
                                                                   9      38400
                                                                   10     57600
                           Allow 20 milliseconds between sending commands that change
                           the ROI mode.                           11     115200
                                                                   Control Command opcode: 130  Number of data bytes: 0
                                                                   Enables user control of Roomba. This command must be sent
                                                                   after the start command and before any control commands are
                                                                   sent to the ROI. The ROI must be in passive mode to accept this
                                                                   command. This command puts the ROI in safe mode.
                                                                   Serial sequence: [130]
                                                                 3                             www.irobot.com
   433   434   435   436   437   438   439   440   441   442   443