ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to use GMapping

asked 2013-06-18 15:54:45 -0600

Robocop87 gravatar image

updated 2016-10-24 09:03:32 -0600

ngrennan gravatar image

Hey everyone,

I'm honestly surprised I have not been able to find a similar question anywhere. I am just getting started with ROS and I would like to start using gmapping for SLAM.

The robot I am using has a kinect and publishes odometry data through a topic called /Odometry. I used depthimage_to_laserscan to convert the kinects native output to the laser scan that gmapping wants. I confirmed that this works using rviz.

My problem comes when it is time to use gmapping. I don't really know what I need to do or provide to make gmapping work. From reading the documentation (And I can't say I understand too much of it) it seems like this is all I need to do:

rosrun gmapping slam_gmapping scan:=scan

However when I run this nothing happens. And I can't say I would expect otherwise, because I have not told gmapping where it can find my odometry. The documentation also mentioned something about required transforms, but I don't have any, know how to make any, or how to provide them when I have them.

What I need, and I'm sure other people need as well, is some kind of beginners guide to using gmapping. If any of you guys can help me with my specific problem, that would be great, or if you could direct me to a tutorial I overlooked (not the logged data one) that would be even better.

More on my actual problem: When I run gmapping using the command I wrote above, rviz complains that there is no transform that links my laser scanner to the map and the terminal window where I ran gmapping just replays the message "Dropped 100% of messages so far"

Thanks in advance for your help!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-06-18 16:19:36 -0600

weiin gravatar image

To really understand how to use ROS for higher level functions, it is best to go through ALL the links in

I believe you have understood what gmapping requires correctly. What you are missing now is the tf, so the logical next step is to look into the tf tutorials (which is under "Tutorials for other libraries" in the main tutorials page). After that, you might want to further understand how to use the navigation stack.

A "shortcut" for learning how to use ROS for robots is to look for robots with good documentation, like turtlebot. Then go into the launch files to see how things are done.

edit flag offensive delete link more


Thanks for your answer weiin! I agree I need to read up on my transforms, which I am currently doing. I will also dig through the turtlebot code to see how they went about doing it, but I am still worried about the odometry data. I didn't see any way to pass that data...cheers to exploring!

Robocop87 gravatar image Robocop87  ( 2013-06-18 16:37:10 -0600 )edit

Odometry data is passed through the transform odom->base_link. That means only the pose information is passed. See also

weiin gravatar image weiin  ( 2013-06-18 19:57:06 -0600 )edit

answered 2019-02-13 08:48:02 -0600

Mohamed gravatar image


Here is a complete tutorial on using the ros navigation stack. It has a tutorial one gmapping.

I thought of sharing it here as it might be useful.

edit flag offensive delete link more


This is not an answer, but rather a comment as it does not provide an answer but is only a link. And, honestly, it comes of rather spammy because it's a link to your YouTube channel and you did the same thing to two other questions at the same time (#q296575 & #q274332).

jayess gravatar image jayess  ( 2019-02-13 18:08:17 -0600 )edit

The tutorials are not shared randomly (spammy) as you mentioned. They are shared where they are only relevant. Spammy means that they were shared randomly everywhere which is not the case. And there is nothing wrong with sharing the relevant answer which happens to be a tutorial on my channel.

Mohamed gravatar image Mohamed  ( 2019-02-13 20:54:43 -0600 )edit

Sorry, if this came off as harsh or insulting to you because it wasn't meant to be. What I meant was that it's more of an advertisement to your YouTube channel than an answer. Link-only answers are always discouraged.

spammy != random
jayess gravatar image jayess  ( 2019-02-13 21:02:23 -0600 )edit

Hi. I read your answer and I watch your videos. Thanks for. However I need to know is it work with real robot? Or When we work with the real robot, which parts has to be changed ?

bfdmetu gravatar image bfdmetu  ( 2020-07-10 09:15:02 -0600 )edit

Question Tools


Asked: 2013-06-18 15:54:45 -0600

Seen: 7,552 times

Last updated: Feb 13 '19