mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 05:45:31 +03:00
address style requests
This commit is contained in:
parent
5aad57c3a7
commit
af5fde98c1
1 changed files with 8 additions and 4 deletions
|
@ -640,19 +640,23 @@ void pidController(const pidProfile_t *pidProfile, const rollAndPitchTrims_t *an
|
||||||
|
|
||||||
pidData[axis].D = pidCoefficient[axis].Kd * delta * tpaFactor;
|
pidData[axis].D = pidCoefficient[axis].Kd * delta * tpaFactor;
|
||||||
|
|
||||||
|
|
||||||
const float pidFeedForward =
|
const float pidFeedForward =
|
||||||
pidCoefficient[axis].Kd * dynCd * transition *
|
pidCoefficient[axis].Kd * dynCd * transition *
|
||||||
(currentPidSetpoint - previousPidSetpoint[axis]) * tpaFactor / dT;
|
(currentPidSetpoint - previousPidSetpoint[axis]) * tpaFactor / dT;
|
||||||
bool addFeedforward = true;
|
bool addFeedforward = true;
|
||||||
if (smartFeedforward)
|
if (smartFeedforward) {
|
||||||
if (pidData[axis].P * pidFeedForward > 0) {
|
if (pidData[axis].P * pidFeedForward > 0) {
|
||||||
if (ABS(pidFeedForward) > ABS(pidData[axis].P)) {
|
if (ABS(pidFeedForward) > ABS(pidData[axis].P)) {
|
||||||
pidData[axis].P = 0;
|
pidData[axis].P = 0;
|
||||||
}
|
}
|
||||||
else addFeedforward = false;
|
else {
|
||||||
|
addFeedforward = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (addFeedforward) {
|
||||||
|
pidData[axis].D += pidFeedForward;
|
||||||
}
|
}
|
||||||
if (addFeedforward) pidData[axis].D += pidFeedForward;
|
|
||||||
|
|
||||||
#ifdef USE_YAW_SPIN_RECOVERY
|
#ifdef USE_YAW_SPIN_RECOVERY
|
||||||
if (yawSpinActive) {
|
if (yawSpinActive) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue