Page 439 - Hacking Roomba
P. 439

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






                                               iRobot® Roomba® Open Interface (ROI) Specification

                      Safe  Command opcode: 131  Number of data bytes: 0  Serial sequence: [137] [Velocity high byte] [Velocity low byte]
                                                                       [Radius high byte] [Radius low byte]
                      This command puts the ROI in safe mode. The ROI must be in
                      full mode to accept this command.       Drive data bytes 1 and 2: Velocity (-500 – 500 mm/s)
                      Note: In order to go from passive mode to safe mode, use the Control   Drive data bytes 3 and 4: Radius (-2000 – 2000 mm)
                      command.                                     Special cases: Straight = 32768 = hex 8000
                      Serial sequence: [131]                            Turn in place clockwise = -1
                                                                        Turn in place counter-clockwise = 1
                      Full  Command opcode: 132  Number of data bytes: 0
                                                               Example:
                      Enables unrestricted control of Roomba through the ROI and
                      turns off the safety features. The ROI must be in safe mode to   To drive in reverse at a velocity of -200 mm/s while turning at
                      accept this command. This command puts the ROI in full mode.  a radius of 500mm, you would send the serial byte sequence
                                                               [137] [255] [56] [1] [244].
                      Serial sequence: [132]
                                                               Velocity = -200 = hex FF38 = [hex FF] [hex 38] = [255] [56]
                      Power  Command opcode: 133  Number of data bytes: 0
                                                               Radius = 500 = hex 01F4 = [hex 01] [hex F4] = [1] [244]
                      Puts Roomba to sleep, the same as a normal “power” button
                      press. The Device Detect line must be held low for 500 ms to
                      wake up Roomba from sleep. The ROI must be in safe or full
                      mode to accept this command. This command puts the ROI in
                      passive mode.                           Motors Command opcode: 138  Number of data bytes: 1
                                                              Controls Roomba’s cleaning motors. The state of each motor is
                      Serial sequence: [133]
                                                              specified by one bit in the data byte. The ROI must be in safe
                                                              or full mode to accept this command. This command does not
                      Spot  Command opcode: 134  Number of data bytes: 0  change the mode.
                      Starts a spot cleaning cycle, the same as a normal “spot”   Serial sequence: [138] [Motor Bits]
                      button press. The ROI must be in safe or full mode to accept this
                      command. This command puts the ROI in passive mode.  Motors data byte 1: Motor Bits (0 – 7)
                      Serial sequence: [134]                  0 = off, 1 = on
                                                              Bit  7  6  5  4  3  2   1    0
                      Clean  Command opcode: 135  Number of data bytes: 0
                                                              Motor  n/a  n/a  n/a  n/a n/a  Main  Vacuum Side Brush
                      Starts a normal cleaning cycle, the same as a normal “clean”   Brush
                      button press. The ROI must be in safe or full mode to accept this
                      command. This command puts the ROI in passive mode.
                                                               Example:
                      Serial sequence: [135]
                                                               To turn on only the vacuum motor, send the serial byte
                      Max  Command opcode: 136  Number of data bytes: 0  sequence [138] [2].
                      Starts a maximum time cleaning cycle, the same as a normal
                      “max” button press. The ROI must be in safe or full mode to
                      accept this command. This command puts the ROI in passive   Leds  Command opcode: 139  Number of data bytes: 3
                      mode.
                                                              Controls Roomba’s LEDs. The state of each of the spot, clean,
                      Serial sequence: [136]
                                                              max, and dirt detect LEDs is specified by one bit in the first data
                                                              byte. The color of the status LED is specified by two bits in the
                      Drive  Command opcode: 137  Number of data bytes: 4  first data byte. The power LED is specified by two data bytes, one
                                                              for the color and one for the intensity. The ROI must be in safe
                      Controls Roomba’s drive wheels. The command takes four data
                      bytes, which are interpreted as two 16 bit signed values using   or full mode to accept this command. This command does not
                      twos-complement. The first two bytes specify the average velocity   change the mode.
                      of the drive wheels in millimeters per second (mm/s), with the   Serial sequence: [139] [Led Bits] [Power Color] [Power Intensity]
                      high byte sent first. The next two bytes specify the radius, in
                      millimeters, at which Roomba should turn. The longer radii make   Leds data byte 1: Led Bits (0 – 63)
                      Roomba drive straighter; shorter radii make it turn more. A Drive   Dirt Detect uses a blue LED: 0 = off, 1 = on
                      command with a positive velocity and a positive radius will make   Spot, Clean, and Max use green LEDs: 0 = off, 1 = on
                      Roomba drive forward while turning toward the left. A negative
                      radius will make it turn toward the right. Special cases for the   Status uses a bicolor (red/green) LED: 00 = off, 01 = red, 10 =
                      radius make Roomba turn in place or drive straight, as specified   green, 11 = amber
                      below. The ROI must be in safe or full mode to accept this
                      command. This command does change the mode.  Bit  7  6  5  4  3  2  1  0
                                                               LED  n/a  n/a  Status (2 bits)  Spot  Clean  Max  Dirt Detect
                      Note: The robot system and its environment impose restrictions that may
                      prevent the robot from accurately carrying out some drive commands. For   Power uses a bicolor (red/green) LED whose intensity and color
                      example, it may not be possible to drive at full speed in an arc with a large
                      radius of curvature.                    can be controlled with 8-bit resolution.
                                                            4                             www.irobot.com
   434   435   436   437   438   439   440   441   442   443   444