Grid: don't filter max range before doing ray tracing (to ray trace empty space).

This commit is contained in:
matlabbe
2022-01-17 14:22:11 -05:00
parent 7a5c50cb0e
commit de62bbb9b7

View File

@@ -336,10 +336,11 @@ void OccupancyGrid::createLocalMap(
const Transform & t = node.sensorData().laserScanRaw().localTransform(); const Transform & t = node.sensorData().laserScanRaw().localTransform();
LaserScan scan = util3d::downsample(node.sensorData().laserScanRaw(), scanDecimation_); LaserScan scan = util3d::downsample(node.sensorData().laserScanRaw(), scanDecimation_);
#ifdef RTABMAP_OCTOMAP #ifdef RTABMAP_OCTOMAP
// clipping will be done in OctoMap // If ray tracing enabled, clipping will be done in OctoMap or in occupancy2DFromLaserScan()
float maxRange = grid3D_&&rayTracing_?0.0f:cloudMaxDepth_; float maxRange = rayTracing_?0.0f:cloudMaxDepth_;
#else #else
float maxRange = cloudMaxDepth_; // If ray tracing enabled, clipping will be done in occupancy2DFromLaserScan()
float maxRange = !grid3d_ && rayTracing_?0.0f:cloudMaxDepth_;
#endif #endif
if(cloudMinDepth_ > 0.0f || maxRange > 0.0f) if(cloudMinDepth_ > 0.0f || maxRange > 0.0f)
{ {
@@ -390,10 +391,11 @@ void OccupancyGrid::createLocalMap(
node.sensorData(), node.sensorData(),
cloudDecimation_, cloudDecimation_,
#ifdef RTABMAP_OCTOMAP #ifdef RTABMAP_OCTOMAP
// clipping will be done in OctoMap // If ray tracing enabled, clipping will be done in OctoMap or in occupancy2DFromLaserScan()
grid3D_&&rayTracing_?0.0f:cloudMaxDepth_, rayTracing_?0.0f:cloudMaxDepth_,
#else #else
cloudMaxDepth_, // If ray tracing enabled, clipping will be done in occupancy2DFromLaserScan()
!grid3D_&&rayTracing_?0.0f:cloudMaxDepth_,
#endif #endif
cloudMinDepth_, cloudMinDepth_,
indices.get(), indices.get(),