introlab / rtabmap

RTAB-Map library and standalone application
https://introlab.github.io/rtabmap
Other
2.83k stars 787 forks source link

Using `Grid/MaxObstacleHeight` with OctoMap is not working as expected with ray tracing #1350

Open matlabbe opened 1 month ago

matlabbe commented 1 month ago

Refer to this discussion: https://github.com/introlab/rtabmap_ros/issues/1194#issuecomment-2395204102

The issue is that points over the obstacle threshold won't be used for ray tracing, so some dynamic obstacles even smaller than max obstacle height may still remain in the OctoMap after it is gone. We should handle Grid/MinGroundHeight and Grid/MaxObstacleHeight differently if both Grid/3D and Grid/RayTracing are enabled. We should not filter the cloud like this: https://github.com/introlab/rtabmap/blob/538bc681d4a382ad06333ee1e17c6ac120e82c80/corelib/include/rtabmap/core/impl/LocalMapMaker.hpp#L111-L117 Instead, forward Grid/MinGroundHeight and Grid/MaxObstacleHeight to OctoMap and treat them like Grid/RangeMax parameter, so that ray tracing can clear obstacles for which the background is seen outside the obstacle volume. https://github.com/introlab/rtabmap/blob/538bc681d4a382ad06333ee1e17c6ac120e82c80/corelib/src/global_map/OctoMap.cpp#L530-L541