added ground effect reporting to land detector

Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
Roman
2019-03-21 10:07:12 +01:00
committed by Roman Bapst
parent 14ef009aab
commit ecc8a696d0
6 changed files with 33 additions and 6 deletions
@@ -125,6 +125,8 @@ void LandDetector::_cycle()
const bool ground_contactDetected = (_state == LandDetectionState::GROUND_CONTACT);
const float alt_max = _get_max_altitude() > 0.0f ? _get_max_altitude() : INFINITY;
const bool in_ground_effect = _ground_effect_hysteresis.get_state();
const hrt_abstime now = hrt_absolute_time();
// publish at 1 Hz, very first time, or when the result has changed
@@ -134,6 +136,7 @@ void LandDetector::_cycle()
(_landDetected.freefall != freefallDetected) ||
(_landDetected.maybe_landed != maybe_landedDetected) ||
(_landDetected.ground_contact != ground_contactDetected) ||
(_landDetected.in_ground_effect != in_ground_effect) ||
(fabsf(_landDetected.alt_max - alt_max) > FLT_EPSILON)) {
if (!landDetected && _landDetected.landed) {
@@ -147,6 +150,7 @@ void LandDetector::_cycle()
_landDetected.maybe_landed = maybe_landedDetected;
_landDetected.ground_contact = ground_contactDetected;
_landDetected.alt_max = alt_max;
_landDetected.in_ground_effect = in_ground_effect;
int instance;
orb_publish_auto(ORB_ID(vehicle_land_detected), &_landDetectedPub, &_landDetected,
@@ -207,6 +211,7 @@ void LandDetector::_update_state()
_landed_hysteresis.set_state_and_update(_get_landed_state());
_maybe_landed_hysteresis.set_state_and_update(_get_maybe_landed_state());
_ground_contact_hysteresis.set_state_and_update(_get_ground_contact_state());
_ground_effect_hysteresis.set_state_and_update(_get_ground_effect_state());
if (_freefall_hysteresis.get_state()) {
_state = LandDetectionState::FREEFALL;