land_detector: fix sanity condition that we have ground contact when we are landed to include the hysteresis flag

because the condition was looking for the instantaneous flag and during the hysteresis time the state did not change anymore
This commit is contained in:
Matthias Grob
2017-04-19 12:03:03 +02:00
parent caecdbd60b
commit d1b270d5b2
+4 -8
View File
@@ -198,15 +198,11 @@ void LandDetector::_check_params(const bool force)
void LandDetector::_update_state()
{
/* ground contact and landed can be true simultaneously but only one state can be true at a particular time
/* 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 */
bool freefall = _get_freefall_state();
bool landed = _get_landed_state();
bool groundContact = (landed || _get_ground_contact_state());
_freefall_hysteresis.set_state_and_update(freefall);
_landed_hysteresis.set_state_and_update(landed);
_ground_contact_hysteresis.set_state_and_update(groundContact);
_freefall_hysteresis.set_state_and_update(_get_freefall_state());
_landed_hysteresis.set_state_and_update(_get_landed_state());
_ground_contact_hysteresis.set_state_and_update(_landed_hysteresis.get_state() || _get_ground_contact_state());
if (_freefall_hysteresis.get_state()) {
_state = LandDetectionState::FREEFALL;