Roomba Sensor Request Roomba Spot navigation bar

Table of Contents

Roomba Sensor Stream

Requests a continuous stream of the specified sensor packets.

Library

QUARC Targets/Devices/Third-Party/iRobot/Roomba/Interfacing

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

qc_open_library('quarc_library/Devices/Third-Party/iRobot/Roomba/Interfacing')

Description

Roomba Sensor Stream

The Roomba Sensor Stream block requests a continuous stream of the specified sensor packets to Roomba. The list of packets requested is sent every 15 ms, which is the rate iRobot Roomba uses to update data. The sensor packets are specified as follows:

Packet Number Name Bytes Value Range Units Description
7 Bumps and Wheel Drops 1 0 - 31 - The state of the bumper (0 = no bump, 1 = bump) and wheel drop sensors (0 = wheel raised, 1 = wheel dropped) are sent using the following bit pattern.
Bit 7 6 5 4 3 2 1 0
Sensor - - - Wheeldrop Caster Wheeldrop Left Wheeldrop Right Bump Left Bump Right
8 Wall 1 0 - 1 - The state of the wall sensor is sent as a 1 bit value (0 = no wall, 1 = wall seen).
9 Cliff Left 1 0 - 1 - The state of the cliff sensor on the left side of Roomba is sent as a 1 bit value (0 = no cliff, 1 = cliff).
10 Cliff Front Left 1 0 - 1 - The state of the cliff sensor on the front left of Roomba is sent as a 1 bit value (0 = no cliff, 1 = cliff).
11 Cliff Front Right 1 0 - 1 - The state of the cliff sensor on the front right of Roomba is sent as a 1 bit value (0 = no cliff, 1 = cliff)
12 Cliff Right 1 0 - 1 - The state of the cliff sensor on the right side of Roomba is sent as a 1 bit value (0 = no cliff, 1 = cliff)
13 Virtual Wall 1 0 - 1 - The state of the virtual wall detector is sent as a 1 bit value (0 = no virtual wall detected, 1 = virtual wall detected). Note that the force field on top of the Home Base also trips this sensor.
14 Overcurrents 1 0 - 31 - The state of the three Low Side driver and two wheel overcurrent sensors are returned using the following bit pattern (0 = no overcurrent, 1 = overcurrent).
Bit 7 6 5 4 3 2 1 0
Motor - - - Left Wheel Right Wheel LD-3 LD-1 LD-2
The current limits of the drivers are as follows:
Driver Current Limit
LD1 0.5A
LD2 0.5A
LD3 0.5A
Wheels 1.0A
15 Unused 1 0 - Unused bytes: Two unused bytes are sent after the overcurrent byte when the requested packet is 0, 1, or 6. The value of the two unused bytes is always 0.
16 Unused 1 0 - Unused bytes: Two unused bytes are sent after the overcurrent byte when the requested packet is 0, 1, or 6. The value of the two unused bytes is always 0.
17 IR Byte 1 0 - 255 -
IR Beam This value identifies the IR byte currently being received by Roomba. A value of 255 indicates that no IR byte is being received. These bytes include those sent by the Roomba Remote, the Home Base, Roomba Send IR command, and user-created devices. The following figure and table describe the IR bytes.
Sent by iRobot Device Character Value Character Name
Remote Control 129 Left
130 Forward
131 Right
132 Spot
133 Max
134 Small
135 Medium
136 Large / Clean
137 Pause
138 Power
139 Arc-forward-left
140 Arc-forward-right
141 Drive-stop
Scheduling Remote 142 Send All
143 Seek Dock
Home Base 240 Reserved
248 Red Buoy
244 Green Buoy
242 Force Field
252 Red Buoy and green Buoy
250 Red Buoy and Force Field
246 Green Buoy and Force Field
254 Red Buoy, Green Buoy and Force Field
18 Buttons 1 0 - 15 - The state of Roomba's Play and Advance buttons are returned using the following bit pattern (0 = button not pressed, 1 = button pressed).
Bit 7 6 5 4 3 2 1 0
Button - - - - - Advance - Play
19 Distance 2 -32768 - 32767 mm The distance that Roomba has traveled in millimeters since the distance it was last requested is sent as a signed 16-bit value, high byte first. This is the same as the sum of the distance traveled by both wheels divided by two. Positive values indicate travel in the forward direction; negative values indicate travel in the reverse direction. If the value is not polled frequently enough, it is capped at its minimum or maximum.
20 Angle 2 -32768 - 32767 mm The angle in degrees that Roomba has turned since the angle was last requested is sent as a signed 16-bit value, high byte first. Counter-clockwise angles are positive and clockwise angles are negative. If the value is not polled frequently enough, it is capped at its minimum or maximum. Note that Roomba uses wheel encoders to measure distance and angle. If the wheels slip, the actual distance or angle traveled may differ from Roomba's measurements.
21 Charging State 1 0 - 5 - This code indicates Roomba's current charging state.
Code Charging State
0 Not Charging
1 Reconditioning Charging
2 Full Charging
3 Trickle Charging
4 Waiting
5 Charging Fault Condition
22 Voltage 2 0 - 65535 mV This code indicates the voltage of Roomba's battery in millivolts (mV).
23 Current 2 -32768 - 32768 mA The current in milliamps (mA) flowing into or out of Roomba's battery. Negative currents indicate that the current is flowing out of the battery, as during normal running. Positive currents indicate that the current is flowing into the battery, as during charging.
24 Battery Temperature 1 -128 - 127 degree Celsius The temperature of roomba's battery in degree Celsius.
25 Battery Charge 2 0 - 65535 mAh The current charge of Roomba's battery in milliamp-hours (mAh). The charge value decreases as the battery is depleted during running and increases when the battery is charged. Note that this value will not be accurate if the alkaline battery pack is used.
26 Battery Capacity 2 0 - 65535 mAh The estimated charge capacity of Roomba's battery in milliamphours (mAh). Note that this value is inaccurate if the alkaline battery pack is used.
27 Wall Signal 2 0 - 4095 - The strength of the wall sensor's signal is returned as an unsigned 16-bit value, high byte first.
28 Cliff Left Signal 2 0 - 4095 - The strength of the left cliff sensor's signal is returned as an unsigned 16-bit value, high byte first.
29 Cliff Front Left Signal 2 0 - 4095 - The strength of the front left cliff sensor's signal is returned as an unsigned 16-bit value, high byte first.
30 Cliff Front Right Signal 2 0 - 4095 - The strength of the front right cliff sensor's signal is returned as an unsigned 16-bit value, high byte first.
31 Cliff Right Signal 2 0 - 4095 - The strength of the right cliff sensor's signal is returned as an unsigned 16-bit value, high byte first.
32 User Digital Inputs 1 0-31 - The state of the digital inputs on the 25-pin Cargo Bay Connector are returned using the following bit pattern (0 = low, 1 = high (5V)).
Bit 7 6 5 4 3 2 1 0
Digital Input - - - Device Detect/Baud Rate Change (pin 15) Digital Input 4 (pin 6) Digital Input 3 (pin 18) Digital Input 2 (pin 5) Digital Input 1 (pin 17)
Note that the Baud Rate Change pin is active low; it is high by default. Device Detect pin can be used to change Baud Rate. When device detect/baud rate change Bit is low, the Baud Rate is 19200. Otherwise it it 57600
33 User Analog Input 2 0 - 1023 - The 10-bit value of the analog input on the 25-pin Cargo Bay Connector is returned, high byte first. 0 = 0 volts; 1023 = 5 volts. The analog input is on pin 4.
34 Charging Sources Available 1 0 - 3 - Roomba's connection to the Home Base and Internal Charger are returned as individual bits, as below (1 = charging source present and powered; 0 = charging source not present or not powered).
Bit 7 6 5 4 3 2 1 0
Charging Source - - - - - - Home Base Internal Charget
35 OI Mode 1 0 - 3 - Roomba's operating modes are returned as below.
Number Mode
0 Off
1 Passive
2 Safe
3 Full
36 Song Number 1 0 - 15 - The currently selected song is returned.
37 Song Playing 1 0 - 1 - The state of the song player is returned. 1 = song currently playing; 0 = song not playing.
38 Number of Stream Packets 1 0 - 42 - The number of data stream packets is returned.
39 Velocity 2 -500 - 500 mm/s The velocity most recently requested with a Drive command is returned as a signed 16-bit number, high byte first.
40 Radius 2 -32768 - 32767 mm The radius most recently requested with a Drive command is returned as a signed 16-bit number, high byte first.
41 Right Velocity 2 -500 - 500 mm/s The right wheel velocity most recently requested with a Drive Direct command is returned as a signed 16-bit number, high byte first.
42 Left Velocity 2 -500 - 500 mm/s The left wheel velocity most recently requested with a Drive Direct command is returned as a signed 16-bit number, high byte first.

