Rosanswers logo


I am using gmapping in ros indigo for the first time (using Hokuyo URG-04LX-UG01 laser scanner and wheel encoders), but I am having problems setting the map size. I am trying to create a 10x10m map with a resolution of 0.05m as an initial test run. I run the gmapping node using this node description in the launch file:

<node pkg = "gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
    <param name="map_update_interval" value="2.0"/>
    <param name="maxUrange" value="5.0/>
    <param name="xmin" value="-5.0"/>
    <param name="ymin" value="-5.0/>
    <param name="xmax" value="5.0"/>
    <param name="ymax" value="5.0/>
    <param name="delta" value="0.05"/>
    <param name="maxRange" value="6.0"/>

When the gmapping node launches, at first the parameters seem to initialise correctly.

/rosdistro: indigo
/rosversion: 1.11.10
/slam_gmapping/delta: 0.05
/slam_gmapping/map_update_interval: 2.0
/slam_gmapping/maxRange: 6.0
/slam_gmapping/maxUrange: 5.0
/slam_gmapping/xmax: 5.0
/slam_gmapping/xmin: -5.0
/slam_gmapping/ymax: 5.0
/slam_gmapping/ymin: -5.0

/slam_gmapping (gmapping/slam_gmapping)

However, when I check the map metadata using rostopic echo, I get a map of size 5120x14592. The resolution is correct. I have noticed that each time I launch the gmapping node, the size of the map changes but it is never 10x10 as I intended. The same size problems are reflected when I view the map in rviz.

secs: 0
nsecs: 0
resolution: 0.0500000007451
width: 5120
height: 14592
x: -5.0
y: -5.0
z: 0.0
x: 0.0
y: 0.0
z: 0.0
w: 1.0

I have seen this issue posted on ros forums before, however I believe I am setting up the launch file as advised and it still doesn't work.

link: http://answers.ros.org/question/112336/how-can-i-change-the-map-size-and-the-origin/

link: http://answers.ros.org/question/56114/how-to-change-width-of-the-map-generated-by-gmapping/

link: http://answers.ros.org/question/30038/gmapping-output-very-large-4000x4000/

Any help would be appreciated. Thanks.

Originally posted by steph_v on ROS Answers with karma: 3 on 2015-09-14

Post score: 0


1 Answer 1


Rosanswers logo

The xmin, xmax, ymin and ymax parameters set the initial map size; not the final map size. If your sensor sees past the initial map bounds during the map-building process, gmapping will expand the map bounds to include the new data.

How large is the area you're trying to map?

Originally posted by ahendrix with karma: 47576 on 2015-09-14

This answer was ACCEPTED on the original site

Post score: 0

Original comments

Comment by steph_v on 2015-09-14:
Thanks ahendrix. The map is being used for short range path planning for a wheelchair. There is no limitation on where the wheelchair can travel so the total map area is potentially infinite, but I only want to keep/use map information in a ~5m radius around the chair.

Comment by ahendrix on 2015-09-14:
gmapping keeps an aggregate of the entire area that it has seen, for the entire time that it has been running, and it's generally intended for large-scale navigation. I don't think it's appropriate for your application.

Comment by ahendrix on 2015-09-14:
You may want to investigate a combination of the laser_scan_matcher and costmap_2d packages, or you may want to see if the hector project has something applicable.

Comment by steph_v on 2015-09-14:
Thanks for that. I'll have a look into those.

Comment by rezenders on 2020-12-03:
If it expands the initial map, does it have any impact?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.