Page 443 - Hacking Roomba
P. 443

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






                                               iRobot® Roomba® Open Interface (ROI) Specification
                      Remote Control Command                  Charging State
                      Packet subset: 2                        Packet subset: 3
                      Range: 0 – 255 (with some values unused)  Range: 0 – 5
                      Data type: 1 byte, unsigned             Data type: 1 byte, unsigned
                      The command number of the remote control command currently   A code indicating the current charging state of Roomba.
                      being received by Roomba. A value of 255 indicates that no
                      remote control command is being received. See Roomba remote   Code  Charging State
                      control documentation for a description of the command values.
                                                              0    Not Charging
                                                              1    Charging Recovery
                      Buttons                                 2    Charging
                      Packet subset: 2                        3    Trickle Charging
                                                              4    Waiting
                      Range: 0 – 15
                                                              5    Charging Error
                      Data type: 1 byte, unsigned
                      The state of the four Roomba buttons are sent as individual bits   Voltage
                      (0 = button not pressed, 1 = button pressed).  Packet subset: 3
                       Bit  7  6   5   4   3   2   1   0      Range: 0 – 65535
                       Button  n/a  n/a  n/a  n/a  Power  Spot  Clean  Max
                                                              Data type: 2 bytes, unsigned
                      Distance                                The voltage of Roomba’s battery in millivolts (mV).
                      Packet subset: 2
                                                              Current
                      Range: -32768 – 32767
                                                              Packet subset: 3
                      Data type: 2 bytes, signed
                                                              Range: -32768 – 32767
                      The distance that Roomba has traveled in millimeters since the
                      distance it was last requested. This is the same as the sum of   Data type: 2 bytes, signed
                      the distance traveled by both wheels divided by two. Positive   The current in milliamps (mA) flowing into or out of Roomba’s
                      values indicate travel in the forward direction; negative in the   battery. Negative currents indicate current is flowing out of the
                      reverse direction. If the value is not polled frequently enough, it   battery, as during normal running. Positive currents indicate
                      will be capped at its minimum or maximum.  current is flowing into the battery, as during charging.
                      Angle                                   Temperature
                      Packet subset: 2                        Packet subset: 3
                      Range: -32768 – 32767                   Range: -128 – 127
                      Data type: 2 bytes, signed              Data type: 1 byte, signed
                      The angle that Roomba has turned through since the angle was   The temperature of Roomba’s battery in degrees Celsius.
                      last requested. The angle is expressed as the difference in
                      the distance traveled by Roomba’s two wheels in millimeters,   Charge
                      specifically the right wheel distance minus the left wheel
                      distance, divided by two. This makes counter-clockwise angles   Packet subset: 3
                      positive and clockwise angles negative. This can be used to   Range: 0 – 65535
                      directly calculate the angle that Roomba has turned through
                      since the last request. Since the distance between Roomba’s   Data type: 2 bytes, unsigned
                      wheels is 258mm, the equations for calculating the angles in   The current charge of Roomba’s battery in milliamp-hours (mAh).
                      familiar units are:                     The charge value decreases as the battery is depleted during
                      Angle in radians = (2 * difference) / 258  running and increases when the battery is charged.
                      Angle in degrees = (360 * difference) / (258 * Pi).
                                                              Capacity
                      If the value is not polled frequently enough, it will be capped at   Packet subset: 3
                      its minimum or maximum.
                                                              Range: 0 – 65535
                      Note: Reported angle and distance may not be accurate. Roomba
                      measures these by detecting its wheel revolutions. If for example, the   Data type: 2 bytes, unsigned
                      wheels slip on the floor, the reported angle of distance will be greater than   The estimated charge capacity of Roomba’s battery. When the
                      the actual angle or distance.
                                                              Charge value reaches the Capacity value, the battery is fully
                                                              charged.
                                                            8                             www.irobot.com
   438   439   440   441   442   443   444   445   446   447   448