-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MC rate controller: add I term reduction factor #12296
Conversation
Reduce the I gain for high rate errors to reduce bounce-back effects after flips. Up to 200 degrees the gain is almost not reduced (<25%), so this will only take noticeable effects for large errors (setpoint changes), where we actually want to have an effect. This allows to increase the MC_*RATE_I parameters w/o negative effects when doing flips (i.e. bounce-back after flips). The 400 degrees limit and the x^2 are empirical. The better the rate tracking in general (high P gain), the less this is required (because of the lower tracking error). At the same time it also does not harm, as the i_factor will always be close to 1.
Previous commit allows to increase them again. Partially reverts commit 6c3e79f.
538af66
to
8487830
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice practical solution!
Thanks for addressing this. To me it's understandable.
tested on Pixhawk4 V5 f450 mission Mode: no issue |
Tested on Pixhawk 2 Cube V3:Modes Tested Position Mode: Good. Procedure Notes: Log: https://review.px4.io/plot_app?log=bfc710a5-e8af-4218-8e55-6549738a0864 Logs: Comparison to master Tested on PixRacer V4:Modes Tested Position Mode: Good. Procedure Notes: Log: |
This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: https://discuss.px4.io/t/pid-tuning-for-a-small-flying-wing-47-cm-wingspan/33705/5 |
As mentioned in #11560, as a result of keeping the integrators enabled, there is a bounce-back effect after a flip, due to integral build-up. This effect is non-linear, and therefore cannot be accounted for by the existing PID controller.
So this PR adds another factor to the I gain. It reduces the I gain in cases of very large rate tracking errors (in which case the P gain should reduce the error, not the I gain). The formula is visualized here: https://www.desmos.com/calculator/3o8tfaetan. Red is the existing behavior, and blue the adjusted I gain.
Up to 100 degrees tracking error, the behavior is nearly identical. And up to 200 degrees the gain is almost not reduced (<25%), so it really only takes effect where it should, without introducing steps. In the logs I checked, the tracking error is generally around or below 100 degrees for 'normal' flight.
The result is noticeably better, and it allows to considerably increase I gains in general w/o negative side-effects.
master:
this PR:
The better the rate tracking, the less this is required (because of the lower tracking error). At the same time it also does not harm, as the i_factor will always be close to 1.
I have flown this for several weeks/months and have not noticed any negative side-effects.
Here are some logs: