From 12f32707b3dfe2f611a413e3c6ad6c2530aec4c1 Mon Sep 17 00:00:00 2001 From: Tom Pittenger Date: Wed, 13 Mar 2024 10:40:14 -0700 Subject: [PATCH] AP_Rangefinder: fix (very) out-of-range lidar causing float inf --- libraries/AP_RangeFinder/AP_RangeFinder_SITL.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AP_RangeFinder/AP_RangeFinder_SITL.cpp b/libraries/AP_RangeFinder/AP_RangeFinder_SITL.cpp index 2feac018be..a4e5f30493 100644 --- a/libraries/AP_RangeFinder/AP_RangeFinder_SITL.cpp +++ b/libraries/AP_RangeFinder/AP_RangeFinder_SITL.cpp @@ -35,7 +35,7 @@ void AP_RangeFinder_SITL::update(void) const float dist = AP::sitl()->get_rangefinder(_instance); // nan distance means nothing is connected - if (isnan(dist)) { + if (isnan(dist) || isinf(dist)) { state.status = RangeFinder::Status::NoData; return; }