1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 04:45:24 +03:00

Move anti-windup iterm reset from rx loop to pid loop

Having the iterm resetting happening in the rx loop causes a sawtooth PID/motor effect while idling since the PID loop is running at a much higher rate and iterm is allowed to grow during this, and then only reset at a much lower rate in the rx loop. This can potentially lead to some oscillation and/or resonance while idling before takeoff as the sawtooth signal can make it through to the motor outputs.
This commit is contained in:
Bruce Luckcuck 2019-01-19 10:13:34 -05:00
parent 628fdb8adc
commit d867aeced3
5 changed files with 13 additions and 2 deletions

View file

@ -80,6 +80,7 @@ static FAST_RAM_ZERO_INIT float antiGravityThrottleHpf;
static FAST_RAM_ZERO_INIT uint16_t itermAcceleratorGain;
static FAST_RAM float antiGravityOsdCutoff = 1.0f;
static FAST_RAM_ZERO_INIT bool antiGravityEnabled;
static FAST_RAM_ZERO_INIT bool zeroThrottleItermReset;
PG_REGISTER_WITH_RESET_TEMPLATE(pidConfig_t, pidConfig, PG_PID_CONFIG, 2);
@ -1392,6 +1393,8 @@ void FAST_CODE pidController(const pidProfile_t *pidProfile, const rollAndPitchT
pidData[axis].Sum = 0;
}
} else if (zeroThrottleItermReset) {
pidResetIterm();
}
}
@ -1444,3 +1447,8 @@ void dynLpfDTermUpdate(float throttle)
}
}
#endif
void pidSetItermReset(bool enabled)
{
zeroThrottleItermReset = enabled;
}