Table of Contents
Roomba Sensor Stream
Requests a continuous stream of the specified sensor packets.
Library
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
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.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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).
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 | - |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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).
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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)).
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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).
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
35 | OI Mode | 1 | 0 - 3 | - |
Roomba's operating modes are returned as below.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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
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
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.
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 |
---|---|---|---|
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
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. |
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.