MulticopterLandDetector: Make land detection time configurable

The tree stages used arbitrary 350, 250 300ms totally 900ms
So this changes it to each stage to a third of the parameter.
Default it is 1 second -> 333ms per stage.
This commit is contained in:
Matthias Grob
2021-05-04 16:43:33 +02:00
parent 269ce07cb5
commit 2e292abfff
7 changed files with 26 additions and 27 deletions
+6 -8
View File
@@ -100,16 +100,14 @@ void LandDetector::Run()
// 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;
}
// Increase land detection time if not close to ground
if (_dist_bottom_is_observable && !_vehicle_local_position.dist_bottom_valid) {
_set_hysteresis_factor(3);
} 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;
}
_set_hysteresis_factor(1);
}
const hrt_abstime now_us = hrt_absolute_time();