Quadcopter PID Explained

Many quadcopter software such as Betaflight and KISS allow users to adjust PID values to improve the flight performance. In this post I will explain what PID is, how it affects aircraft stability and handling, and I will share some simple techniques how to tune your quadcopter’s PID.

What Is PID in a Quadcopter?

Unfortunately, we don’t live in the perfect world, so we invented PID controller to help bring the real world closer to that perfect world.

PID is a function in flight controllers. It reads the data from sensors, and tells the motors how fast they need to spin. Ultimately this is how stability is achieved in a quadcopter.

PID stands for proportional-integral-derivative. PID controller is a closed-loop control system that tries to get the actual result closer to the desired result by adjusting the input. The error is fed back to the beginning, and the same process repeats.

A PID controller calculates an “error” value as the difference between a measured variable and a desired set-point. The controller attempts to minimize the error by adjusting the control inputs.

This can relate to something we are familiar with: in a multirotor, PID controller takes data from sensors and compare that against the expected values. The difference would be what we call an “error”. And so the flight controller alters the speed of the motors and hopefully the “error” will get smaller next time. And this is how PID stabilize a quadcopter.

quadcopter pid diagram

There are 3 functions in a PID controller, they are P, I, and D. Heuristically, these values can be interpreted in terms of time:

  • P looks at present error –  the further it is from it’s setpoint the harder it pushes
  • D is a prediction of future errors, by looking at how fast you are approaching a setpoint and counteracts P when it is getting close to be at the setpoint
  • I on the accumulation of past errors, it looks at forces that happen over time (if an axis constantly drifts away from a setpoint due to wind) it spools up motors to counteract it

If you are feeling extremely confused right now, it’s okay. You don’t have to understand the theory of PID and still be able to tune your quad’s PID, just jump straight to the “My Simple PID Tuning Process”. But if you are interested in how things work, keep reading :)

To have any kind of control over a quadcopter:

  • We first need to measure the quadcopter’s angular rate (how fast the quadcopter is rotating in each axis)
  • Knowing what the desired angular rate we want the quad to be, we can estimate the error
  • We can then apply the 3 control algorithms to the error, to get the next outputs for the motors aiming to correct the error

That really just is the “academic description” of how PID controller works. In practice, each of these three parameters presents some unique effects to the craft’s flight characteristics and stability.

These parameters are numbers we can play around with. They are basically just the coefficients to the 3 algorithms we mentioned above. The coefficients change the influence of each algorithm to the output. Here we are going to look at what the effects of these parameters have to a quadcopter .

A multirotor can rotate in 3 axis, and for each axis there is a PID controller for it. That means we will have a separate set of PID coefficients for each axis (Pitch, Roll and Yaw), in total 9 values we can tune.


You don’t need to fully understand how PID controller works in order to fly a quadcopter. However, if you’re interested in the theory and background, here is a very interesting explanation of PID controller with examples. This PID tutorial is also very good and easy to understand for beginners.

The Effect Of Each Parameter

Generally, altering PID values (gains) have the following effect on a quadcopter’s behavior:

P Gain

P determines how hard the flight controller corrects error to achieve the desirable flight path (aka where the pilot wants it to go, your stick input).

Think of it as sensitivity and responsiveness setting, it sometimes can affect your rate as well, your rate will feel higher if P is higher.

Generally speaking, higher P gain means sharper control while low P gain means softer control. But if P is too high, the quadcopter becomes too sensitive and over-correct itself. Eventually it will cause overshoots, and you will have high frequency oscillations.

You can lower P to reduce oscillations, but then your quadcopter might feel sloppy, so you need to play with I and D to compensate, begin to get the beauty of tuning? :)

I Gain

I term determines how hard it holds the copter’s attitude against external variables, including wind and off-centered CG.

Think of it as the stiffness setting in the stall motion of your quadcopter.

Normally default I gain works pretty well on most modern FC software and hardware. But if you notice some drifting without user command, then increase I term. When I is too low you might find yourself having to correct the quad’s flying path a lot more with your sticks, espeically when you play a lot of with throttle.

When I gain gets too high your quadcopter will be overly constrained by the I term, and it can start to feel stiff and doesn’t respond to your stick well. It’s similar to having a slower reaction and a decrease effect of the P gain. In more extreme cases with excessive I gain, the copter can even oscillate in a low frequency.

