Thumbnail

Irobot Roomba Movement Panel

by iRobot

Control the iRobot Roomba and read sensor data from 500 series roombas

How to add the Irobot Roomba Movement Panel robot skill

  1. Load the most recent release of ARC (Get ARC).
  2. Press the Project tab from the top menu bar in ARC.
  3. Press Add Robot Skill from the button ribbon bar in ARC.
  4. Choose the Movement Panels category tab.
  5. Press the Irobot Roomba Movement Panel icon to add the robot skill to your project.

Don't have a robot yet?

Follow the Getting Started Guide to build a robot and use the Irobot Roomba Movement Panel robot skill.

How to use the Irobot Roomba Movement Panel robot skill

Control the iRobot Roomba and read sensor data. This skill currently works with the 500 series robots and iRobot create. The baud rate and connection type will need to be configured in the settings menu. 

This robot skill can connect to an iRobot by using either a USB adapter or a microcontroller acting as an EZB (Arduino, etc.). The connection type in the config menu will specify the way this skill communicates with the iRobot. Continue reading below...

Main Window
User-inserted image

1) Enable sensor streaming and statistics of received sensor data. This requires a bi-directional connection. See below for different connection types and reading sensor data.

2) Movement directions to drive the robot, and a box to place the mouse cursor which enables using the keyboard arrow keys.

3) The speed for the left and right wheels, which defaults to 0.

4) Commands for initializing the SCI connection, enabling cleaning, stop cleaning, or powering off the robot

5) Status and log data for successful initialization and errors.


Config Window
User-inserted image

1) Connection type. Changing this setting will enable the selected connection type configuration below (Software serial, PC COM port, H/W UART). There is more information below in this manual on connection types.

2) Software Serial connection type. This type should only be used if there are no other supported options. This uses software serial on the EZB to emulate a transmitted serial signal. This is not 100% reliable and therefore should only be used if there are no other options. This is a one-way transmission, so sensor data cannot be read.

3) PC COM Port connection type. Uses a PC COM/Serial port that is usually a USB<->TTL convertor or an official iRobot Roomba USB cable (See details below). This is a bi-directional transmission, so sensor data can be read.

4) H/W UART on the EZB. Selecting this will use the HW UART if supported. This allows sensor data to be read because it is bi-directional.

5) NMS (Navigation Messaging System).

a) Enabling the first option in this group will send the iRobot Roomba's current coordinates to the NMS as a Level #3 Group #2 positioning/pose sensor. There is more information about this further in this manual.

b) The second option in this group will Pause NMS navigation if any of the iRobot Roomba sensors are triggered. The sensors covered are: cliff, bumper, virtual wall, and wheel drop

Baud Rates
Different models (i.e. create vs Roomba) use different baud rates. Find your Roomba's version and check it's SCI (Serial Command Interface) or OI (Open Interface) manual to see what baud rate it uses. We believe the Roomba uses baud rate 115200, and the create uses 57600. But, don't hold us to that :). We do notice that older Roomba's use 57600 baud - ensure you have selected the correct baud rate in the config settings. 500+ series Roombas use 115,200 baud. If you are unsure, try each baud rate.

Demo Video
Here's a video of the nice proportional steering that this control provides the iRobot Roomba. This video has the Roomba set to follow Kate's orange socks.


Like all movement panels, only one can exist. In this case, this Movement Panel will connect to a Roomba by its SCI interface. This control allows for a variety of speeds also, so you can use the analog joystick to control speeds. Or use the speed control in the camera to track objects with nice smooth trajectories.

ARC allows multiple physical robot controllers to be connected at once. The Movement Controls only operate on the first board (Board 0) or PC serial port.

Reading Sensor Data
You can read sensor data if the PC COM or HW UART ports are used for the connection. This also requires the TX and RX wires to be connected to the Roomba's SCI port. The data from the sensors and internal values are set as global variables. You can access everything from battery voltage to wheel encoder counts.

SCI Connection Types
The connection types that can be used to connect the Roomba to ARC are:

