|It is appreciated that problems/questions regarding this tutorial are asked on answers.ros.org. Don't forget to include in your question the link to this page, versions of your OS & ROS, and also add appropriate tags.|
SLAM Map Building with TurtleBotDescription: How to generate a map using gmapping
Tutorial Level: BEGINNER
Next Tutorial: Autonomous Navigation of a Known Map with TurtleBot
This assumes that you have a TurtleBot which has already been brought up in the turtlebot bringup tutorials. 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.
If you are using a Create base, then performance will be greatly enhanced by accurate calibration, refer to the TurtleBot Odometry and Gyro Calibration tutorial. Note that the Kobuki has a factory calibrated gyro inside and shouldn't need extra calibration.
Launch the gmapping app
On the TurtleBot
- Bring up the robot
roslaunch turtlebot_bringup minimal.launch
- Run the gmapping demo app
roslaunch turtlebot_navigation gmapping_demo.launch
On your Workstation
- Launch rviz:
# Pre-Groovy rosrun rviz rviz -d `rospack find turtlebot_navigation`/nav_rviz.vcg # Groovy or later roslaunch turtlebot_rviz_launchers view_navigation.launch
On the TurtleBot
Drive the robot around by either:
Using telop (keyboard, joystick, or other) from Teleoperation Tutorials
If you are having troubles making a map check out this question.
- Save the map to file:
rosrun map_server map_saver -f /tmp/my_map
Note: Do not close the gmapping launch until after saving the map.
After it says "done" press Ctrl-C #4843
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.