mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 03:20:00 +03:00
AoA limiter Lift coef forcast algorithm is improved
This commit is contained in:
parent
84431502b4
commit
5f9409e5be
1 changed files with 8 additions and 2 deletions
|
@ -106,7 +106,7 @@ static bool updateAngleOfAttackLimiter(const pidProfile_t *pidProfile, float lif
|
|||
float liftCoefF = pt1FilterApply(&pidRuntime.afcsLiftCoefLowpass, liftCoef);
|
||||
float liftCoefVelocity = (liftCoefF - liftCoefLast) / pidRuntime.dT;
|
||||
liftCoefLast = liftCoefF;
|
||||
liftCoefF += liftCoefVelocity * (pidProfile->afcs_aoa_limiter_forcast_time * 0.1f);
|
||||
float liftCoefForcastChange = liftCoefVelocity * (pidProfile->afcs_aoa_limiter_forcast_time * 0.1f);
|
||||
|
||||
if (pidProfile->afcs_aoa_limiter_gain != 0) {
|
||||
const float limitLiftC = 0.1f * pidProfile->afcs_lift_c_limit;
|
||||
|
@ -116,6 +116,9 @@ static bool updateAngleOfAttackLimiter(const pidProfile_t *pidProfile, float lif
|
|||
servoVelocity = 0.0f;
|
||||
if (liftCoefF > 0.0f) {
|
||||
liftCoefDiff = liftCoefF - limitLiftC;
|
||||
if (liftCoefForcastChange > 0.0f) {
|
||||
liftCoefDiff += liftCoefForcastChange;
|
||||
}
|
||||
if (liftCoefDiff > 0.0f) {
|
||||
isLimitAoA = true;
|
||||
servoVelocity = liftCoefDiff * (pidProfile->afcs_aoa_limiter_gain * 0.1f);
|
||||
|
@ -124,6 +127,9 @@ static bool updateAngleOfAttackLimiter(const pidProfile_t *pidProfile, float lif
|
|||
}
|
||||
} else {
|
||||
liftCoefDiff = liftCoefF + limitLiftC;
|
||||
if (liftCoefForcastChange < 0.0f) {
|
||||
liftCoefDiff += liftCoefForcastChange;
|
||||
}
|
||||
if (liftCoefDiff < 0.0f) {
|
||||
isLimitAoA = true;
|
||||
servoVelocity = liftCoefDiff * (pidProfile->afcs_aoa_limiter_gain * 0.1f);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue