Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uavcannode rangefinder: add tolerance to reading too close check #24415

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/drivers/uavcannode/Publishers/RangeSensorMeasurement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ class RangeSensorMeasurement :
}

// reading_type
const float tolerance = 1e-6;

if (dist.current_distance > dist.max_distance) {
range_sensor.reading_type = uavcan::equipment::range_sensor::Measurement::READING_TYPE_TOO_FAR;

} else if (dist.current_distance < dist.min_distance) {
} else if (dist.current_distance < dist.min_distance - tolerance) {
range_sensor.reading_type = uavcan::equipment::range_sensor::Measurement::READING_TYPE_TOO_CLOSE;

} else if (dist.signal_quality != 0) {
Expand Down
Loading