This command is available in Passive, Safe, or Full operating mode of Roomba (see Roomba Modes block). Execution of this command does not change current Roomba operating mode.

Important Notes

Note Use System Timebase block in Normal simulation.

Input Ports

rmb

A reference to the Roomba stream (see Roomba Initialize block).

packet_id

Specifies a list of sensor packet numbers. Each packet number must be 7 to 42.

Output Ports

rmb

A reference to the Roomba stream, which is the same as input Roomba stream reference. It helps creating a daisy chain of Roomba blocks.

pack

The sensor packets returned by Roomba (see descriptions of sensor packets). The output packet contains a 16-bit signed value for each requested packet.

err

This signal returns a negative value in case of invalid sensor packet number, wrong packet header, invalid packet checksum, memory allocation error, or data communication error through Roomba serial port.

Parameters and Dialog Box

Roomba Sensor Stream

Operation mode

The operation mode operations are: Start and Stop, which are used to start and stop a continuous stream of the specified packets.

Sample time

The sample time of the block. A sample time of 0 indicates that the block will be treated as a continuous time block. A positive sample time indicates that the block is a discrete time block with the given sample time. A sample time of -1 indicates that the block inherits its sample time.

Warning Note that the sensor uopdate rate on Roomba is 15 ms. As a result, the maximum possible frequency of this block is 66Hz.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

Yes

Yes

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Yes

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

Yes

Yes

Use System Timebase.

* Compatible means that the block can be compiled for the target.

See Also

 

navigation bar