ros-perception/depthimage_to_laserscan — pull request #9 by kbogert (2014-04-22 19:44:35+00:00)
Title: Add max_range heuristics for the Kinect

This patch implements a way to convert out-of-range readings from the kinect into usable maximum-range readings. The current implementation cannot tell the difference between too close and too far readings, marking them both as NaN. This causes problems with large spaces like hallways where we have readings to the left and right but nothing in the middle. This is most apparent when running SLAM as you get wedges of unexplored region instead of it being marked empty.

**Gmapping without the heuristics in a long hallway:**
![without_heuristics](https://cloud.githubusercontent.com/assets/2602827/2769697/ec612164-ca54-11e3-8957-cfd4a2f91afa.png)

**With heuristics turned on (robot was not moved)**
![with_heuristics](https://cloud.githubusercontent.com/assets/2602827/2769696/ec6127c2-ca54-11e3-8093-53f1a77af65e.png)

This works by examining the readings to the left and right of a section of out of range readings. If these are greater than half the max range we assume that the out of range readings are due to being too far away rather than too close. A number of other heuristics are applied in an attempt to reduce false positives. This patch is not perfect but it definitely takes are lot of the pain out of mapping large spaces.

Its most apparent failure I've noticed is when it gets too close to sharp edges, it might mistake the too-close readings depending on what it can see on the other side of the edge. Still, the errors don't impact the map that much and this can be controlled by reducing the range_max setting both in this package and in gmapping.