Open b14ckyy opened 7 months ago
Few lines above the mentioned if statement we have:
const bool planeIsFlyingStraight = rotRateMagnitudeFiltered <= DEGREES_TO_RADIANS(servoConfig()->servo_autotrim_rotation_limit);
const bool noRotationCommanded = targetRateMagnitudeFiltered <= servoConfig()->servo_autotrim_rotation_limit;
And by default servo_autotrim_rotation_limit
is 15 deg/s. Could this be the problem source?
Also is targetRateMagnitudeFiltered
in degrees/s and not in radians/s?
Current Behavior
If Continuous Servo Trim is enabled on fixed wings, it is constantly trimming even when not flying level or when flying slow or fast maneuvers. This leads to a few seconds of strongly out of trim plane behavior after long rolls or turns as well as loops and can in worst case cause a crash at a low altitude loop. It also causes a lot of false trim during landing when the pilot does a flare maneuver at low airspeed.
Steps to Reproduce
Expected behavior
Continous Servo Trim should only trim the plane if the rate setpoint is very close to 0 in Autolevel modes or within stick deadband in acro mode. The trim should be locked while the pilot or autopilot is doing any maneuvers, turns or altitude changes.
Suggested solution(s)
I checked the code as far as I was able to understand it and found that the Continous Servo trim has multiple sanity checks before it should get active.
I think one or more of these sanity checks are not properly working.
Additional context
The issue must be in INAV for a long time. I just noticed it intensively while testing other stuff and investigated a bit more. Here are 3 flight logs I did for a test of https://github.com/iNavFlight/inav/pull/9905 on a 8.0 build: LOG_2.zip
LOG 33 is with Continous servo trim enabled. You clearly see after a long turn, that Integral is pushing hard to keep the pitch rate at 0 and settles slowly as trim is corrected. LOG 34 I disabled CST and did a classic autotrim with the trim mode, clearly does not show this same LOG 35 is another flight after saving the trim and just redoing autotune again to validate the correct rates and FF with a persistent trim.