## page was renamed from turtlebot/Tutorials/Build a map with SLAM
## page was renamed from turtlebot/Tutorials/Generate a map
## For instruction on writing tutorials
## http://www.ros.org/wiki/WritingTutorials
####################################
##FILL ME IN
####################################
## for a custom note with links:
## note =  
## for the canned note of "This tutorial assumes that you have completed the previous tutorials:" just add the links 
## note.0= [[turtlebot_bringup/Tutorials/indigo/TurtleBot Bringup|Turtlebot Bringup]], [[turtlebot_bringup/Tutorials/indigo/PC Bringup|PC Bringup]]
## descriptive title for the tutorial
## title = SLAM Map Building with TurtleBot
## multi-line description to be displayed in search 
## description = How to generate a map using gmapping
## the next tutorial description (optional)
## next =
## links to next tutorial (optional)
## next.0.link= [[turtlebot_navigation/Tutorials/indigo/Autonomously navigate in a known map|Autonomous Navigation of a Known Map with TurtleBot]]
## next.1.link=
## what level user is this tutorial for 
## level= BeginnerCategory
## keywords =
## TurtleBotGettingStartedCategory
####################################

<<IncludeCSTemplate(TutorialCSHeaderTemplate)>>

##START


||<style="border: 1px solid black; background-color:#5bc0de; text-align: center; vertical-align:top;" tablewidth="100%">Builds a map to let the robot autonomously move around||


<<TableOfContents(4)>>

/!\ If you're using `Gazebo` simulator instead of real robots, consult a tutorial under [[turtlebot_gazebo]] package (direct link to { [[turtlebot_gazebo/Tutorials/indigo/Make a map and navigate with it|Indigo]], [[turtlebot_gazebo/Tutorials/kinetic/Make a map and navigate with it|Kinetic]] } version).

== Goal ==

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

== Execute ==

Make sure the [[turtlebot_bringup/Tutorials/indigo/TurtleBot Bringup|minimal software]]  has already been launched on the robot and you have [[turtlebot/Tutorials/indigo/Network Configuration|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 [[turtlebot_navigation/Tutorials/Setup the Navigation Stack for TurtleBot|setup navigation tutorial]].

'''Roslaunch'''

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/Tutorials/indigo/TurtleBot Bringup|TurtleBot Bringup]], [[turtlebot_bringup/Tutorials/indigo/PC Bringup|PC Bringup]], and [[turtlebot/Tutorials/indigo/Network Configuration|Network Configuration]] 

3. Drive the robot around by either and save map:
 * Using telop (keyboard, joystick, or other) from [[turtlebot_teleop/Tutorials| Teleoperation Tutorials]]
 * If you are having troubles making a map check out this [[http://answers.ros.org/question/2871/trouble-getting-an-accurate-map-with-turtlebot|question]].

Or

'''Remocon'''

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

||<style="text-align: center; vertical-align:center;" tablewidth="100%">{{attachment:makemap.png||width=70%}}||

== 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:

<<Youtube(fljcaI4MDfA)>>

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? ==

 * [[turtlebot_navigation/Tutorials/indigo/Autonomously navigate in a known map|Autonomous Navigation of a Known Map with TurtleBot]] or return to [[Robots/TurtleBot|TurtleBot main page|&distro=indigo]].

## AUTOGENERATED DO NOT DELETE 
## TutorialCategory
## FILL IN THE STACK TUTORIAL CATEGORY HERE