Rosanswers logo

Hi all,

I am simulating gmapping in Gazebo with my Turtlebot. I have attached an Hokuyo laser on my (virtual) turtlebot and want to use this for gmapping instead of the virtual kinect laser.

The problem I have is that the virtual Hokuyo returns measurements at its maximum range. E.g. it would return a circle of measurment points of it would be placed in an empty world. Gmapping uses these measurements as if obstacles are detected there. This completely messes up the scan matching process, as it tries to match everything with the non-existent circular wall.

If I use the Hokuyo on my real robot, it only returns true measurements, i.e. if it cannot detect something at a certain angle, it will not return any data point (as if the distance seems infinite).

How should I adapt my virtual Hokuyo to not return data points when it has not detected anything at its max range?

Or alternatively, is there any way to adapt gmapping to cope with such measurements (which less elegant I think, as the difference between simulation and real experiments persists in other fields of measurement usage)?

Please see the screenshots attached: rviz clearly shows the 'circular non-existent' walls. I have only turned around in circles for this screenshot. If I would also move around with the robot, the scan-matching trouble becomes clear. I also have these issues (but to a lesser extend) when using it in a gazebo indoor building world (willowgarage world).

Gazebo world (with laser visualized):

image description

rviz result:

image description

Any help would be very much appreciated.

Regards, Koen


A slight addition to my comment on dornheges answer: the maxRange can probably better be omitted, as skipped/missing measurements lead to the conclusion that certain space is empty, although the robot cannot actually see this. See for example the explored space outside of the room in the screenshot... Clearly, the robot couldnt know this: it is based on the assumption that no measurment equals free space.

Does anybody know a nice way to still use this 'space is free if nothing is measured' feature, without running into this glitch (i.e. make it robust against skipped/missing/erroneous measurements)?

image description

Originally posted by koenlek on ROS Answers with karma: 432 on 2014-03-11

Post score: 0


1 Answer 1


Rosanswers logo

Your virtual Hokuyo seems misconfigured. The real Hokuyo will return a max-range measurement if it has not measured something. Ranges are never left out. That would screw up the whole scan.

Make sure that the maximum range field in the LaserScan message for the virtual Hokuyo corresponds to the maximum range that the sensor sends for max ranges. If that is the case gmapping should not map those ranges (if it does that would be a bug).

There is a parameter maxUrange that you could use in gmapping. However, that is meant for other purposes and would fix the problem at the wrong place.

Originally posted by dornhege with karma: 31395 on 2014-03-11

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by koenlek on 2014-03-12:
Thanks, that solved it! I did have to set maxUrange however. I set the gazebo sensor to max 5.6m, maxUrange had to be slightly smaller (due to noise, otherwise you still get some black dots on the circle, I set it to 5.5m). maxRange is also useful: set it to 5.6, marking visible free space as free


Your Answer

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