Detecting Cleanflight PID tuning issues with Blackbox: excess P gain

Almost all quadcopter PID tuning tutorials can be summarized into one sentence: “Increase P until you see oscillations, then lower it”. Plus some thoughts about I and very vague advices about D and that is all. When I got into the hobby, I’ve read all of those tutorials. And I did know more about PID tuning than before that. I even had more questions than before. How to recognize high frequency oscillations, how to recognize low frequency oscillations. Lower P? OK, but how much? And D? How to tune this bloody D? As a result, every time I tried, I ended up with very snappy but shaky quadcopter that maybe responded very quickly to commands, but was very shaky and was making strange noises.

And then came Cleanflight and Blackbox. Live became simpler. What I’ve learned from Blackbox logs is that I wanted high P so much, I had too much of it in the end. Actual oscillations begins before we see or hear them and excess D introduces jello. Blackbox simplified things, but still, logs analysis is something like an art. You have to know what to look for. Continue reading “Detecting Cleanflight PID tuning issues with Blackbox: excess P gain” »

What is PID controller?

Multicopter is an unstable machine. It requires constant corrections to keep is stable in the air. This is done with PID control loop. When quadcopter does not fly like you hoped, you will hear: “Tune your PIDs“.  Nice. But what exactly is PID? If you did not studied control theory, and you do not want to start, you read internet. And internet tries to explain PID in various ways. Some are better, some are worse, and there is always room for a new one. So here we go.

Officially, PID goes for Proportional, Integral, Derivative. Wikipedia provides enough of long and boring theory. If it’s TL;DR, here is a short summary:

  • PID controller measures error of current output and desired output,
  • This error is processed separately by P, I and D modules,
  • Then, output of each module is multiplied by it’s coefficient (Kp, Ki, Kd) and added all together as an controllers output,
  • Controller can be tuned by changing Kp, Ki and Kd values,
  • In a multicopter, there is separate controller for each axis (roll, pitch, yaw) working based on rotation speed provided by gyros. This is called and “inner loop”.
  • Some flight modes adds “outer loop” with separate PID controller that is translating user input into values used by “inner loop”. Outer loop is much less important than inner loop and usually there is not need to tune it,
  • Flight modes like Attitude, Angle, Horizon (all with self leveling) are using both outer and inner loop,
  • Flight modes like Rate, Acro and using only inner loop,
  • When speaking on PID tuning, in 99% of cases we will be talking about tuning the “inner loop”,
  • Inner loop tuning should be done only in Rate/Acro flight modes (no self leveling) and avoid complex outer-inner loop interactions.

Continue reading “What is PID controller?” »

PID values for Reptile 500 frame

I know, I know… posting PID values for one multirotor is not very useful after all. The same frame with different motors, props and battery might require totally different PID values. But.. At least they can be used as starting point for customized tuning. So, here is my configuration for Reptile 500 and frame and following configuration:

  • Battery: 5000mAh Turnigy 3S,
  • FC: Flip32 running Cleanflight 1.10,
  • Motors: Turnigy Multistar MT2213 935KV
  • Props: APC 10×4.5 MR
  • ESC: AfroESC 20A running OneShot125 and BLHeli 14
  • Weight: 1300g with battery

So, if you have somehow similar configuration, you might try my values. And they are:

  • PID Controller: LuxFloat (BTW, as far as I can read C code (last time I was programming with C about 20 years ago) and know smth about PIDs, this is the only controller implemented into Cleanflight that actually is written in a proper way. The way I see it, all the other works only by mistake, specially on D part. Who thought that substracting D term is actually a good idea?)
  • Roll (P / I / D): 2.5 / 0.06 / 70
  • Pitch (P / I / D): 2.5 / 0.06 / 70
  • Yaw (P / I / D): 2.5 / 0.1 / 0
  • Other controllers on default values
  • Custom mixer from this post
  • PID and gyro filtering enabled via CLI with following commands (BTW again, those filters are he best thing that came in Cleanflight 1.10. Everything is much smoother with them. Good job on those):
    • set dterm_cut_hz = 16
    • set pterm_cut_hz = 32
    • set gyro_cut_hz = 64

Important note for 2015-11-22

PID values from above has been determined as main source of extensive high frequency vibrations causing jello effect. Specially high D, even with LP filter, was causing jello effect. Read this post for improved PID settings for Reptile 500 frame and Cleanflight.