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

don't rotate D or A, it reverses their sign inappropriately

This commit is contained in:
ctzsnooze 2024-10-22 00:19:50 +11:00
parent 1a81b3cdf3
commit 5e81ff6977

View file

@ -331,15 +331,15 @@ bool positionControl(void) {
posHold.pitchI = rotatedPitchI; posHold.pitchI = rotatedPitchI;
// rotate smoothed DA factors // rotate smoothed DA factors
const float rotatedRollD = rollD * cosDeltaHeading + pitchD * sinDeltaHeading; // const float rotatedRollD = rollD * cosDeltaHeading + pitchD * sinDeltaHeading;
const float rotatedPitchD = pitchD * cosDeltaHeading - rollD * sinDeltaHeading; // const float rotatedPitchD = pitchD * cosDeltaHeading - rollD * sinDeltaHeading;
rollD = rotatedRollD; // rollD = rotatedRollD;
pitchD = rotatedPitchD; // pitchD = rotatedPitchD;
//
const float rotatedRollA = rollA * cosDeltaHeading + pitchA * sinDeltaHeading; // const float rotatedRollA = rollA * cosDeltaHeading + pitchA * sinDeltaHeading;
const float rotatedPitchA = pitchA * cosDeltaHeading - rollA * sinDeltaHeading; // const float rotatedPitchA = pitchA * cosDeltaHeading - rollA * sinDeltaHeading;
rollA = rotatedRollA; // rollA = rotatedRollA;
pitchA = rotatedPitchA; // pitchA = rotatedPitchA;
// limit sum of D and A because otherwise too aggressive if entering at speed // limit sum of D and A because otherwise too aggressive if entering at speed
float rollDA = rollD + rollA; float rollDA = rollD + rollA;