land_detector: robustify land detection by using distance to ground info

- if distance to the ground is available then hysteresis times will be increased
by a factor of 3 if vehicle is higher than 1m above ground

Signed-off-by: RomanBapst <bapstroman@gmail.com>
This commit is contained in:
RomanBapst
2021-04-27 08:19:19 +02:00
committed by Beat Küng
parent f6a34e1e80
commit 171c26373b
7 changed files with 55 additions and 5 deletions
@@ -96,6 +96,22 @@ void LandDetector::Run()
_update_topics();
if (!_dist_bottom_is_observable) {
// we consider the distance to the ground observable if the system is using a range sensor
_dist_bottom_is_observable = _vehicle_local_position.dist_bottom_sensor_bitfield &
vehicle_local_position_s::DIST_BOTTOM_SENSOR_RANGE;
} else {
if (!_high_hysteresis_active && !_vehicle_local_position.dist_bottom_valid) {
_set_hysteresis_factor(3);
_high_hysteresis_active = true;
} else if (_high_hysteresis_active && _vehicle_local_position.dist_bottom_valid) {
_set_hysteresis_factor(1);
_high_hysteresis_active = false;
}
}
const hrt_abstime now_us = hrt_absolute_time();
_freefall_hysteresis.set_state_and_update(_get_freefall_state(), now_us);