[Documentation] [TitleIndex] [WordIndex

(!) 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.

Building a Map in Simulation

Description: Given a simple office environment and PR2 in simulation, how to create a map using the OpenSLAM GMapping package.

Tutorial Level: INTERMEDIATE

Next Tutorial: Using custom maps for simulation.

For details on building a map from logged data (bag files), see this page. But below will startup the essential components to build a map from simulated sensor data:


For this tutorial, you need to install the 'pr2all' variant of ROS (see installation instructions). On Ubuntu, this means:

sudo apt-get install ros-fuerte-pr2-apps

And you will also need to check out wg_robots_gazebo:

svn co https://code.ros.org/svn/wg-ros-pkg/stacks/wg_robots_gazebo/trunk/pr2_build_map_gazebo_demo/


Add above pr2_build_map_gazebo_demo directory path to your ROS_PACKAGE_PATH environment variable. Now you should be able to compile the simulation plugging in package:

rosmake pr2_build_map_gazebo_demo


  1. Start the map building demo. You can look at the referred launch scripts to see which components are loaded:
     roslaunch pr2_build_map_gazebo_demo pr2_build_map_gazebo_demo.launch
    Expect a lot of text status to scroll through the terminal as various components of the map building demo is started.

  1. The robot visualizer tool (rviz) should have been started automatically as well:


2020-02-22 13:05