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_roomba
repo
Clone your own fork in the~/roomba_ws/src
foldergit clone https://github.com/USERNAME/elikos_roomba.git cd elikos_roomba/ git remote add upstream https://github.com/elikos/elikos_roomba.git
with
USERNAME
being your GitHub username -
Clone the
create_autonomy
package repo in the~/roomba_ws/src
foldergit clone https://github.com/AutonomyLab/create_autonomy.git sudo usermod -a -G dialout $USER
Log out and log back in.
-
Compile
cd ~/roomba_ws catkin build
If compiling for a RPi, use this option to link the wiringPi library and build the topswitch node:
catkin build -DRPI=TRUE
If you don't have the
catkin_tools
package, you can either install itsudo apt-get install python-catkin-tools
or simply use
catkin_make
instead.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 $USER
then logout and login again
-
Install
joy
andjoy_teleop
sudo 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_driver
with atopswitch_node
inside 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 (ground
orobstacle
) [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_node
and 2 pairs ofgroundrobot_node
+robotviz_node
and a pair ofobstaclerobot_node
+robotviz_node
inside/$(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_teleop
node 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 (ground
orobstacle
) [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_id
and 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_node
when top switch of robot with id$robot_id
is triggered
- usually called by
-
/$(arg robot_type)robot$(arg robot_id)/bumper_trigger
- simulate triggering of bumper of robot with id
$robot_id
and type$robot_type
- simulate triggering of bumper of robot with id
To have multiple robots running on the same roscore
:
- start a
roscore
on 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.launch
with a uniquerobot_id
and a correspondingrobot_type
roslaunch elikos_roomba rpi_local.launch robot_id:=i robot_type:=TYPE
- set
- on host computer or RPi through SSH, launch
robot_ground.launch
orrobot_obstacle.launch
with correspondingrobot_id
orroslaunch elikos_roomba robot_ground.launch robot_id:=i
roslaunch elikos_roomba robot_obstacle.launch robot_id:=i
- or launch
joy_teleop.launch
with correspondingrobot_id
androbot_type
on a computer with an Xbox controllerroslaunch elikos_roomba joy_teleop.launch robot_id:=i robot_type:=TYPE
- on RPi through SSH:
- launch
service_redirect.launch
with the number of ground robotsng
and number of obstacle robotsno
roslaunch 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
roslaunch
of eitherca_driver
orca_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
roslaunch
ca_tools joy_teleop
from another computer
See ROS/Tutorials/MultipleMachines- Configure
ROS_MASTER_URI
variable pointing to theroscore
host for every terminal on both the host and remote computerswithexport ROS_MASTER_URI=http://192.168.x.y:11311
192.168.x.y
being 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 theroscore
of the host- Configure
ROS_IP
variable pointing to the local computer for every terminal on both the host and remote computersfind theexport ROS_IP=192.168.x.y
192.168.x.y
address 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.