@bnsgeyer per our conversation I’ve tuned the P/D gains for pitch and roll, then done the ANG_P gains by increasing them to the point of instability and halving them. This allowed me to increase rate proportional loop gains from 0.03 to 0.04, derivative gains up to 0.01 (pitch) and 0.004 (roll), and then stabilize angle gains from 4.5 to 6 (pitch) and 5.5 (roll). It feels great, but there are some issues with the integral gain and our ability to get the attitude to align, particularly in pitch and especially in high-speed cruise. I’ll share plots from before / after applying the suggested I gain / after P/D tuning without the integral,… then list out questions/concerns…
Tuning15 (VFF of 0.35 and P of 0.03 for both with 0.001 derivative gain or less) - Before:
Notice it seems like the magnitude of the rate output in pitch may be exceeding the desired. Perhaps VFF is too high? This isn’t the case in roll, where they’re more closely matched, though offset.
You can see the impact to the attitude, which often exhibits a persistent offset.
Tuning16 (ILMI of 0.08 and I of 0.1 for pitch and roll)
Notice rate loops no longer following the shape of desired in both pitch and roll. Although there’s some attitude correction, it’s slow and the rate loops no longer match the same way as before. Some further attitude tracking errors encountered in transitions from cruise/forward flight as well.
The attitude error is better closed in adding the integral gain, however it takes ~5s. Then, once the integral gain is wound up sufficiently and the offset is corrected, it leaks at some rate. Want to understand this better. Depending on how this happens, it can compromise how we handle gusts and other transient disturbances. This is a concern because you can see how large the I output is relative to P.
Tuning21 (restored low 0.0001 I gains and tuned P (0.04 for pitch and roll) and D gains (0.01 for pitch and 0.004 for roll with oscillation at roughly 2x these levels).
Notice offsets are still present and similarly shaped rate curves once we’ve backed off I again and increased our other gains. More derivative response than proportional in various stages, but definitely stable.Not sure if this is a good thing for heli flight dynamics.
Notice that although attitude in roll looks decent, but pitch attitude offsets look bad, possibly worse than before P/D gain tuning when we also had no integral gain.
Tuning22 (increased ANG_P gains from 4.5 to 6 (pitch) and 5.5 (roll), which was half of the point they oscillated at)
You can see this didn’t really help much, if anything maybe worse. Would have expected it to behave like the integral gain on our attitude loops in correcting offsets by increasing desired rate.
You can also see that the attitude offset gets worse when we speed up or slow down in cruise.
From this tuning there are a few open questions:
- Why do the pitch loops look worse than the roll ones, possibly even outputting larger rates than the desired levels? Do we need to reduce pitch VFF?
- Given these plots, how do we properly set the I gain? We’ve tried reducing it, reducing ILMI, and setting it around 20% of the VFF gains, but does it actually need to be higher to respond more quickly?
- Why is adding integral gain ruining how the desired and rate outputs track - they no longer feature the same shape the moment we get I gains above 0.05. Will it be possible to get nicely following rate curves that also align without an offset? Is this possible on a traditional heli of this topology?
- Is it possible to configure how the integral accumulator leaks, once we reach the target, so that we don’t wash out our disturbance handling capability?
- Are we properly tuning the ANG_P gains and shouldn’t they help clean up these attitude offsets?
Dataflash logs and parameter files uploaded here.