Note: This tutorial works on ROS Electric but has known issues in ROS Fuerte and ROS Groovy. |
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Making Maps Using Stage's Wander Controller
Description: This tutorial assumes that you have mastered stage simulations and you are well acquainted with the wander controller.This tutorial uses stage's wander controller to obtain a map of the robot's environment in an incremental manner.Keywords: Stage, SLAM, map
Tutorial Level: ADVANCED
Contents
SLAM Using Stage's Wander Controller
SLAM can be realised using wander controller in stage. The robot can move around and avoid obstacles by the virtue of the wander controller, the mapping tools can be used to get 2D map of the environment.
It is worth a note that this tutorial works only for one robot, multirobot SLAM is not within the scope of this tutorial.
Codes
Download the codes from http://mobotica.googlecode.com/files/stage_controllers.tar.gz and extract the stage_controllers file and make sure that it is in the ROS path.
Build the package;
rosmake stage_controllers
Start the stage simulation
Start an instance of the master and start the stage simulation in a new terminal window
rosrun stage stageros `rospack find stage_controllers`/world/roomba-wander-slam.world
NOTE: The world file employs stage controller 'wander' hence the robot will start to move immediately and will be in a wandering mode. For more details on the 'wander' controller, see here - http://www.ros.org/wiki/stage/Tutorials/IntroductiontoStageControllers
Start gmapping
Start gmapping in a new terminal window
rosrun gmapping slam_gmapping scan:=base_scan
Start map server
Start map server in a new terminal window
rosrun map_server map_saver
The map will get saved in the directory from where the command for map_server is issued, as a pgm file. The map may be visible by clicking on it while the simulation is running, run the simulation till a desired level of accuracy has been attained.
Results etc
A sample result;
A shortcoming of this approach is that, the robot being in 'wander' mode prefers open spaces compared to narrow lanes. So, one may have to be patient until the robot covers those congested parts of the environment thus yielding a better map.
The rxgraph of this simulation shows the nodes in use;