ROS package for IARC mission 7 ground & osbtacle robots with on-board Raspberry Pi
elikos_roomba works with the create_autonomy package to communicate with and drive the Roomba with ROS. Its purpose is to implement the IARC mission 7 ground robot and obstacle behaviours.
It also has a node to manage the ground robot's top switch and call a service when activated.
-
Raspberry Pi with a RPi-compatible Ubuntu flavour (Ubuntu MATE and Xubuntu 16.04 have been tested; for more, see here)
-
Install ROS kinetic (Ubuntu/armhf) (-desktop)
-
Install WiringPi (library)
sudo apt-get purge wiringpi hash -r cd git clone git://git.drogon.net/wiringPi cd ~/wiringPi ./build
-
Create workspace directory and init the catkin workspace
mkdir -p ~/roomba_ws/src cd ~/roomba_ws/src catkin_init_workspace -
Fork the
elikos/elikos_roombarepo
Clone your own fork in the~/roomba_ws/srcfoldergit clone https://github.com/USERNAME/elikos_roomba.git cd elikos_roomba/ git remote add upstream https://github.com/elikos/elikos_roomba.gitwith
USERNAMEbeing your GitHub username -
Clone the
create_autonomypackage repo in the~/roomba_ws/srcfoldergit clone https://github.com/AutonomyLab/create_autonomy.git sudo usermod -a -G dialout $USERLog out and log back in.
-
Compile
cd ~/roomba_ws catkin buildIf compiling for a RPi, use this option to link the wiringPi library and build the topswitch node:
catkin build -DRPI=TRUEIf you don't have the
catkin_toolspackage, you can either install itsudo apt-get install python-catkin-toolsor simply use
catkin_makeinstead.catkin_make -
Source
. ./devel/setup.bash -
Do stuff
If you want to control a roomba with a joystick/controller:
-
Add your user to the dialout group (you can't access USB peripherals otherwise)
sudo usermod -a -G dialout $USERthen logout and login again
-
Install
joyandjoy_teleopsudo apt-get install ros-kinetic-joy ros-kinetic-joy-teleop -
If you want to use a keyboard instead, use
key_teleop
-
-
Create a pull request
-
rpi_local.launch- launches
create_autonomy/ca_driverwith atopswitch_nodeinside a/$(arg robot_type)robot$(arg robot_id)namespace - to be launched locally on the Raspberry Pi
- arguments
robot_id: unique id of robot [1]robot_type: type of robot (groundorobstacle) [ground]
- launches
-
robot_ground.launch- launches
groundrobot_node - to be launched on a remote computer or on the Raspberry Pi itself
- arguments
robot_id: unique id of robot [1]pos_x: initial x position of robot (meters) [0.0]pos_y: initial y position of robot (meters) [0.0]yaw: initial yaw of robots (radians) [0.0]color: color of robot (red,green, orwhite) [white]
- launches
-
robot_obstacle.launch- launches
obstaclerobot_node - to be launched on a remote computer or on the Raspberry Pi itself
- arguments
robot_id: unique id of robot [1]pos_x: initial x position of robot (meters) [0.0]pos_y: initial y position of robot (meters) [0.0]yaw: initial yaw of robots (radians) [0.0]
- launches
-
robot_sim.launch- to test
robot_viz - launches RVIZ, a
serviceredirect_nodeand 2 pairs ofgroundrobot_node+robotviz_nodeand a pair ofobstaclerobot_node+robotviz_nodeinside/$(arg robot_type)robot$(arg robot_id)namespaces
- to test
-
service_redirect.launch- launches a
serviceredirect_node - arguments
groundrobot_qty: number of ground robots to manage [1]obstaclerobot_qty: number of obstacle robots to manage [1]
- launches a
-
joy_teleop.launch- launches a
joy_teleopnode inside a/$(arg robot_type)robot$(arg robot_id)namespace - to be launched on a computer with an Xbox 360/Xbox One controller
- arguments
robot_id: unique id of robot to control [1]robot_type: type of robot (groundorobstacle) [ground]
- launches a
-
/toggle_activate- activate/deactivate all robots (via
serviceredirect_node)
- activate/deactivate all robots (via
-
/$(arg robot_type)robot$(arg robot_id)/toggle_activate- activate/deactivate robot with id
$robot_idand type$robot_type - example
- For a ground robot with id 1
rosservice call /groundrobot1/toggle_activate
- For a ground robot with id 1
- activate/deactivate robot with id
-
/$(arg robot_type)robot$(arg robot_id)/topswitch_trigger- usually called by
topswitch_nodewhen top switch of robot with id$robot_idis triggered
- usually called by
-
/$(arg robot_type)robot$(arg robot_id)/bumper_trigger- simulate triggering of bumper of robot with id
$robot_idand type$robot_type
- simulate triggering of bumper of robot with id
To have multiple robots running on the same roscore:
- start a
roscoreon a computer (preferably not one of the RPis), and note the IP - for every robot
i, starting fromi=1- on RPi through SSH:
- set
ROS_MASTER_URI(pointing to the above IP) - set
ROS_IP(pointing to this RPi) - launch
rpi_local.launchwith a uniquerobot_idand a correspondingrobot_typeroslaunch elikos_roomba rpi_local.launch robot_id:=i robot_type:=TYPE
- set
- on host computer or RPi through SSH, launch
robot_ground.launchorrobot_obstacle.launchwith correspondingrobot_idorroslaunch elikos_roomba robot_ground.launch robot_id:=iroslaunch elikos_roomba robot_obstacle.launch robot_id:=i - or launch
joy_teleop.launchwith correspondingrobot_idandrobot_typeon a computer with an Xbox controllerroslaunch elikos_roomba joy_teleop.launch robot_id:=i robot_type:=TYPE
- on RPi through SSH:
- launch
service_redirect.launchwith the number of ground robotsngand number of obstacle robotsnoroslaunch elikos_roomba service_redirect.launch groundrobot_qty:=ng obstaclerobot_qty:=no - activate robots
rosservice call /activate
Mostly because Christophe is dumb and often forgets.
-
Error on
roslaunchof eitherca_driverorca_tools joy_teleop-
Serial error, with a message like
[create::Serial] failed to receive data from Create. Check if robot is powered!and no serial communication from the robot:
- no blue light on the USB connector of the USB-to-serial cable; or
- no response when doing
cat /dev/ttyUSB0 115200
Try:
- Press the power button once. It should immediately connect.
- If that still doesn't work, force the roomba to reset. Remove the 4 screws and then remove the battery. Wait a couple seconds, then put it back in along with the screws. You should hear a little happy tune and serial communication should now work.
- Battery may be dead. Charge the roomba!
-
-
Can't run ROS or
roslaunchca_tools joy_teleopfrom another computer
See ROS/Tutorials/MultipleMachines- Configure
ROS_MASTER_URIvariable pointing to theroscorehost for every terminal on both the host and remote computerswithexport ROS_MASTER_URI=http://192.168.x.y:11311192.168.x.ybeing the actual address of the host computer; check withhostname -I
- Configure
-
No communication between the host and remote computer
Symptom:Couldn't find an AF_INET address for [HOSTNAME]message on theroscoreof the host- Configure
ROS_IPvariable pointing to the local computer for every terminal on both the host and remote computersfind theexport ROS_IP=192.168.x.y192.168.x.yaddress withhostname -I
- Configure
To generate documentation with doxygen (because why not; sometimes a readme isn't enough!)
doxygen Doxyfile
Behaviour description of the ground robot and obstacle robot according to the official rules.
| Info | Ground robot | Obstacle robot |
|---|---|---|
| Initial position | 1 m radius, equally spaced and facing outward | 5 m radius, equally spaced and oriented clockwise |
| Normal trajectory | foward @ 0.33 m/s | 10 m diameter CW circle centered on arena @ 0.33 m/s |
| Interactions | - Bumper: 180° CW - Top switch: 45° CW |
None |
| Noise/random | - Every 20 seconds: 180° CW - Every 5 seconds, while moving: 0° ≤ angle ≤ 20° CCW |
None |
Parts list:
- Raspberry Pi 3 (because it has built-in Wi-Fi)
- Power bank (make sure it can output >= 2.5 A per port; this one works)
- Power cable (using a short cable like these is probably a good idea)
Tip: disconnect the RPi power cable when not using the robot. That seems to drain the power bank very quickly even if the RPi is turned off.