Skip to content

2D Laser based SLAM using gmapping

SifuF edited this page Jun 11, 2014 · 10 revisions

SLAM is bandwidth intensive and so the process should be launched on the robot. The robot should also be set as the ROS_MASTER_URI in the ROS network setup.

First, SSH into the robot:

ssh qbo@sigproc-robot1

Where sigproc-robot1 is for the wireless connection to the robot (replace with binky for the wired robot connection).

Then to run SLAM with gmapping:

roslaunch qbo_laser_slam mapping.launch

This will also launch qbo_joypad and the robot can now be driven using the wireless Xbox controller (Hold RB then use the left analogue stick). To visualise the mapping process, first ensure to source the correct environment on your laptop:

Create a file called setupssh.bash in $HOME/cued-masters/ and paste in the following:

source $HOME/cued-masters/devel/setup.bash
export ROS_HOSTNAME="`hostname`"
export ROS_MASTER_URI="http://sigproc-robot1:11311"

Note: this script assumes the hostname command has the right output. If for some reason it doesn't, set ROS_HOSTNAME directly. sigproc-robot1 is the robot hostname for the wireless connection (change this to binky for the wired connection).

Now source the environment by navigating to $HOME/cued-masters/ and typing:

source setupssh.bash

Finally launch the visualiser:

rosrun rviz rviz

In rviz, add the following objects: Map (then under topic choose /map), LaserScan (then under topic choose /scan_reduced), TF, and RobotModel.

In order to save a map, in a (correctly sourced) terminal, type:

rosrun map_server map_saver

To Navigate the saved map, place the map.pgm and map.yaml files (generated by map_saver) into the $HOME/cued-masters/src/qbo_sigproc/qbo_laser_slam/maps folder (on the robot) and then type (again by ssh'ing into the robot):

roslaunch qbo_laser_slam navigation.launch

Navigation goals can then be issued in rviz.

Clone this wiki locally