OctoMap/octomap

ComputeUpdate doesn't free cells if BBX is used and scan point is outside BBX or outside max range

kjulian3 opened this issue · 1 comments

In the computeUpdate method of OccupancyOcTreeBase.hxx, there is an if/else for use_bbx_limit. If the BBX is not used, then the code handles the case where the "user set a maxrange and length" from origin to point p "is above" the maxrange.

However, if BBX is set, the case where the scan point is outside the BBX or beyond the maxrange is not handled. The if statement on line 224 does not have an else, unlike the if on line 190 when a BBX is not used:

As a result, if the BBX is set, points that are outside the BBX or beyond the max range are ignored. This does not seem intended, as the comment on line indicates that we should "update freespace, break as soon as bbx limit is reached".

Is there something I am missing when reading the code, or is this behavior intended? I would think that the if on line 224 warrants an "else" to handle the case where the the scan point p falls outside the BBX limits or beyond the maxrange. If so, I am happy to prepare a pull request.

IIIRC, the BBX filtering was quickly added for some specific use cases where it mostly worked fine, and the behavior you describe is simply an omission. So yes, a pull request is highly welcome!