mirror of https://github.com/ArduPilot/ardupilot
AP_Rangefinder: fix (very) out-of-range lidar causing float inf
This commit is contained in:
parent
9feccd6671
commit
12f32707b3
|
@ -35,7 +35,7 @@ void AP_RangeFinder_SITL::update(void)
|
||||||
const float dist = AP::sitl()->get_rangefinder(_instance);
|
const float dist = AP::sitl()->get_rangefinder(_instance);
|
||||||
|
|
||||||
// nan distance means nothing is connected
|
// nan distance means nothing is connected
|
||||||
if (isnan(dist)) {
|
if (isnan(dist) || isinf(dist)) {
|
||||||
state.status = RangeFinder::Status::NoData;
|
state.status = RangeFinder::Status::NoData;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue