by alex.khoroshko » Fri Jun 28, 2013 4:28 am
Oh, that's a good idea! All the coefficients (P, I and D) are scaled by the trust to weight ratio. So, we can make the common parameter, which would adjust them all at the same time (not change their values, but is a scale factor, which implicitly multiplied by them all). It would work as good, as possible for people, who can not/do not want to understand the difference between all the gains. It can be done very efficiently -by scaling of error value - single multiplication is only needed.
This should look like this:
Gain [0:255], P[-100%:+100%], I[-100%:+100%], D[-100%:+100%].
Or, PIDs gains correction can be done in our favorite [-127:127]. It needs testing - quite possible that the range of about 10% would work for all. The only potential drawback here is D - it may make aircraft twitchy if the vibrations are bad, so there should be a way to make it zero (-100% correction should be accessible).
Also, I still remember about redoing the horizon mode to make it tunable from minor leveling (like I did initially) to the same behaviour, as horizon is in the initial version of PID. Would do that ASAP.
Also, why changing with a pot? Let's make any PID value assignable to any channel via GUI? You fly and tune - the best way possible, IMO. The only problem here is how to save the settings. Saving every second seem nice, but it needs asynchronous EEPROM write routine. I have one, if that would be needed.
And I thought about self-tuning PIDs. Ziegler-Nichols method won't work well, because different multirotors (not only different types, but also different frames) have different amplitude-phase characteristic - some ESC may introduce dynamic influence early, some - may not etc. For example (I said it earlier) my bad quad needs very low P and most of the control is done through the I gain (without it the quad is barely flyable). So just setting the gains proportionally is not the solution for all the problems, it's a good idea to start tuning, though (as I've written above)