No ESC’s, motor’s or propellers are identical thus will provide different thrust when spinning in the same air. When you do a punch out and immediately lower your throttle, a motor can start and stop faster than other ones, this will cause an unwanted dip movement.

I gain can be used to “fix” these tiny details in your quad’s flight performance.

D Gain

D gain works as a dampener and reduces the over-correcting and overshoots caused by P term. By adding D gain, you can “soften” the movement just like adding a spring to it, and it counter the oscillations caused by excessive P gain and can minimize propwash oscillations as well.

When D is too low, your quad will overshoot (bounce-backs) badly at the end of a flip or roll, and you will have the worse propwash oscillations caused by vertical decents.

However excessive D value can introduce vibration in your quadcopter because it amplifies the noise in the system. In the attempt to make your quadcopter fly smoother it will tell the motors to spin faster or slower in a very fast rate that the motor cannot keep up, and eventually cause motor overheat. The vibration will feed back into the flight controller, and make the situation even worse over time.

Another side effect of high D term is increased latency in the quad’s control and reaction, and makes it feel “mushy”.

Is PID tuning necessary?

PID tuning used to be necessary, but that’s not true anymore.

Modern flight controller software has sophisticated noise filtering and optimized algorithms. Quadcopters can fly very well out of the box on stock PID values unless you are using some very poor quality parts or the quad is badly built.

Nowadays knowing PID tuning makes the difference between “flying well” to “flying perfect”.

How to tune quadcopter PID Gains

Before tuning:

  • Always tune your quad in Rate Mode (aka Acro Mode)
  • Make sure your quadcopter’s CG (centre of gravity) is right in the middle, CG has a significant effect on how good your quad can fly, and can be tuned

There is no right or wrong way of tuning PID, whatever works for you is the right way.

I normally start out by using default PID when I tune my quad. With modern flight controller software such as Betaflight and KISS, the stock values work very well for most setups out of the box.

I fly around, notice any undesired behaviour and then adjust PID accordingly. If the quad flies really badly with default PID values, for example, lots of vibrations, you can try tuning PID from low values. Just lower all the PID values half or more, to make sure they are definitely not too high to start with.

Every time when you adjust PID, you should ask yourself: “is it getting better or worse?” Find the point where it has the best flight characteristics before it goes down hill again.

Tune one axis at a time: first roll, then pitch, and finally yaw. And at each axis, I adjust one value at a time starts with P gain, then D gain, and finally I gain. You will need to constantly go back to fine tune the values as one value could affect the effectiveness of another.

Yaw Performance and PID

The hardest part to understand in PID tuning is the yaw axis. But it’s also the easiest part because you can leave it at default in Betaflight and your quad should fly just fine.

PID can help with yaw performance of your quadcopter to certain extend, but you have to understand there many other factors that can introduce yaw destabilization too.

one of the most common bad yaw symptons is, when you do a fast yaw spin the quad shoots up and doesn’t stay level.

Quadcopter’s yaw performance depends heavily on the hardware, i.e. motors, propellers and ESC. This hardware determines your maximum yaw rate (how fast you can spin around yaw axis), until you get destabilization.

To improve yaw performance, you can try the following.

  • Using Heavier Propllers: Higher pitch propellers can generate more counter-torque at the cost of efficiency
  • Increase Motor RPM, by using higher kv motors or increasing battery voltage
  • Using ESCs with stronger braking – Yaw destabilization can occur when a down-spinning motor cannot decrease its speed as fast as an up-spinning motor increases
  • Reducing motor distance can help increase yaw authority too: A 6″ frame flying 5″ props will have worse yaw performance than a 5″ frame with the same props.

If you cannot afford to mess around with hardware, the last resort would be to lower your yaw rate, or increase yaw expo, either way will slow down the yaw spins.

My Simple Tuning Process

P on Roll

Cruise around, with good P, the control should feel precise and the quad should follow your sticks very closely.

Try to do some sharp turns, if P is too low the quad would dip to one side, but when P is too high, you will get fast oscillations. When P is right, you should get minimum oscillations when doing sharp turns.

P on Pitch

Do a slit-S, and as you increase throttle to recover, pay attention to the pitch movement. If the quad pitch up more than it should, then P is probably too low. but if you get some fast oscillations then you need to decrease P.

