Alternative PID tuning guide

Hi, I have a multicopter setup that I have been using for a while with the default PID settings. So far these have been adequate but there are a few performance deficiencies that I would like to address. The main problem with the current tune is the loss of altitude when yawing which I guess I can improved by adjusting MC_YAWRATE_FF. But looking at the flight logs the rate controllers are also clearly overdamped. Since the PID tuning guide recommends addressing the rate loops before looking at the outer loops I was thinking about starting here.

The problem is that I’m not a very experienced flyer and I don’t want to trash this research project by loosing control in acro mode. While the tuning guide explicitly says not to, I wondered if anyone has had any success with strategies for PID tuning in position or velocity modes? I am lucky enough to have an rtk gps and/or access to a Vicon rig. Nb. The tuning doesn’t have to be super aggressive, I just wanted to get some of the way to being critically damped. In the absence of better strategies I have a couple of ideas that I was thinking of trying out:

  1. Each flying session (for me this entails offboard position and/or velocity control) I will increase either the rate P or D gain (depending on analysis of the previous session) and use the PID analysis tool to check for any overhsoots and gradually work towards an idealised step response for each axis.
  2. Using the vicon rig, I will perform aggressive velocity control (or, since safer in a confined area, position control with jerk smoothing switched off?) step inputs for each axis. As with 1), the tuning strategy outlined in the PX4 tuning scheme would be more or less adhered to, but in contrast to 1), we ensure that a large step input has been induced and the tuning can be “completed” in a single day.

I don’t know if this is a common problem (there seem to be many previous topics requesting auto-tune functionality) but if there is interest and a solution is found I am happy to feedback a description of what did/didn’t work.

1 Like

Maybe @bkueng or @MaEtUgR want to chime in here.

Sorry for the late answer, I hope you are already further in your investigations.

loss of altitude when yawing

That’s not a very typical deficiency you would face with “non-tight” attitude and rate tuning.
Could it by any chance be that the motors of your vehicle run into the upper limit? Just a guess, it’s very hard to say without observing it.

The parameter MC_YAWRATE_FF is disbled by default and allows to give direct feed-forward of e.g. your stick yawing to the mixer torque. This is not something you tune first when coming from stock configuration but more an additional possibility to increase the tightness of your yaw control even more after already having tuned everything else.

The problem is that I’m not a very experienced flyer

If you plan to tune such a vehicle I suggest you get at least comfortable flying Manual/Stabilized mode maybe first in simulation and then on a cheap vehicle because IMHO tunning to acceptable results in that mode is possible while tuning in Position mode provides you with too many unkowns to effectively see what effect your tuning changes have.

I would definitely not do e.g. rate control tuning in offboard. In the worst case the vehicle goes into strong oscillations or even unstable and if you’re flying manually you usually already see that when it’s still on the ground or just centimeters above and you can pull the throttle down again quickly.

Thanks for the reply. Thanks to the Scottish winter, I haven’t really done any flying since I asked the question. However, reviewing a log with the loss in altitude behaviour, it indeed looks like the motor outputs are saturating when large yaw rates are commanded. In a different log, where I reduced the maximum yaw rate MC_YAWRATE_MAX = 90. Drops in altitude are less apparent. The motor outputs are still saturating, but only for a couple of samples. Is this normal for a medium weight 400mm quadcopter or does this indicate that the thrust/weight ratio is problematic? I guess it depends on application. Anyway, since its just a research task, I think I can resolve the problem by reducing the maximum yaw rate.

Re: tuning. I plan to make time to learn this skill in future, and thanks for the suggestion about using the simulator. I still think it should be possible/desirable to improve gain values over time just by reviewing flight logs and making small adjustments (maybe the PID analysis tool already provides this?). A process that I think would be best served with a mission that systematically explores the system response to step inputs for each axis. But given the above solution to the loss in altitude problem, I’m not actively pursuing this at the moment, just leaving as a general comment.