mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 09:03:34 +08:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user