From 40b8d8bd4842ddadf871fd6428a7abc5f974ba8c Mon Sep 17 00:00:00 2001 From: ChristophTobler Date: Fri, 13 Oct 2017 08:52:57 +0200 Subject: [PATCH] use distance to ground if on ground an distance is out of range --- src/modules/ekf2/ekf2_main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/ekf2/ekf2_main.cpp b/src/modules/ekf2/ekf2_main.cpp index 833b0a1fe9..765c55ba93 100644 --- a/src/modules/ekf2/ekf2_main.cpp +++ b/src/modules/ekf2/ekf2_main.cpp @@ -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; + } } }