From 3f5ffd6f1cc41d22872c40078f3afbacdaec6b62 Mon Sep 17 00:00:00 2001 From: Reinhard Biegel <reinhard.biegel@in-tech.com> Date: Fri, 19 Aug 2022 15:29:28 +0200 Subject: [PATCH] fix(World_OSI): Extend SensorView filter area to include all touching objects The method ApplySectorFilter() is used for pre-filtering an osi3::SensorView. It adds a margin of half a objects' diagonal to the sensor range to also include objects which are just touching the cone, but have their bounding box center outside the cone. As it turns out, using the bounding box center as reference was wrong. Instead, the osi3::MovingObject reference point has to be taken into account (center of rear axle). Thus, the margin is increased to the full diagnal of the object. This covers all cases where the rear axle center is inside of the objects' bounding box. --- sim/src/core/opSimulation/modules/World_OSI/WorldData.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sim/src/core/opSimulation/modules/World_OSI/WorldData.h b/sim/src/core/opSimulation/modules/World_OSI/WorldData.h index de935fd19..90eeb2a0d 100644 --- a/sim/src/core/opSimulation/modules/World_OSI/WorldData.h +++ b/sim/src/core/opSimulation/modules/World_OSI/WorldData.h @@ -641,7 +641,7 @@ public: const auto dimension = object->GetDimension(); const auto diagonal = openpass::hypot(dimension.width, dimension.length); - if (distance > radius + 0.5 * diagonal) + if (distance > radius + diagonal) { continue; } @@ -654,7 +654,7 @@ public: { if (direction < rightBoundaryAngle && direction > leftBoundaryAngle) { - if (!IsCloseToSectorBoundaries(distance, direction, leftBoundaryAngle, rightBoundaryAngle, 0.5 * diagonal)) + if (!IsCloseToSectorBoundaries(distance, direction, leftBoundaryAngle, rightBoundaryAngle, diagonal)) { continue; } @@ -662,7 +662,7 @@ public: } else if (direction < rightBoundaryAngle || direction > leftBoundaryAngle) { - if (!IsCloseToSectorBoundaries(distance, direction, leftBoundaryAngle, rightBoundaryAngle, 0.5 * diagonal)) + if (!IsCloseToSectorBoundaries(distance, direction, leftBoundaryAngle, rightBoundaryAngle, diagonal)) { continue; } -- GitLab