Skip to content

Commit

Permalink
fix the use of out of range reading to be consistend with ObstacleDis…
Browse files Browse the repository at this point in the history
…tance msg
  • Loading branch information
Claudio-Chies committed Nov 12, 2024
1 parent 70b36f2 commit 6be5dd0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/collision_prevention/CollisionPrevention.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ using namespace matrix;

namespace
{
static constexpr int INTERNAL_MAP_INCREMENT_DEG = 10; //cannot be lower than 5 degrees, should divide 360 evenly
static constexpr int INTERNAL_MAP_INCREMENT_DEG = 5; //cannot be lower than 5 degrees, should divide 360 evenly
static constexpr int INTERNAL_MAP_USED_BINS = 360 / INTERNAL_MAP_INCREMENT_DEG;

static float wrap_360(float f)
Expand Down Expand Up @@ -313,7 +313,7 @@ CollisionPrevention::_addDistanceSensorData(distance_sensor_s &distance_sensor,

// negative values indicate out of range but valid measurements.
if (fabsf(distance_sensor.current_distance - -1.f) < FLT_EPSILON && distance_sensor.signal_quality == 0) {
distance_reading = distance_sensor.max_distance;
distance_reading = distance_sensor.max_distance + 1;
}

// discard values below min range
Expand Down

0 comments on commit 6be5dd0

Please sign in to comment.