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

Instant incorrect laser distance reading in simulation

asked 2020-12-07 04:52:57 -0500

aircraftpilot5 gravatar image

updated 2020-12-08 03:10:39 -0500

mgruhler gravatar image

I am working o an obstacle avoidance algorithm. I am using Hokuyo laser sensor to detect obtacles. Scan rate is 50Hz and resolution is 0.01. My obstacle avoidance algorithm would be active when the minimum distance to an obstacle is closer than 0.5m. However, ranges have instantly low values. So obstacle avoidance is always active. How can i prevent these misreadings?

edit retag flag offensive close merge delete



It may help to plot and describe the data a bit. Is there anything the lidar may actually be detecting, like dirt or smudges? What kind of low values--all/some zeros? Is it noisy, or a dead spot? The LaserScanRangeFilter from the laser_filters package may be what you're after, but it's hard to say without knowing what the actual issue is.

tryan gravatar image tryan  ( 2020-12-07 11:52:23 -0500 )edit

I am working in the Gazebo environment. Nothing is seeming at this points. I have plotted the range data, for example one of them includes 0.2m among the 100 samples near 16m ranges.

aircraftpilot5 gravatar image aircraftpilot5  ( 2020-12-08 01:44:30 -0500 )edit

The first thing I would check in simulation is that you don't have a collision element in the way. Collision elements are not visible by default, so you'll probably have to enable them. One way to do that is to right click on your robot in the Gazebo scene then View > Collisions. Also, can you post the plot of the range data here?

tryan gravatar image tryan  ( 2020-12-08 07:29:37 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-12-08 01:26:27 -0500

mgruhler gravatar image

(Quite a few assumptions in this answer, as you don't specify which laserscanner you have, but still...)

Usually, laser scanners have a minimum range at which they can produce meaningful results. This is also reflected in the sensor_msgs/LaserScans range_min property. You should definitely disregard any value below this. However, this also means that the scanners driver properly sets this value. Check the data sheet and double check.

Also, laser scanners have different behaviors in error cases or max-range readings. Some scanners provide proper max-range and/or error-codes, some scanners (and if I remember correctly some Hokuyo scanners do that), provide min-range or close-to-zero readings when they are above their max range. This often lead to strange behavior in larger environments w.r.t. costmap clearing using the Hokuyo URG-04-LX scanner. Put your scanner/robot in a "boxed environment" and check if you get proper readings when you definitely don't have any max-range or error messages (i.e. all walls should be good detectable by the scanner).

edit flag offensive delete link more


Thank you for your answer. The minimum range is set 0.08m and maximum is 30m. I've started my drone surrounded with walls on Gazebo. When i examine the range data, for example i encounter 100 samples about 16m and a 0.2m among them. I could not eliminate that.

aircraftpilot5 gravatar image aircraftpilot5  ( 2020-12-08 01:39:33 -0500 )edit

Your not working with a real scanner, but in simulation?!?

mgruhler gravatar image mgruhler  ( 2020-12-08 01:50:14 -0500 )edit

Yes, for now in simulation.

aircraftpilot5 gravatar image aircraftpilot5  ( 2020-12-08 01:59:12 -0500 )edit

Well, that is some quite relevant piece of information :-) You should have started with that... I took the liberty to retag and edit your quesiton title...

Forget all physical effects, dirt, smudges, etc...

can you share your model/code that starts the simulation? If the values at those ranges / angles are constant, you are probably hitting some part of your model (might not be visible, but used for the raytrace operation)

mgruhler gravatar image mgruhler  ( 2020-12-08 03:09:53 -0500 )edit

Question Tools

1 follower


Asked: 2020-12-07 04:52:57 -0500

Seen: 417 times

Last updated: Dec 08 '20