Merge pull request #10778 from ctzsnooze/Allow-feedforward-in-Level-and-Horizon
This commit is contained in:
commit
86aa5cc84e
|
@ -1100,9 +1100,11 @@ void FAST_CODE pidController(const pidProfile_t *pidProfile, timeUs_t currentTim
|
|||
pidRuntime.oldSetpointCorrection[axis] = setpointCorrection;
|
||||
#endif
|
||||
|
||||
// Only enable feedforward for rate mode and if launch control is inactive
|
||||
const float feedforwardGain = (flightModeFlags || launchControlActive) ? 0.0f : pidRuntime.pidCoefficient[axis].Kf;
|
||||
// no feedforward in launch control
|
||||
float feedforwardGain = launchControlActive ? 0.0f : pidRuntime.pidCoefficient[axis].Kf;
|
||||
if (feedforwardGain > 0) {
|
||||
// halve feedforward in Level mode since stick sensitivity is weaker by about half
|
||||
feedforwardGain *= FLIGHT_MODE(ANGLE_MODE) ? 0.5f : 1.0f;
|
||||
// no transition if feedforwardTransition == 0
|
||||
float transition = pidRuntime.feedforwardTransition > 0 ? MIN(1.f, getRcDeflectionAbs(axis) * pidRuntime.feedforwardTransition) : 1;
|
||||
float feedForward = feedforwardGain * transition * pidSetpointDelta * pidRuntime.pidFrequency;
|
||||
|
|
Loading…
Reference in New Issue