Fine tune it until you get to a point where the quad would feel very responsive and nimble, yet there is no excessive amount of vibration. Also listen to your motors, twitching motors are a sign of excess P gain which might not be visible in the camera.


TPA is a setting to reduce the effectiveness of P gain as throttle increases.

Do a punch out and see if there is any fast oscillations, if so then increase TPA. Good TPA will give you a relatively smooth punch out. I personally wouldn’t use TPA higher than 0.4.

D on Roll and Pitch

Now when you do aggressive maneuvers like flips and rolls, you will probably notice some overshoots (aka bounce-back) at the end of the move. Increasing D gain can help reduce that.

Be careful because excessive D gain can make motor run hot, so use just enough to eliminate the bounce-back. A good amount of D gain will also reduce propwash. D gain too high would also cause fast oscillations at the end of a roll or flip too.

I on Roll

Bank your quad to the left or right and see if it’s holding the angle well. You want it to just stay in the same attitude as you release the stick. If the quad can’t hold the angle then I gain is too low and need increasing.

Do the same for pitching forward.

Your quad can drift in windy condition, so I gain needs to be adjusted depends on wind speed.

But I would recommend increasing I term just high enough to stay level, excessively high I gain can result in stiff and robotic feeling.

Anti Gravity Gain

Fly in a straight line and do some rapid punchouts to see if pitch stays the same angle, If the quad dips down then increase Anti Gravity. I found 3 to be a good value for most of my setup’s.

Yaw P

Yaw PID needs to be tuned separately. Default values usually work pretty well on all setups.

Spin yaw quickly and see how it stops, if you get fast oscillations then decrease P, but if the quad dips one side, then increase P.

Excessive Yaw P won’t cause as much vibrations like roll and pitch because yaw movement is much weaker on a quadcopter (lack of yaw authority). But look for any twitching and oscillations in the yaw axis. Also you might notice the quadcopter would tend to gain altitude when doing rapid yaw movements when P is too high.

When Yaw P is right the spin should be clean and snappy.

Yaw I

As mentioned, “I” is there to prevent drift, but excessive yaw “I” can introduce instability and actually reduces responsiveness. Yaw “I” should never be higher than is needed to prevent drift.

If nothing is wrong, just leave Yaw I at default.

D-Term Set Point Weight

If D SetPoint Weight is high, the quad would feel more locked in but more robotic as well. If it’s low, the quad feels more smooth but a bit loose and sluggish.

I personally prefer 0.6 which is a good balance.

Rate and Expo

Rates and expo are just as important to quad’s flight performance and control.

Not Every Problem is related to PID

Before tuning PID, here are a few things you should get right first with your quad.


Not all oscillations are caused by high P term. You need to eliminate vibration sources as much as possible on your quadcopter before tuning PID. For example balancing of motors and propellers, frame rigidity etc. With a vibration free copter, you can set a much higher P gain, and smoother machine.

Center of Gravity (CG)

You want quad’s center of gravity to be right in the middle, where the 4 motors intersect on a horizontal plane.

What happens when your CG is off-centered? Some motors will have to work harder than others, not only it might cause motors overheat, it will also affect stability.

For example in a quad, maybe your LiPo battery is too far back, it shifts the CG to the back. And now the 2 rear motors have to work 100%, while the front 2 motors are only at 80%. If you want to push harder in throttle, you can’t! You quad might oscillate back and forth and won’t deliver any extra power because the rear motors have already maxed out.

Mass Distribution

Quadcopters with more centralized mass tend to feel more precise, snappy and responsive. When there is more mass on the outside of a quad, it takes more force to rotate it. Also due to the angular mass and inertia it’s harder to stop it from rotating.

That’s why X frames (mini quad frame shape) have taken over the mini quad market from H quads when people realized the benefits. Apart from frame design, lighter motors and ESC also helps reduce rotational inertia.

“What’s your PID?” – Wrong Question!

It’s pretty meaningless to use someone else’s PID on your quad. Every quad is unique in some way: motor, propellers, ESC, FC, weight distribution, COG, frame… Even the wind speed and climates are different where we are flying, so the ideal PID values are going to be different too.

When to “Retune” PID?

Almost all the parts in your copter has some effect on your PID. So when you swap out components for a different brand/model, you must re-tune your PID gains. For example Frame, Propellers, Motors, ESC’s etc…

In Betaflight and Cleanflight, Looptime also has a great impact on your PID values. Once you changed Looptime make sure to return PID.

