mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 10:33:33 +08:00
clang-tidy readability-simplify-boolean-expr
This commit is contained in:
@@ -142,16 +142,10 @@ bool FixedwingLandDetector::_get_landed_state()
|
||||
_accel_horz_lp = _accel_horz_lp * 0.8f + _controlState.horz_acc_mag * 0.18f;
|
||||
|
||||
// crude land detector for fixedwing
|
||||
if (_velocity_xy_filtered < _params.maxVelocity
|
||||
&& _velocity_z_filtered < _params.maxClimbRate
|
||||
&& _airspeed_filtered < _params.maxAirSpeed
|
||||
&& _accel_horz_lp < _params.maxIntVelocity) {
|
||||
|
||||
landDetected = true;
|
||||
|
||||
} else {
|
||||
landDetected = false;
|
||||
}
|
||||
landDetected = _velocity_xy_filtered < _params.maxVelocity
|
||||
&& _velocity_z_filtered < _params.maxClimbRate
|
||||
&& _airspeed_filtered < _params.maxAirSpeed
|
||||
&& _accel_horz_lp < _params.maxIntVelocity;
|
||||
|
||||
} else {
|
||||
// Control state topic has timed out and we need to assume we're landed.
|
||||
|
||||
@@ -186,12 +186,7 @@ bool MulticopterLandDetector::_get_ground_contact_state()
|
||||
|
||||
// If pilots commands down or in auto mode and we are already below minimal thrust and we do not move down we assume ground contact
|
||||
// TODO: we need an accelerometer based check for vertical movement for flying without GPS
|
||||
if (manual_control_idle_or_auto && _has_minimal_thrust() &&
|
||||
(!verticalMovement || !_has_altitude_lock())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return manual_control_idle_or_auto && _has_minimal_thrust() && (!verticalMovement || !_has_altitude_lock());
|
||||
}
|
||||
|
||||
bool MulticopterLandDetector::_get_landed_state()
|
||||
@@ -231,14 +226,7 @@ bool MulticopterLandDetector::_get_landed_state()
|
||||
// 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;
|
||||
}
|
||||
return (_min_trust_start > 0) && (hrt_elapsed_time(&_min_trust_start) > 8000000);
|
||||
}
|
||||
|
||||
float armThresholdFactor = 1.0f;
|
||||
|
||||
Reference in New Issue
Block a user