1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 12:55:19 +03:00

add note about PT1 gain on PT2 filters

This commit is contained in:
ctzsnooze 2024-10-26 19:56:22 +11:00
parent 42597c8339
commit 7f9e69420a

View file

@ -244,6 +244,7 @@ bool positionControl(void) {
}
}
posHold.previousDistanceCm = posHold.distanceCm;
// intentionally using PT1 gain in PT2 filters to provide a lower effective cutoff
float pt1Gain = pt1FilterGain(posHold.lpfCutoff, posHold.gpsDataIntervalS);
// ** Sanity check **
@ -317,11 +318,11 @@ bool positionControl(void) {
ewD = pt1FilterApply(&velocityEWLpf, ewD);
float nsA = accelerationNS * positionPidCoeffs.Kf;
pt2FilterUpdateCutoff(&accelerationRollLpf, pt1Gain);
pt2FilterUpdateCutoff(&accelerationRollLpf, pt1Gain); // using PT1 gain for stronger cutoff
nsA = pt2FilterApply(&accelerationRollLpf, nsA);
float ewA = accelerationEW * positionPidCoeffs.Kf;
pt2FilterUpdateCutoff(&accelerationPitchLpf, pt1Gain);
pt2FilterUpdateCutoff(&accelerationPitchLpf, pt1Gain); // using PT1 gain for stronger cutoff
ewA = pt2FilterApply(&accelerationPitchLpf, ewA);
// limit sum of D and A because otherwise can be too aggressive when starting at speed