Gmapping is adding extra points to my map that aren't from the laser scan.

I'm running gmapping using the sick lms1xx driver for the lidar scans and wheel encoders for odometry. I'm having a problem with gmapping adding points to the map that are outside of my walls and are not reported by the laser scanner. Please see the image in the link below for details:

I've tried adjusting almost all of the parameters and I even tried filtering the laser scan message but the points don't exist in the laser scan so there isn't really anything to filter out. Hector mapping doesn't have this problem. Any thoughts on what's going on?

------- Edit: -------------

While hector mapping creates better looking maps without this issue, gmapping creates more accurate maps due to the underlying particle filter. Therefore, I would like to use gmapping over hector.

To highlight the issue even more, here are two maps, one made with hector and one with gmapping. Gmapping is adding quite a few additional points to the map that are not included in the laser scan data.

Manually looking at the laser scan data, I can see that the min range is 0.0m and the max range is 12.17m, neither is close to my 50m laser maximum and both are well below the outlier points on the map which appear to be about 25m away from the robot. I also determined that the 0.0m points are not the problem by filtering those out.

Any further help is appreciated. Thanks.

edit retag close merge delete

Sort by » oldest newest most voted

This looks fairly normal to me. Your laser is returning a max range reading, so gmapping is clearing all the way out. This could be a valid reading because of something like a window, or a spurious reading because of something like a very reflective or nonreflective surface, or an object at a very shallow angle to the beam. Multiple views of the same area may help, but if hector mapping works better for you, then use that.

more

Thanks for the comments. I've edited my original post with more information. I don't believe that my laser is receiving a maximum range reading because I can't see it in the raw message, nor is there a point shown in RVIZ for the laser measurement at the gmapping outlier points. Any other thoughts?

( 2015-03-10 18:00:38 -0500 )edit

If it's not the laser readings, I'm not sure what could be causing this. Watching the mapping progress in rviz might give some indication.

( 2015-03-10 19:04:20 -0500 )edit

Have you tried adjusting the ~maxUrange and ~maxRange parameters, and adjusting their relative values?

From the documentation:

~maxUrange (float, default: 80.0) The maximum usable range of the laser. A beam is cropped to this value. ~maxRange (float) The maximum range of the sensor. If regions with no obstacles within the range of the sensor should appear as free space in the map, set maxUrange < maximum range of the real sensor <= maxRange.

more

I had tried adjusting those parameters. They can limit the outlier points but don't define them. If I lower my max ranges to a small value like 10, then I get no outliers. If I increase it up to 100, then the points don't extend out to 100 but remain at their normal ~25m mark.

( 2015-03-11 08:36:36 -0500 )edit

How are you filtering out the 0.0m measurements? Maybe you or gmapping is setting those points to scan.range_max + 1 as in the laser scan range filter? Can you see any other conspicuous ranges, such as NaNs, infs, or -infs in the laser scan?

more

I filtered them through a script where I replace the 0's with something else. I've tried changing them to NaNs and also to something else like 40. What I discovered is that those 0's are not corresponding to the outlier points. I saw the outliers and some additional points out at 40.

( 2015-03-11 08:18:38 -0500 )edit

I believe I have found my answer. In the sensor_msgs/LaserScan Message, there are parameters range_min and range_max. Some of my laser scan ranges were coming in under the range_min value (both 0.0 and others) and those are causing the outlier points. I don't know why this is happening, but it can be fixed either by changing the data to conform to the specified max and mins, or by changing the max and mins to conform to the data.

If anyone else in the future faces this problem, you may use the code below to filter your laser scans, note that there are two options and you can comment out the first to use the second.

more

I'm using a YD Lidar and I was getting bad results in Gmapping. It was mapping area beyond walls as free space, as if it was seeing through walls. I used LaserScanRangeFilter package and replaced the min & max values with NaN. The example yaml from LRSF package shows using "inf" but "NaN" was what I needed.

Also setting maxRange and maxURange correctly (according to actual range of lidar) was necessary.

Hope this helps.

more