Updates to raytrace clearing, edge case bugfix #25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are two basic changes here. One is a fix to an edge case bug where an observation point is very close to (0,0,0), leading to the unsigned int
number_of_steps
to be zero when input tobresenham3DIncludingCorners
.number_of_steps
is then decremented, leading to a crash. You could argue that (0,0,0) should never be included as an observation (I would agree), but it can happen in practice and is easy enough to handle here. Relevant discussion linkThe second change is an update to the scaling factor applied to the line segment from the sensor origin to the observation point (
dx
,dy
, anddz
) before callingclearVoxelLineInMap
. The existing code adjusted the scaling factor according to whether the observation point was outside the costmap boundary. The updated factor also prevents the line segment to be larger than the raytrace_range parameter. This prevents memory issues mentioned in the removed warning, since the clearing cache is guaranteed to have a width, height of at least2*raytrace_range
.Finally, a design update to cache_clearer.h corrects logic to properly clear data coming from more than one sensor, as described.