SLAM using gmapping with TurtleBot robot and Gazbo

In this tutorial, we do some SLAM with TurtleBot robot.

1.Before anything, you have to install all packages for gazebo and gmapping and TurtleBot:

2.Launch gazebo and TurtleBot

3. Call the gmapper to read laser scan and build the map:

Only for indigo:

if you got and error, you need to do some hacky stuff and following changes some

comment this line:

and add the following line:

so at the end, your file should look like this:

4.Call the rviz so you can see the map:

5.Move your robot via keyboard or joystick controller:




To make your joystick controller works, you have to hold the “axis_deadman” button. This has been specified in the corresponding launch file. For instance for xbox360 controller edit

you can see, in this file, it has been assigned to 4


To see which button on your controller has been assigned to “axis_deadman”, run

and press all buttons one by one until you see which button is 4″

now you have to keep pressing that button for sending a command from your controller. You can watch the state of each button by listening to the /joy topic:

Now start adding objects into gazebo scene and start exploring the environment, you should see the map:


Leave a Reply

1 Comment threads
0 Thread replies
Most reacted comment
Hottest comment thread
0 Comment authors
Making occupancy grid map in ROS from gazebo with Octomap | Tutorials on Robotics for ROS developers Recent comment authors

This site uses Akismet to reduce spam. Learn how your comment data is processed.

newest oldest most voted
Notify of

[…] to learn how to move the robot with your joystick controller please follow my other tutorial on that here […]