mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 13:43:34 +08:00
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:
@@ -80,9 +80,6 @@ MulticopterLandDetector::MulticopterLandDetector()
|
||||
_paramHandle.minThrottle = param_find("MPC_THR_MIN");
|
||||
_paramHandle.useHoverThrustEstimate = param_find("MPC_USE_HTE");
|
||||
_paramHandle.hoverThrottle = param_find("MPC_THR_HOVER");
|
||||
|
||||
// Use Trigger time when transitioning from in-air (false) to landed (true) / ground contact (true).
|
||||
_set_hysteresis_factor(1);
|
||||
}
|
||||
|
||||
void MulticopterLandDetector::_update_topics()
|
||||
@@ -370,9 +367,9 @@ bool MulticopterLandDetector::_is_close_to_ground()
|
||||
|
||||
void MulticopterLandDetector::_set_hysteresis_factor(const int factor)
|
||||
{
|
||||
_ground_contact_hysteresis.set_hysteresis_time_from(false, GROUND_CONTACT_TRIGGER_TIME_US * factor);
|
||||
_landed_hysteresis.set_hysteresis_time_from(false, LAND_DETECTOR_TRIGGER_TIME_US * factor);
|
||||
_maybe_landed_hysteresis.set_hysteresis_time_from(false, MAYBE_LAND_DETECTOR_TRIGGER_TIME_US * factor);
|
||||
_ground_contact_hysteresis.set_hysteresis_time_from(false, _param_lndmc_trig_time.get() * 1_s / 3 * factor);
|
||||
_landed_hysteresis.set_hysteresis_time_from(false, _param_lndmc_trig_time.get() * 1_s / 3 * factor);
|
||||
_maybe_landed_hysteresis.set_hysteresis_time_from(false, _param_lndmc_trig_time.get() * 1_s / 3 * factor);
|
||||
_freefall_hysteresis.set_hysteresis_time_from(false, FREEFALL_TRIGGER_TIME_US);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user