I use a SICK laser scanner and use the default params for gmapping with very good results. I get the best results, however, when I drive around and turn slowly. It can take quite some time (> 45 minutes) to map a large space (> 2000 sq ft) with lots of pathways.
Now, slowly can mean different things for different people (or robots), but roughly it takes a few minutes / 100 sq ft. It also helps to go over problem areas a couple of times.
You may find that the first time you went over an area it doesn't look that great but after the second time it gets adjusted and looks better.
As for finding the right parameters for your robot, this can be more of an art than a science at times. However, if you record your laser scans in a bag file then run gmapping you'll be able to properly tune your system much more systematically and efficiently (by changing the params on the same data until you get optimal results).
In the book Programming Robots with ROS (pg 146), it is suggested to try playing with the following params first:
/slam_gmapping/agularUpdate to 0.1
/slam_gmapping/linearUpdate to 0.1
/slam_gmapping/lskip to 10
/slam_gmapping/xmax to 10
/slam_gmapping/xmin to -10
/slam_gmapping/ymax to 10
/slam_gmapping/ymin to -10
For more parameters and further explanation of the parameters that I listed, check out gmapping on the wiki.
In the video RViz is being used to display the map that gmapping is publishing to the
map topic with
map set as the fixed frame. If your map is moving around the robot then you probably have the fixed frame set to
base_link (or equivalent for your robot).
Originally posted by jayess with karma: 6155 on 2017-08-21
This answer was ACCEPTED on the original site
Post score: 3
Comment by gvdhoorn on 2017-08-22:
It might also be worthwhile to look into other mapping components, such as Google Cartographer (in 2D mode). That's not an answer to "how do I improve my gmapping", but
gmapping is quite old already, so it might pay to look at more recent developments.
Comment by Ryan_F on 2017-08-25:
Thank you this turned out to be perfect advice! The speed at which i was operating the robot was a large factor in the mapping error. I will look into newer mapping components as well.
Comment by jayess on 2017-08-25:
Great. Glad it helped.
Comment by aarontan on 2018-05-20:
Could you please elaborate on what you mean by "if you record your laser scans in a bag file then run gmapping you'll be able to properly tune your system much more systematically and efficiently (by changing the params on the same data until you get optimal results)
Comment by jayess on 2018-05-20:
If you use live data to tune your system then you'll get different results each time, even with the same parameters. If you use the same data, then different results are from the parameters being changed and not the different data.