1. Software Serial (read-only)
2. HW UART (read/write bi-directional two-way)
3. USB COM TTL (read/write bi-directional two-way)

Roomba SCI Cable 
The cable can have either TX & RX or just RX connected from the Roomba. However, do note that if only the RX pin is connected, the sensor data will not be read. 

Roomba <-> USB <-> PC
This cable will allow reading sensor data. iRobot has a low-cost USB cable that can connect directly to a PC. This is useful if the PC is located within the robot. You can get it from here: https://store.irobot.com/default/parts-and-accessories/create-accessories/communication-cable-for-create-2/4466502.html

Roomba <-> EZB <-> PC (two-way communication)
This cable will allow reading sensor data. This requires a 7 pin Male Mini Din to connect to an EZB I/O Controller. Watch DJ's iRobot Roomba Live Hack to see how to make a cable. The meat of the video starts at 20:00 because the first bit is demonstrating the iRobot Roomba and talking about it. You can find the part numbers and design information for a cable on Synthiam's GitHub repo HERE


Roomba <-> EZB <-> PC (one-way communication)
The image below demonstrates how to make a cable with RX only. Meaning, the sensor data will not be read by ARC.
User-inserted image



Charging After SCI Connection
When the iRobot Roomba is used with this robot skill, the robot will be put into a mode that will not accept charging. The only way to enable the robot to accept charging is to power off or reset using the two buttons on the control. Pressing either the Reset/Power Off or Power Down buttons will play an acknowledge song if successful.
User-inserted image



NMS (Navigation Messaging System)
Within the configuration, the menu has an option to enable the NMS (Navigation Messaging System). This will push calculated cartesian position/location (i.e. pose) coordinates into the NMS for use with mapping/navigation tools such as The Navigator. In order to obtain wheel encoder data from the iRobot, a two-way SCI cable is needed (i.e. RX and TX must be connected) and streaming must be enabled.

The iRobot uses wheel encoders (508.8 ticks per revolution) to keep track of the odometry. This robot skill will calculate cartesian coordinates from the wheel encoders and send those values into the NMS. The iRobot's memory will keep the wheel encoder count even when powered off. In order to use the NMS correctly, follow this procedure to clear the iRobot memory and reset the encoder counts.

Get The Navigator robot skill here.

1) Visit the iRobot robot skill configuration screen and enable NMS. Also, ensure your connection type is either PC COM Port or H/W UART because those are the only two that allow two-way communication. 

*Optionally, you may select the "Pause NMS navigation with sensor detection" checkbox. This will send a pause signal to the selected NMS Level #1 navigator if any of the sensors are triggered.
User-inserted image




2) Connect to the iRobot Roomba and enable Sensor Streaming. Verify packets are being received by the packet count increasing in the Sensor Data status display. This step ensures the cable configuration is correctly receiving sensor data from the iRobot Roomba. If the packet count is increasing, the cable configuration is correct.
User-inserted image


3) Now we will press the Reset/Power Off button and the robot will play a little tune acknowledging that it has rebooted and reset internal settings. The Sensor Streamer checkbox will disable as well. This step will instruct the Roomba to reset the wheel encoder values which sets the position to 0 cm x 0 cm (home).
User-inserted image


4) Position your iRobot Roomba in the room where 0,0 (home) will be. Good idea to mark the area as well so saved maps can be re-used.
User-inserted image


5) Press the CLEAN button once on the iRobot to power on. It should light up. 
User-inserted image


6) In the robot skill, press the INIT button and then enable Sensor Streaming. Again, verify packets are being received. The robot will play a little tune acknowledging that it has been initialized.
User-inserted image


7) If you have The Navigator robot skill added to your project, you will notice the robot will be at location 0,0 (home).
User-inserted image


8) You may now right-click in The Navigator and specify waypoints or drive the robot around and view the trajectory. Read The Navigator for instructions on using that robot skill, as it is not covered in this manual.

