I have just started to test PosHold after initially being very satisfied with how the copter flies in stabilize after following the wiki tuning guide. PosHold performance seems okay, but oscillations sort of “accumulate” over time. This seems to be worse the more wind is present. I was hoping I could get some input before I try higher speed tests.
Looks like you’ve done a pretty good job following the wiki with your tuning. There are some improvements that could be made. The one big one that could have an effect on the position hold would be the actual attitudes not following desired.
You can see in the graph above that both pitch and roll are biased from the desired values. This is indicative of the I term not being large enough or you don’t have the aircraft trimmed (i.e. center of gravity or trim pitch and roll values). Unless you were flying in some steady winds, the integrator in pitch and roll should be centered (close to zero) in a hover.
You can see here that they are both at the limit of the ILMI value. The code will not allow the leaky integrator to be leaked below the ILMI value. So I would suggest that you check your CG and trim pitch and roll values before increasing the ILMI values. If you do choose to increase the ILMI values, I would not suggest going much above 0.1.
So fixing that should help the controller with keeping position. You can see in the graph below that the velocities are out of phase with the target velocities when the position controller is trying to hold position.
Because you attach the AP on the side frame maybe is not seeing the same level of the rotor blades plane.
I suggest you to do this:
Use some paper foils and level the helicopter from the skis until you measure 0 degrees in pitch and roll, on a frame surface that is perpendicular to the rotor shaft, could be the motor top surface as well.
I got the chance to test your suggestions this morning. Unfortunately there was a bit of gusty wind from approximately heading 110 deg, so I’m not entirely sure the trim is perfect, but to me it looks better:
The I terms for pitch and roll are however still at the limit of the ILMI value. But could this the due to the wind requiring a constant correction in both pitch and roll? Or should I retry trimming the helicopter?
I set the harmonic notch filter to dynamic using the RPM sensor, and increased the PSC_VELXY_D gain in increments from 0.2 until I stopped at 0.4. There is, however, still a phase shift between target/actual velocities.