Skip to content

Commit

Permalink
AP_Rangefinder: fix (very) out-of-range lidar causing float inf
Browse files Browse the repository at this point in the history
  • Loading branch information
magicrub committed Mar 13, 2024
1 parent 9feccd6 commit 12f3270
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libraries/AP_RangeFinder/AP_RangeFinder_SITL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 12f3270

Please sign in to comment.