Or in fact “D’oh! D’oh!”. As you might guess, two bugs / enhancements found while snoozing on the sofa, musing over some of this morning’s flights:
- if you have nested PIDs, try to only include the integral gain in the outermost PID to ensure best performance. Therefore tune from inner to outer (i.e. next outer gains set to 0 when tuning inner), and once tuned, increase the tuned inner P gain by up to 50%, set the I gain to 0, and reenable the next PID gains – i.e. tune angular rate, absolute angle and horizontal speed in that order.
- If you’re going to change how you calculate the Euler angles to match the coordinate system of the gyro angles, you really ought to change the Matrix used so that X, Y and Z angles are wholly independent (i.e. no sines).
Not finished yet with the inside-out re-tuning, but the progress so far looks promising.