Accuracy of Wheel Encoders
... or lack of accuracy is a better title. Wheel encoders are not accurate for mapping but will present a general enough position for simple tasks. This is because there are many limitations to wheel encoder odometry, such as gear slop, slipping wheels and real-world velocities are not constant.

As quoted by Andrew Kramer's work based on Edwin Olson's 2004 paper...

Quote:


The larger problem is that odometry is inherently inaccurate. Encoder ticks do not translate directly into distance traveled by the wheel because wheels slip, the wheels aren’t perfectly circular, the ground isn’t perfectly flat, encoder ticks might be missed, and the motor gearbox has a backlash that isn’t accounted for in our model. This means that the position calculated from odometry will gradually diverge from the true position. We could use other methods that might be more accurate, such as optical flow and IMUs. However, any sensor we might use suffers from some inherent random error, known as noise, and this error will accumulate over time.

Great Platform Base
How about using an iRobot Roomba for your robot wheelbase? You can attach a camera and the EZ-B to a Roomba and turn it into a lean mean cleaning security machine! Combine a USB Joystick and the HTTP Remote Server Control... Voila! Remote control security cleaning robot. That's easy!

You can use an iRobot Roomba motherboard as an H-Bridge to drive your custom motors. This gives your robot the ability to self-charge. By positioning the IR sensors on your robot in the same fashion as the Roomba, your robot can easily dock with the Roomba's self-charging base.

ARC Pro

Upgrade to ARC Pro

Unleash your creativity with the power of easy robot programming using Synthiam ARC Pro

#127   — Edited
If all else fails install pull up resistors on the encoder's A & B lines. Usually, a 1k resistor placed between "A" and "5V," and another one placed between "B" and "5V" of the encoder feedback lines should work in most cases. Place them near the controller.
PRO
Synthiam
#128  
Actually that has me thinking. Because these roombas are used to clean dust and dirt.... I wonder if they’re dirty. Maybe take the wheels off and give them a good spray of compressed air. Maybe wash with brake clean. I use brake clean for everything lol. I keep a 20 liter metal barrel from Napa around at all times
Portugal
#129   — Edited
There is something not right with the navigator plugin.
The encoder counts are spot on, but every time the value passes from 65545 the position of the robot jumps out of the map. This happens every time the left or right encoder passes this value counting up or down.
PRO
Synthiam
#130  
That’s because the value wraps. It’s a fault in the design of the roomba encoder values. Remember, the position is estimated by the encoder values changing. When it changes from 0 to 65000, it thinks it has moved a far way. I cannot fix the firmware of the roomba vacuum.
Portugal
#131   — Edited
Sorry but i dont understand. An encoder is finite, so when it reaches the end it goes back to 0. What am i missing?
PRO
Synthiam
#132   — Edited
I’m not sure what you’re missing either. Maybe you missed one of my previous responses or I can add more information? You see, it would be different if I was in charge of the encoder counts because I’d reset the count every time I referenced it in the pose calculation. But instead I can only see the counts it returns. So the value might suddenly jump to 65000 because the uint16 wrapped (overloaded).

remember this is a vacuum you’re using. It’s a vacuum that was made to bounce off walls with a bump sensor.

*Edit: an encoder count is simply an integer value (number). It increments or decrements every time a "tick" from a "switch" on a wheel. The switch is connected to a wire on the MCU which has an interrupt. That means it jumps to that piece of code every time the i/o port switches from high to low or vice versa. When that happens, you simply ENCODER_COUNT++ if it's one way, or ENCODER_COUNT-- if it's reverse.

The trouble with the roomba is the encoder count value is returned, but that's it. So there's no way to "reset it" every time it is read. So when the encoder count continually increases, it eventually wraps the small int16 they're using for the count size. That means in reverse it does the same thing, it can go from 100 to 65300 in one packet. The trouble is there's no way to know what just happened in the time between the last packet and the most recent.

What I "could" do as a hack, is see if the encoder difference is greater than 30,000 and assume it wrapped - then calculate the difference. It's probably not going to work well because the accuracy might be decreased... but the robot won't "jump" on the map. Instead, it'll go to a position that "might be close" lol

There's a lot of information in the NMS page about the challenges with pose telemetry and odometery that have plagued the world of robotics forever. The closest we've come in the industry for inside-out navigation (i.e. the robot uses its sensors) is the intel realsense. Just sucks that it has been discontinued....

The robots used in warehouses and at amazon, etc use outside-in navigation. External sensors tell the robot where it is. This is how the IPS works. I have an item on my todo list to modify the IPS to use a glyph - but that still doesn't help when something is in the way.
#133   — Edited
Hi DJ,
Have you tried to use the NMS with a roomba in this configuration? I notice in the hack videos above yo do not use the NMS and on the NMS hack you do it with the realsense camera. It seems we should be able to get something to work with the wheel encoders here.
 It would be good to see a floor map from someone that had it working with just encoders. I am not sure if Proto has my basic config or something much better.
PRO
Synthiam
#134   — Edited
Yes, in order to create a robot skill the hardware is required. In this case, it's an iRobot Roomba 500 series vacuum that I test with. Pictures and screenshots are in the manual above. I explained why the encoders do what they do and how it affects the NMS in the post above your response. I might have a method to hack the encoder values - but it won't be perfect for this vacuum.

I wrote a lengthy and detailed response in the post above.
Portugal
#136   — Edited
Thank you DJ for taking the time to explain.
I was thinking maybe we could read the encoder count to two 32bit variables and use that instead. That would give us 2147483647 i think, this number would be enough.
PRO
Synthiam
#137   — Edited
Also, it appears the encoders for this vacuum are even simpler than first imagined. They're not quadrature, which means each wheel only has one switch. So the roomba MCU determines the direction the count goes. This also means the accuracy is even more limited. Also, it means there is only 1 single fault of error so the encoder values are going to be out-to-lunch when they're dirty (or a loose wire). 

From: https://www.irobotweb.com/~/media/MainSite/PDFs/About/STEM/Create/iRobot_Roomba_600_Open_Interface_Spec.pdf


User-inserted image
PRO
Synthiam
#138   — Edited
Interesting, there are a few documented firmware issues as well - but this one shouldn't affect us because I'm calculating the angle based on the encoder values. It's just that the encoder values are bonkers on some roombas....

User-inserted image



User-inserted image
PRO
Canada
#139  
I just wanted to mention that you probably shouldn’t use brake clean on your Roomba as it contains acetone. Acetone melts ABS and other plastics. I would suggest using isopropyl or windex for cleaning any plastic based robots. Or good old fashioned soap and water if there aren’t electronics at risk of getting wet.
PRO
Synthiam
#140  
Yeah - jeremie is correct. But I live on the edge:D
#141  
DJ, the bad boy of robotics. Lock up your daughters!
So I am now wondering if I have an encoder problem or whether this NMS can operate with the Roomba Create2. What is the next step besides all the cameras that keep getting cancelled?
PRO
Synthiam
#142  
Next step is I’m working on an idea to handle wrapping the encoder value. I wrote the code two days ago and it needs testing on real hardware before I release it. Need a day or two
PRO
Synthiam
#143  
This is a crazy update but it might just work... Long as the iRobot Roomba is reset to the home position with Step #3 in the above manual instructions, this should work with all encoder values. I tested this successfully on my Roomba and I'm able to move in reverse even at home position - this was the problem that made everything go crazy.
#144  
Thanks for working on it DJ. I have been resetting to home as the tutorial calls for. I have the issue. I am not sure it is an encoder wrapping problem for me unless I misunderstand the term. Mine work fine for about 10 seconds then  become completely erratic. I think I may be having comms problems.
PRO
Synthiam
#145  
Comm or encoder issues. I’m guessing encoder because if it was comm, the parser wouldn’t understand the packet and raise an error.
Portugal
#146  
Hi DJ, can you elaborate on the workaround you did? Will test it when I get home.