53 thoughts on “Quadcopter PID Explained

  1. Chinedu Amadi

    Hello Oscar,

    This article has been invaluable in my research. I am working on designing and implementing a model predictive controller on a quadcopter. The current controller on the quadcopter is PID so I needed to grasp the interactions before implementing mine. My question is how do you determine the “desired rotational rate” for the rate PID? I have looked around but so far I have come up short.

    The PID rate controller on the quadcopter I am using simply multiplies the euler angle error by a constant to get the desired rate. I did not understand that. Any assistance will be greatly appreciated. Thank you.

    Chinedu Amadi

  2. Darby

    I have recently taken up building drones and i have just completed my first one. However when i come to the PID tuning part i struggle a bit. One of my problems is that in self leveling mode the quad starts to rock from side to side and back and forth as though it is trying to self level but is over correcting. Could you tell me what i could adjust to help fix this problem

    Look forward to your reply
    Thank you

  3. Mrinal Kanti De

    First of all I thank you for this precious post.
    But I have an issue with my quad. I have a f450 quadcopter with a kk2.1.5 flight controller. As I give a little thrust to it , it takes off but, it wanders of its own. I have trimmed all the channels on my FC. Also, maintaining any given height is very difficult. Do these reactions of my quad is related to the PI settings of the kk2.1.5 anyway? If not, what is the solution to this problem. Please help.

    Will eagerly wait for your reply

    Thanking you,

  4. Damian

    Thanks for this article. As an experiment, I installed a F3 brushed into quadcopter with geared rotors. Using the method as described, I have observed some interesting reactions made by this relatively slow aircraft. Surprisingly, it flies well. It has unusually high P & D settings which took many tries to get right.

  5. Paul Faugeras

    Hello Oscar,
    Thank you so much for this amazing article, I would like to use it as a source for my engineering project this year (I’m a french student) : What would you like me to cite it as ?
    What’s more, I can’t find the exact date of the article : is there any way I can find it ?
    Thanks a lot, and happy new year ! ;)

    1. Oscar Post author

      P limit and I limit is something defined by the software programmers, they don’t exist in the general PID controllers, I think you would be better off checking the specific manual, because it can mean different things from firmware to firmware.

  6. sri

    Excellent post for PID sir,

    For the PID algorithm, one input is from sensors that will give Yaw,Pitch,roll angles and another input is PWM widths(calculated) from the Receiver.
    How can we find the error from angles and PWM widths ??

    Thanks in advance

    1. Zer0

      For that you have to convert your PWM widths in angles. In rate mode you say like 1500 (wich should be the middle position of your sticks) is 0 degrees per second. If you have 1000, we wan’t maybe 500 degrees per second, wich should be eonugh for most acrobatic maneuvers. At 1250 we should have 250 degrees now. All thoose numbers are the desired angular motion!
      Now your gyro gives you the actual angular motion of your quad. Whats left is simply calculating the difference between both of them. That is the value you have to use for feeding your pid loop.

      Hopefully I understood your question right and helped you a bit, sry for my english, school’s long ago.

  7. Prashanth Rajagopalan


    I read about PID tuning of the drone. I understood the basics. I would like to go in depth and read on how to calculate P I and D values. If anyone knows any links for PID calculation of drones please share.

    Thank you.

    1. Andres

      If you are looking for a formula that will provide you the numeric value of your PIDs based on some parameters you provide, you will not find such calculations.

      The PID values for your quad are based on the physical, mechanical and electrical configuration of your quad. The combination of parts, where you located the parts and the software of your quad will result in a unique set of PIDs for your quad.. like a fingerprint.

      The math required to accurately calculate PIDs such that you can just do the math and “plug them in” would be too complicated and require modeling based on a database of all possible parts/software and frame configurations available. Kind of like trying to predict the wether.

    1. Oscar Post author

      could you also check rate mode? if it also drifts then it’s probably something to do with your motor/props, or weight distribution.
      if it doesn’t drift in rate, but only in self-level mode, then it’s something to do with your ACC, maybe hardware, maybe calibration..

      Do a fresh calibration, centre all your sticks and try again.

  8. Surojit

    Hi Oscar,
    The main problm i came across is bringing all the motors upto same speed in order for the drone to lift from the ground inspite of giving adequate throttle.Can you guide me through this problm?

  9. Mohammad Mahdi Jabbarpour

    I have a quad copter with t-motor mn-3508 motors and t-motor air 25A speed control and t-motor carbon propeller and naza m-lite without GPS flight control.
    my quad copter not flight. and only motors rotate with speed.
    what is the best setting for this quad copter ?
    and how can I fix this.
    Thank You.

    1. Raha

      Hi Mohammad Mahdi,
      Size of propellers seems to be the issue here…since you are using 700kv motors, use bigger props from 11-12 inch…use a 3s battery…it should get you to hover at respectable throttle provided your set up isnt too heavy…but its still a matter of experimentation….

    2. Lee

      Check your motors are going the correct way for they’re position. Front left CW. Front right CCW. Back right CW. Back left CCW. Then check Props are up the correct way and are in the correct position for they’re rotation.

  10. Jeremy

    Hi Oscar

    Im a fan of your page and i have learned alot but im having trouble learning and undersranding how to code.

    Ive built a 3Dof hexapod spider and im duing to get it going. Ive been using sequencers but tgey suck.

    Im pretty desperate now to get it going. Would it be possible for you to put me in touch with some one i could hire to do my IK and code my bot for me.

    I would really appreciate your help

    Jeremy Wood

      1. Willy

        Hi Oscar! Thank you very much for this post, I have successfully made the Quad stable in Acro mode (using Gyro for rate PID). Now I’m trying to make my quad to Auto-Hover. From the picture above I assume that I will have to Calculate angles with a complementary filter for example and pass those angles in as desired rotational rates for my Rate PID? But what is confusing to me is, what is that Normalize PID?

  11. moosestang

    I’m trying to correct a wobble i get when making sharp turns at speed. this maybe inherent to this particular quad copter and i think it’s mostly cause by yaw. I first thought it was from hitting the max angle in angle mode, so i increase it to 90, thanks for clueing me in to that. Increasing max angle did seem to help. I tried lowering the level pid and also the overall leveling in angle mode. The thing weighs 140grams with battery and is only 122mm, so it might just be too heavy for it’s size.

    It also is not symetrical, see pic. pbase.com/paulyoly/image/160538758 The one on the left, the rear motors are closer together than the fronts.

    See the wobble i’m talking about at 39 seconds. youtube.com/watch?v=uIm0-dQ908s&feature=youtu.be

    These are the pids used in the flight video above. pbase.com/paulyoly/image/160638362 I’m going to try lowering the yaw rate first and see how it changes. The hermit pictures with it above doesn’t share this wobble issue and it has a 1.00 yaw rate. I wanted to get an experts thoughts.

  12. norbert rendes

    hi !
    pls advise me .
    i tried to understand the explanation of PID. i managed to tune my mini quite well i guess, i hoovers and fly nice, but when i yaw it, at the end of the movement it looses a lot of hight at woobles badly. which of the parameters could be wrong? i could not find yaw PID tuning on google.
    also, could you pls explane a bit what are theese “things” in cleanfight PID settings :
    – ROLL (clear)
    – PITCH (clear)
    -YAW (clear)
    – ALT (?)
    – VEL (?)
    – Pos (?)
    – PosR (?)
    – NavR (?)


    – LEVEL
    – MAG

  13. Victor Rodas

    Hello friends,
    I’m a newbie and just have built my first Quad from scratch with a 3D printer. It has a 2.7 flight controller and a Ar 8000 radio, etc. After the firmware was downloaded, it armed and responded well when I tried to make four or five attempts to fly it inside my house, I noticed that those short attempts to take off happened when I moved the throttle stick up while the copter was making uninterrupted beeps and the props were trembling. I tried to fix the props trembling and the noisy beeps by downloading the firmware again, but this time I downloaded it with the all the wires from the props connected to flight controller. Now the quad doesn’t take off even though all the readings are correct on the mission planner and also it is arming both in the computer at home as well with only remote control the open field. Now, it only makes one beep and one fraction of a second movement by the props, but they don’t spin anymore. The GPS works fine because I can see on the screen of my computer a Quad icon right at same spot on the open field where I tried to make it fight in stabilize mode without success. I wonder if this problem related to the PID tuning?
    Remember that I’m trying to learn and any suggestion to solve my problem and put my Quad to fly will be greatly appreciated . Thank you very much

  14. sam

    Thanks for this introduction.

    I have never constructed a quad copter but want to have the flexibility to learn with various PID parameters. Which controller board would you suggest that would enable me to fly in the least amount of time but still afford enough flexibility to learn going forward. I realize I am asking for best of both worlds but would still appreciate your input for a common denominator.


    1. Oscar Post author

      get the Naze32, TONs of tutorials on the internet, should get you in the air in no time :) it offers a really comprehensive list of settings as well.

  15. Ruben John

    hi Oscar..

    could you go into yaw pid tuning in more detail. Because of the horizontal axis it works on in it seems harder to know what to look for when turning up the P, I or D. eg…something like the integral on the pitch and roll axis I can put in a command at a steep angle and see how long it flies hands off that way. How do you do something like that for yaw ?

  16. Siddha Kilaru

    Hello, I am using a kk 2.1.5 with a X525 frame. I have tried many different PID values and my quad just keeps oscillating. Any help :|

    1. Oscar Post author

      any video showing the problem? some first steps to take:
      1. make sure FC is securely installed on the frame.
      2. props/motors are balanced.
      3. Factory reset your FC

  17. BigThunder

    Hi Oscar,

    I am using your PID settings for 5040 props on the Nzae32 and on fast forward flight, it tends to yaw or kick out sometimes.

    What do you suggest on the PID to help resolve this issue?


    1. Oscar Post author

      do you have any FPV footage showing this? it’s easier to tell from video.
      maybe try increasing Yaw P to 11, drop Yaw D to 5 and try again?


    i want to know about using PD controller instead of PID … can you explain the benefits or demerits of it????????
    currently am presenting a seminar on robust optimal control of quadrotor uavs is that your field of interest ?

    1. Oscar Post author

      Hi, maybe you should tell me why use PD controller over PID controller, since you have the idea first :D
      sorry can’t be much a help, I am not an expert in control theory, only come across the subject back in college for a few months :)

  19. Vignesh

    I have got a few doubts…..after reading this wonderful article and watching some other videos on youtube.
    1)P, I and D gain values are present for each of YAW , roll and Pitch which means there are a total of 9 values to be calibrated. But most of the videos show only P, I and D calibration and not for each of the axis. Does that mean that the SAME PID values go for each of the axis so when I calibrate the quadcopter I should set the P ,I and D values at the same time for all the three axis????
    2)I have a problem I am using the hextronik nanowii V01 and using the program Multiwii software to program it and I have set all the parameters correctly in the multiwii program and uploaded it correctly and everything is working right except for one motor output from the board (when I increase the throttle three motors increase simultaneously except for one motor which stays for a while and then increases so at maximum throttle three motors output is 1950 while one motor is 1650) these test is done without connecting the escs to the board and also connecting the escs dont change anything. And actual testing also does the same the quad topples over, and I am pretty sure its not with the ESC’s or Motors or Propellers. or the PID values , but its some problem with the transmitter or the board or the program, I have calibrated the ESC’s both individualy and using the autocalibration from the code, but all efforts in vain.
    3)Also I got a doubt should the motor output from the board change when my transmitter is at a constant throttle and nothing else and I just move the quad with my hands and no ESC’s connected to the board, I am asking this dumb question because from what I observe from the Multiwii GUI I see no change in the motor output when I change the quad in any direction?

    1. Oscar Post author

      1) Generally you need to set P, I and D for each individual axis. But the same principle applies to all 3 axis.
      2) try doing gyro calibration, acc calibration first. use default PID and rates, make sure your radio inputs are all trimmed to the center. Now try again and place the board on a perfectly horizontal surface, test it in “Manual mode” without connecting ESCs, you should have all motor outputs increase at the same time. (if you board is tilted, the motor outputs will be different.)
      3) you should see motor outputs change in this case, make sure you have done step 2 first.

  20. hani

    Hello everyone!
    how connect optical flow sensor to APM2.6 board ? Do the same to connect this sensor to apm2.5?

    I would be happy if the answer!

  21. Anthony

    PID theory is really well explained !
    I’m facing the problem of PID tuning. I’ve implemented the cascaded PID shown in this post. How can I adjust P values of cascaded PID? Should I start from the “Stabilise PID” with P = someValue and “Rate PID” with P = 1 ?

    Thank you for your help

    1. Oscar Post author

      No i don’t think so, it’s obvious that it’s hardware related, most likely to be
      – the ESC not calibrated
      – motors are damaged
      – propellers are out of balance, or damaged.

  22. Wilson

    Nice explanation. I have a yaw problem with my quad. On fast forward flight, it tends to turn sideways on its own. More to the left but sometime to the right. I think I need to increase the P and I setting to the yaw. It hovers solid

  23. Markus

    thanks for this great article.

    When i was flying my quadcopter (scratchbuild with nanowii) it sometimes began to oversteer and crashed.
    But with the I parameter set to 0 it doesn’t happen.

    What’s your thought about it?

    1. Oscar

      I guess you are using Multiwii? Do you mean it can normally fly well, but sometimes it shifts?
      there are a few things to check:

      1. sticks are all tuned to zero when not touched.
      2. sensors are calibrated correctly
      3. the motors / propellers are balanced properly

      also, if you don’t fly acrobatics, try to use Angle mode or Horizontal Mode (auto-level mode), your copter should be much stable.

  24. bogus bob

    Nice article, thank you. I like the tuning part. Might I suggest expanding it with an example of PID values? Right now I have no idea which order of magnitude I’ll be looking for. 1? 0.001? 1000? (Although your description helps to find out, kuddos!)

      1. Tim

        My experience is all chemical process control, BUT the pitch/roll/yaw and maybe altitude are all integrating processes. Meaning if you’re slightly off the error will keep growing (and therefore the P term will keep increasing/decreasing to reach set point). It’s similar to filling a tank that you’re also draining and trying to control level. If the in-flow and out-flow aren’t exactly the same the level will continue rising or falling forever. It’s integrating the error of the two flows on its own. On a quadcopter, if the left/right, front/back, diagonals aren’t perfectly producing the same thrust it will continue to pitch/roll/yaw forever. That would be different than a heater, For a given heat input, the temperature won’t rise or fall forever, it’ll get to a temperature and line out (the other type of control scenario, a self regulating process).

        I’ve never done it, but you could do PD control (or just P) if the integrating error is large (e.g. a small tank or large flows in my tank example where a small difference would quickly change the level) or you don’t care about tight control (you don’t mind if the level swings a bit for the process to naturally integrate to the point the P term corrects things. We have the former for multicopters, but definitely not the latter. Therefore I would be really surprised if you could find some tuning work without I. You’d want to catch that small difference before the multicopter pitched/rolled/yawed to the point the P would catch it.

        What I haven’t figured out yet is why multicopters use D (along with PI). I think of D as undoing all of the I windup as it approaches set point (SP). The process “sees” that it’s on its way to reaching SP, therefore the P term is shrinking but the I term is now really large and still growing because it’s still below SP (or above…). If unchecked, it would likely overshoot and then the I term would start shrinking and eventually it would settle in after a few oscillations. We only use D in chemical process control when there is large deadtime or lag between a change in an input to the process and seeing the response. I’m talking many minutes, if not hours, for us to want D tuning (along with PI). For example, the temperature on a very large tank or distillation operation. In fact these are the only two loops that we would usually even consider D and they’re both self-regulating. I can’t think of any integrating process examples using D. I wonder why it’s used for multirotors since things are moving so quickly? The “I term” should not have “wound up” since it shouldn’t have been off SP for very long.

        After logging some data, I want to approach tuning as we do at work and see what it suggests. The problem is that we’ll usually hold an output fixed, change it, and then watch for a response. Most notably watching how long it takes to see the response to begin to move (the deadtime), and how much it changed by (the process gain). That’s not much of an option for a flying quadcopter, it would be quickly on the ground. There are some on-the-fly tuning tricks but with modern computers and process data collection, it’s become passe. I’ll have to find some old timers to teach me. ;-)

      2. Oscar Post author

        Hi Tim,
        you probably have a much better understanding in PID control theory than me :)
        It’s difficult to explain PID to someone who never studied control theory, easiest way to do that is by using real life examples, for example a quadcopter flight behaviour.
        PID might be slightly different when it comes to implementation, thus how P,I and D affects the system (there are now 6 PID controllers). Not sure how good you are with coding, if you can check out how PID controller is implemented in Baseflight/cleanflight that should help your multirotor tuning.

Leave a Reply

Your email address will not be published. Required fields are marked *

Are you Robot? *

I only check blog comments once or twice a week, if you want a quick reply you can post your question on this forum IntoFPV.com... You might get a faster response from me there (multirotor related only).