Sunteți pe pagina 1din 3

3/19/2019 A Beginners Guide to PIDs - Mini Quad Club

   

Explaining PID Tuning in Simple Terms

A PID controller (proportional-integral-derivative controller) is a control loop feedback mechanism widely


used in control systems. A PID controller calculates an “error” value as the di erence between a measured
variable and a desired set-point. The controller attempts to minimize the error by adjusting the control
inputs. (Seriously, this de nition is completely useless for us non-academic people ;-p )

[http://www.miniquadclub.com/wp-

content/uploads/2015/03/10952846_10200327488345995_3365343126138724286_n.jpg]
In multicopter terms this means the PID controller will be taking data measured by the sensors on the ight
controller (gyros / accelerometers etc) and comparing that against expected values to alter the speed of the
motors to compensate for any di erences and maintain balance.

The PID controller calculation algorithm involves three separate constant parameters, the proportional, the
integral and derivative values, denoted P, I, and D. Heuristically, these values can be interpreted in terms of
time: P depends on the present error I on the accumulation of past errors D is a prediction of future errors,
based on current rate of change Depending on your ight controller there will be PID’s associated with a
number of ight modes.

[http://www.miniquadclub.com/wp-

content/uploads/2015/03/11094290_10200327488385996_3880111989918029409_n.jpg]
PID in More Simple terms

https://miniquadclub.com/a-beginners-guide-to-pids/ 1/3
3/19/2019 A Beginners Guide to PIDs - Mini Quad Club

Still don’t get it? Don’t worry, let’s just get practical here, all you need to know is how to tune
 PID
 settings.
 
This is a general description what PID is, how it a ects quadcopter performance still depends on how the
algorithm is written. For example in Clean ight rmware, there are three PID controllers and they each
performs di erently.

What is P?

P is the main value you worry about, which is the number for stability. Why do I say that? You can actually
leave I and D values at 0 and your plane will hover just ne. So that is why you always tune P gain rst
before I and D.

The higher the P the harder it tries to stabilize the plane. But if P is too high, the quadcopter becomes too
sensitive, and over-correct itself, you will have oscillations (with high frequency).

Not all oscillations are from P being too high though. You need to eliminate vibration as much as possible
from your quadcopter before you can even start tuning, for example the motors, frame rigidity etc. With a
vibration free copter, you can set a much higher P gain and enjoy more stability, and controlability.

What is I?

Okay now you have tuned P gain, leaving I and D at zero. When you are ying you will notice that you have
to hold the pitch/roll stick to get the machine to move, as soon as you let go of the stick the machine just
breaks and stay in hovering again. It might even cause a few osculations if the change of control is rapid.

That is because your P is doing its job, trying to stabilize your quadcopter. Look at I gain as the stick
follower, by adding a little I gain you will nd that the plane will now y forward more smoothly. But the
side-e ect is when you let go of the stick the copter will keep on ying to that direction. This is the e ect of
I, keeping the last stick position.

To understand it, think of the quadcopter is trying to reduce the position error, but the error is not
reducing, it will just keep trying! This is the e ect of the I term. In technical terms, it is integrating the error
over time, the longer the error persists, the greater the force is applied. When the I gain is not zero, a small
error can persist forever.

Some people use I gain to make ying more smoothly, while some people purely just like this “stick
following” behavior. However with too much I your quadcopter will start to oscillate with a lower frequency,
even tend to dive to the ground if not careful.

What is D?

D isn’t very useful to many people. In fact you can ignore D completely and your multicopter will y just ne.
That’s why the KK2 does not allow you to tune D, because they want to make it really simple and e ective,
without D it’s not going to a ect the ight performance too much. D is sometimes used to get rid of the
jerkiness of the quadcopter movement.

D is like the opposite of P. If P is a hand to keep pushing the machine back to a stable position, then D is a
spring between the hand and the machine, which absorbs the shocks . By adding D gain, you can “soften” it
a little just like adding a spring to it. However too much D is not good because again, it will introduce
oscillations. Also your copter will be really sluggish.

Basically, D changes the force applied to correct an position error, when it sees a decrease or increase in the
position error. Just like if you are hungry, you eat a lot faster, when you are nearly full, your eating will slow

https://miniquadclub.com/a-beginners-guide-to-pids/ 2/3
3/19/2019 A Beginners Guide to PIDs - Mini Quad Club

down. That’s why you see a softer movement in the quadcopter when D is used.    

Conclusion
Here is how I setup my Naze32 FC.

I realize tuning PID values is just to nd the balance between the moment of inertia of the multicopter, and
the force generated by the motors. The moment of inertia is related to how heavy the quadcopter is, how
the mass is distributed, and how rigid the frame is. Therefore PID gains are di erent settings for each
individual quadcopter, because they all have di erent frames and masses.That’s exactly why for the pre-
built quadcopters, they y so well straight out of the box for example the DJI Phantom, because they have
exactly the same setup so they can all use the same PID settings.

So there you go! Don’t forget to look at the hardware side of things before tuning PID. When you
quadcopter is not stable, there could be a lot more other issues, might be the props, the motors or the
frame, might be carrying too much weight, or the weight is not distributed evenly on the frame. There are
just so many other issues that will a ect the machines besides PID.

© Copyright 2014 - 2018. Mini Quad Club. All Rights Reserved.    

https://miniquadclub.com/a-beginners-guide-to-pids/ 3/3

S-ar putea să vă placă și