SLAM, Simultaneous Localisation and Mapping; using simulations in stage/stageros to map the environment based on sensor readings from a mobile robot in the 'wandering' mode may be done as follows;
#.1 - Start an instance of the master in a terminal window
roscore
#.2 - Start the stage/stageros simulation in a new terminal window
rosrun stage stageros /path/to/.world file
#.3 - Start gmapping in a new terminal window
rosrun gmapping slam_gmapping scan:=base_scan
#.4 - 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.
Run the simulation sufficiently long enough for a good map. While the simulation is running, on running rxgraph in a new terminal window one may see the following graph for the ROS nodes.
Run the simulation sufficiently long enough for a good map. While the simulation is running, on running rxgraph in a new terminal window one may see the following graph for the ROS nodes.
SAMPLE OUTPUTS
#.1
NOTE : Simulations done in ROS 1.4.9 diamondback
REFERENCES
1) I thank Mac at ROS for his suggestions
2) This blogpost went to be motivation for a ROS tutorial - http://www.ros.org/wiki/stage/Tutorials/MakingMapsUsingStagesWanderController