ros-perception / laser_filters

Assorted filters designed to operate on 2D planar laser scanners, which use the sensor_msgs/LaserScan type.
BSD 3-Clause "New" or "Revised" License
166 stars 204 forks source link

checking if histogram entry is below 0 #10

Closed mateiciocarlie closed 11 years ago

mateiciocarlie commented 11 years ago

If laser scan came in with bogus intensity values (which it does in simulation) this would cause the histogram creation to segfault if trying to increment with an index below 0.

This fixes the segfault, but one could argue it could be fixed differently. Like this, bogus values show up as zeros in the histogram - maybe they should be ignored instead? The histogram seems to be used just for debug purposes anyway.

Ideally, we'd also fix sim so that it does not return bogus intensities.

vrabaud commented 11 years ago

That code is indeed terrible ... I fixed your crash in 2da0e525b1bd2c58a5269901eb57325fece1cd9e

Please let me know if that works.

I need to check the other pull requests before releasing that.