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

This commit is contained in:
Nicolas de Palezieux 2020-01-17 18:54:53 +01:00 committed by Lorenz Meier
parent 3e90cbe686
commit 8d0402f274
1 changed files with 2 additions and 4 deletions

View File

@ -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);
}