This page details how to connect and control a Roomba 530 series robot. The instructions and code can be readapted for earlier versions of the Roomba, and will be discussed here.
To control the Roomba robot wirelessly with python you will first need two components.
- First you need to make sure the wireless adapter (RooTooth) is plugged into the robot. If you do not have a RooTooth adapter one can be bought at Sparkfun.
- Second you need the python code to connect to the robot and send commands. The code can be found by clicking: RoombaLRC.
Note that the code to control the Roomba is based off RoombaSCI.py found here.
If the RooTooth adapter you are using is new you'll have to set the baudrate. Here is some info on how to set the baudrate.
To communicate with the Roomba via bluetooth you first have to register the robot with your computer.
- First remove the top cover of the Roomba, then plug in the RooTooth.
- Turn on the robot
OSX Go to your bluetooth setting. You should see an item called RNBT-73B9 ( or something similar). Pair the device to your computer. Your port number will look something Windows Go to your bluetooth settings and then to add device. You should see a device called RNBT-73B( (or something simiiar). Add the device and then go to 'Device and Printers'. You should see the bluetooth device you just added. Right click on the object, go to properties, and then hardware. Take note of the com number.
- Open Calico, or any python terminal, and load RoombaLRC.py.
- Run initCom()
- You can now send commands to the Roomba
To view or set the roomba's current mode
Available modes are passive, safe, full, and off.
- Request and receive sensor data, but no control over motors and actuators
- Full control except in the following situations: if the robot's cliff sensors detect a dropoff, if the robot detects a wheels drop, or if the robot is plugged in. In the prior situations occurs the motors will stop and the robot will go into passive mode.
- Full control with no safety features that will stop the robot.
- Robot doesn't respond to any commands.
The commands and modes of operation for the Roomba can be found in the documentation for the iRobot Create Open Interface.
More detailed information
- Passive Mode: Robot will perform the default demos and behaviors such as basic cleaning. You can also query it's sensors.
- Safe Mode: Also known as control mode. In safe mode you can control the motors of the robot, but if the robot detects a cliff or drop off it's safety parameters will kick in.
- Full Mode: Also called control mode, in this mode you have full control of the robot and there are no built in safety behaviors.
All the Roomba files that the LRC has can be found in the following zip. Roomba.zip
- RoombaSCI_API.py - Original API found
- RoombaSCI2.py - API found at https://github.com/jflesch/PyRoomba. Nearly the same as RoombaSCI_API.py except the connect() function.
- RoombaSCI_API_RV.py - Attempt to add more functionality to RoombaSCI_API.py Unknown what the main differences are (good place to start with connecting to robot)
- RoombaSCI_API_RV2.py - Attempt to add more functionality to RoombaSCI_API.py Unknown what the main differences are (good place to start with connecting to robot)
For the last two API files you can connect to the roomba by doing robot=initCom(). You would then try the various commands such as.
- Various test scripts. Should be used merely as a reference and double checked with the actual API files
- Files used for an LRC event. The API file in this zip folder should be the same as RoombaSCI_API_RV2.py