mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 02:16:53 +08:00
landdetector: consider 8 second maybe_landed case only if no rotation present
This commit is contained in:
committed by
Lorenz Meier
parent
ec04577e3a
commit
69ecfef8a4
@@ -263,15 +263,6 @@ bool MulticopterLandDetector::_get_maybe_landed_state()
|
|||||||
_min_trust_start = 0;
|
_min_trust_start = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return status based on armed state and throttle if no position lock is available.
|
|
||||||
if (!_has_altitude_lock()) {
|
|
||||||
// The system has minimum trust set (manual or in failsafe)
|
|
||||||
// if this persists for 8 seconds AND the drone is not
|
|
||||||
// falling consider it to be landed. This should even sustain
|
|
||||||
// quite acrobatic flight.
|
|
||||||
return (_min_trust_start > 0) && (hrt_elapsed_time(&_min_trust_start) > 8000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
float armThresholdFactor = 1.0f;
|
float armThresholdFactor = 1.0f;
|
||||||
|
|
||||||
// Widen acceptance thresholds for landed state right after arming
|
// Widen acceptance thresholds for landed state right after arming
|
||||||
@@ -287,6 +278,22 @@ bool MulticopterLandDetector::_get_maybe_landed_state()
|
|||||||
(fabsf(_vehicleAttitude.pitchspeed) > maxRotationScaled) ||
|
(fabsf(_vehicleAttitude.pitchspeed) > maxRotationScaled) ||
|
||||||
(fabsf(_vehicleAttitude.yawspeed) > maxRotationScaled);
|
(fabsf(_vehicleAttitude.yawspeed) > maxRotationScaled);
|
||||||
|
|
||||||
|
// Return status based on armed state and throttle if no position lock is available.
|
||||||
|
if (!_has_altitude_lock() && !rotating) {
|
||||||
|
// The system has minimum trust set (manual or in failsafe)
|
||||||
|
// if this persists for 8 seconds AND the drone is not
|
||||||
|
// falling consider it to be landed. This should even sustain
|
||||||
|
// quite acrobatic flight.
|
||||||
|
if ((_min_trust_start > 0) &&
|
||||||
|
(hrt_elapsed_time(&_min_trust_start) > 8000000)) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_ground_contact_hysteresis.get_state() && _has_minimal_thrust() && !rotating) {
|
if (_ground_contact_hysteresis.get_state() && _has_minimal_thrust() && !rotating) {
|
||||||
// Ground contact, no thrust and no movement -> landed
|
// Ground contact, no thrust and no movement -> landed
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user