From 8d0402f274f5624c1923829b6293f985003abbad Mon Sep 17 00:00:00 2001 From: Nicolas de Palezieux Date: Fri, 17 Jan 2020 18:54:53 +0100 Subject: [PATCH] land detector: fix ordering of hysteresis updates to ensure we report LANDED only if also MAYBE LANDED and GROUND CONTACT, and MAYBE LANDED only if also GROUND CONTACT --- src/modules/land_detector/LandDetector.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/modules/land_detector/LandDetector.cpp b/src/modules/land_detector/LandDetector.cpp index 0d2da36692..662ec226d3 100644 --- a/src/modules/land_detector/LandDetector.cpp +++ b/src/modules/land_detector/LandDetector.cpp @@ -145,13 +145,11 @@ void LandDetector::_update_params() void LandDetector::_update_state() { - /* when we are landed we also have ground contact for sure but only one output state can be true at a particular time - * with higher priority for landed */ const hrt_abstime now_us = hrt_absolute_time(); _freefall_hysteresis.set_state_and_update(_get_freefall_state(), now_us); - _landed_hysteresis.set_state_and_update(_get_landed_state(), now_us); - _maybe_landed_hysteresis.set_state_and_update(_get_maybe_landed_state(), now_us); _ground_contact_hysteresis.set_state_and_update(_get_ground_contact_state(), now_us); + _maybe_landed_hysteresis.set_state_and_update(_get_maybe_landed_state(), now_us); + _landed_hysteresis.set_state_and_update(_get_landed_state(), now_us); _ground_effect_hysteresis.set_state_and_update(_get_ground_effect_state(), now_us); }