mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 15:25:36 +03:00
Merge pull request #10462 from ctzsnooze/exclude-yaw-P-from-AG-boost
Exclude yaw from AntiGravity generated P boost
This commit is contained in:
commit
12e3b6e242
1 changed files with 3 additions and 6 deletions
|
@ -1159,12 +1159,9 @@ void FAST_CODE pidController(const pidProfile_t *pidProfile, timeUs_t currentTim
|
||||||
float agBoostAttenuator = fabsf(currentPidSetpoint) / 50.0f;
|
float agBoostAttenuator = fabsf(currentPidSetpoint) / 50.0f;
|
||||||
agBoostAttenuator = MAX(agBoostAttenuator, 1.0f);
|
agBoostAttenuator = MAX(agBoostAttenuator, 1.0f);
|
||||||
const float agBoost = 1.0f + (pidRuntime.antiGravityPBoost / agBoostAttenuator);
|
const float agBoost = 1.0f + (pidRuntime.antiGravityPBoost / agBoostAttenuator);
|
||||||
pidData[axis].P *= agBoost;
|
if (axis != FD_YAW) {
|
||||||
if (axis == FD_ROLL) {
|
pidData[axis].P *= agBoost;
|
||||||
DEBUG_SET(DEBUG_ANTI_GRAVITY, 2, lrintf(agBoost * 1000));
|
DEBUG_SET(DEBUG_ANTI_GRAVITY, axis + 2, lrintf(agBoost * 1000));
|
||||||
}
|
|
||||||
if (axis == FD_PITCH) {
|
|
||||||
DEBUG_SET(DEBUG_ANTI_GRAVITY, 3, lrintf(agBoost * 1000));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const float pidSum = pidData[axis].P + pidData[axis].I + pidData[axis].D + pidData[axis].F;
|
const float pidSum = pidData[axis].P + pidData[axis].I + pidData[axis].D + pidData[axis].F;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue