use distance to ground if on ground an distance is out of range

This commit is contained in:
ChristophTobler
2017-10-13 08:52:57 +02:00
committed by Lorenz Meier
parent 787931f04f
commit 40b8d8bd48

View File

@@ -578,7 +578,13 @@ void Ekf2::run()
// check if distance sensor is within working boundaries
if (range_finder.min_distance >= range_finder.current_distance ||
range_finder.max_distance <= range_finder.current_distance) {
range_finder_updated = false;
// use rng_gnd_clearance if on ground
if (_ekf.get_in_air_status()) {
range_finder_updated = false;
} else {
range_finder.current_distance = _params->rng_gnd_clearance;
}
}
}