[Documentation] [TitleIndex] [WordIndex

Note: This tutorial assumes that you have completed the previous tutorials: Turtlebot Bringup, PC Bringup.
(!) 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.

SLAM Map Building with TurtleBot

Description: How to generate a map using gmapping

Tutorial Level: BEGINNER

Next Tutorial: Autonomous Navigation of a Known Map with TurtleBot

Builds a map to let the robot autonomously move around

/!\ If you're using Gazebo simulator instead of real robots, consult a tutorial under turtlebot_gazebo package (direct link to { Indigo, Kinetic } version).


This tutorial shows how to build a map to let the robot remember the environnment around. With generated map, robot can autonomously navigate around.


Make sure the minimal software has already been launched on the robot and you have configured your network correctly. The default navigation parameters provided on turtlebot_navigation should be apropriate in most cases, but if not, take a look at the setup navigation tutorial.


1. On the TurtleBot, start gmapping_demo on the turtlebot laptop.

# From turtlebot laptop.
 > roslaunch turtlebot_navigation gmapping_demo.launch

2. On the PC

Start rviz already configured to visualize the robot and its sensor's output:

 > roslaunch turtlebot_rviz_launchers view_navigation.launch

If you are facing a trouble, please check your setups. TurtleBot Bringup, PC Bringup, and Network Configuration

3. Drive the robot around by either and save map:



Start the remocon and fire up the PC Pairing/Make A Map interaction. It starts rviz and spawns a terminal for keyboard teleop.

Save the map to file

After SLAM, the map which is built can be saved as a file with the following command.

rosrun map_server map_saver -f /tmp/my_map

Note: Do not close the gmapping launch until saving the map.

Video of process

In rviz it will look something like this:

To see the map updates on RViz as you drive the robot around, under Map on the left hand side panel, check to see that Topic is set to map, in addition to setting your ROS_MASTER_URI to the Turtlebot.

What Next?

2019-06-15 12:34