Understanding PID's

Bartman

Welcome to MultiRotorForums.com!!
Well, I guess it's about time I try to wrap my head around the finer points of PID's. I understand the fundamentals of closed loop control systems but the details of PID's are long lost from my college days.

So here's a link to start things off. If anyone has another link to share or maybe knows of a video tutorial please post it here.

http://www.expertune.com/tutor.html

Bart
 

Bartman

Welcome to MultiRotorForums.com!!
Copied from rcgroups x650 thread

X650 utilizes PID algorithm to maintain stability.PID (Proportion Integration and Differentiation) is a control method in Automatic Control Area. The PID control process:



On the graph, X-Axis represents Time, Y-Axis represents error. PID aims at zero error. As to X650, zero error means flight balanced state and specific attitude (controlled by FC) which is generally called as stable state below.

Assumptions on XAircraft FC design:

Assume aircraft flies stably as a general rule, which means FC outputs control signal to motor when it finds frame tilts for a stabilization recovery. We take this not-RC tilt as errors.
According to the previous flight states, on condition that it’s just vibration when tilt occurs, can still be regarded as the stable state.
When aircraft tilts to a certain direction, it will engender a tendency which could be probably reinforced.
Notice: Assumption2 is not contradictory to Assumption3.

We haven’t built X650 mathematical modeling, which needs to do the PID Tuning through personal sense. It is suggested users grab aircrafts on the ground when tuning which takes patience and skill. It can only get a comparatively ideal value after times of tuning. When on PID Parameters Tuning, Please do be careful.

In addition, before you correct the value, users can see how FC reacts to tilts under different push on aircraft by hand.

PID, Proportion Integration Differentiation intuitive function:

P (Proportion): A gain factor whose value reflects system response speed directly can make aircraft return to a stable state as quickly as possible. When X65O tilts to a certain direction, it gets weaker resistance under a too small P value and reacts strongly under a too big P value.
I (Integration): On the base of assumotion2. It determines how much FC depends on the past flight state. Aircraft will over-depend on current error under a too small I value to inhabit anaphylaxis leading to a bumpy flight and largely weaken the capacity of system response to error under a too big I value, which makes delayed reaction.
D (Differentiation): On the base of assumption3. It determines how much FC depends on current tilt (error) tendency. Its value can inhabit contingent tilts effectively. Users will consider X650 does not response sensitively under a too small D value, while it can cause” anaphylaxis” under a too big D value. Compared to P, D emphasizes on reflecting X650 susceptibility while P reflects intensity on error correction.

It’s advised under a P->D->I order when setting PID and trim referring to parameters under already fly stable state. Users interested in tuning can try as steps below to see how aircraft reacts under P, I, D parameters.

Adjust P, aircraft can oscillate to stability when on appropriate P area but can’t fly off ground.
Adjust D, aircraft can leave the ground when P and D’s value are appropriate in theory. But it flies unsteadily with a little “anaphylaxis” which needs to tweak P for the accomplishment.
Adjust I, aircraft can fly stably comparatively when I value is appropriate.
Tweak P, I, D for different operation at personal will.
 

brendonvz

Member
interesting :

Anaphylaxis is a severe, whole-body allergic reaction to a chemical that has become an allergen.
 
Last edited by a moderator:

matwelli

Member
Im an instrument tech by trade, PID tuning is one of our "things"

The below might help :)

Error - diference between what you want, and where you currently are

Proportional ("P" from PID) is the "gain" or multiplication factor, basically alters the control output by the Error multiplied by the gain

Integral or "Reset" ("I" from PID) Proportional will get you in the right direction, integral gets you to the finish line, after the "Proportional" bit has done its bit, integral slow sneaks the control values up to get to to where you want to be.

Derivitive ("D" from PID) is the bit that looks to the future..... it looks at the error, looks at how fast you are moving towards where you want to go, and starts backing things off to stop you from over shooting.


To much "P" or Gain , you will see oscillation

To much "I" you will see it fly well past set point "integral windup" as it over compensates, followed by undershooting, ad so on, looks like oscilations, but much slower.

To Much "D" you will see your multirotor attempt to correct, get part way, stop, and then go again, sort of two steps forward, one back. not enough D, you will get over shoot.

Always Adjust P first, then add I to get things back to set point, play with D last
 

Matt -

I am tuning the PID's on a new, small quad that is using an FC "very similar" to an MK FC 2.0 and that uses the 'flyboard' i2c converter.

When I leav it on stock settings, it flew a little 'soft' and it wanted to wander all around my backyard. I lowered Gyro P to about 90, and increased Gyro I to about 140, and it flies so nice and tight! I love it - very quick 'return to level' with zero oscillations.

BUT - after setting it into a hover and letting it hang, it inevitably starts to head off in one direction on the other. I have carefully trimmed it (via TX) to try and keep it in one spot, and I can get it to stay put for a moment or two. But it starts to drift (with no wind) one way or the otherh and the drift increases in speed the longer I leave the controls untouched.

Do you have any advice on what setting in MKtools should be changed to minimize this drift . . . and which direction (increase number or decrease number) it should go?
 

CopterCam

Member
Mat,

Excellent explanation using laymans terms............. now all we need is a phone App.to help us tune from the site ?

Sid
 

Macsgrafs

Active Member
I've learnt something today, thanks Bart, Mat & others..I didnt know what PID was, but I do now....I'll leave this to you tech bods :)

Ross
 

matwelli

Member
@drone builder - sorry dude, never touched MK

All multi's will drift slowly, its impossible to get exactly level and dead calm air :- does it always drift in one direction ? possibly the accelerometers are off by a degree or two
 

That is a great explanation Mat, I might lift it as someone was asking just such things on the OP forum.

Well over at OP we are building a library of all the initial testers PIDs and then hopefully we will be able have some handy pointers for tuning base figures. You can already tune in flight if you have a pair of Xbees and somebody to fly the platform for you.

Lets hope we are not far away from autotune ;-)
 



Bartman

Welcome to MultiRotorForums.com!!
Im an instrument tech by trade, PID tuning is one of our "things"

The below might help :)

Error - diference between what you want, and where you currently are

Proportional ("P" from PID) is the "gain" or multiplication factor, basically alters the control output by the Error multiplied by the gain

Integral or "Reset" ("I" from PID) Proportional will get you in the right direction, integral gets you to the finish line, after the "Proportional" bit has done its bit, integral slow sneaks the control values up to get to to where you want to be.

Derivitive ("D" from PID) is the bit that looks to the future..... it looks at the error, looks at how fast you are moving towards where you want to go, and starts backing things off to stop you from over shooting.


To much "P" or Gain , you will see oscillation

To much "I" you will see it fly well past set point "integral windup" as it over compensates, followed by undershooting, ad so on, looks like oscilations, but much slower.

To Much "D" you will see your multirotor attempt to correct, get part way, stop, and then go again, sort of two steps forward, one back. not enough D, you will get over shoot.

Always Adjust P first, then add I to get things back to set point, play with D last

Mat,
I missed this post when you first wrote it. Thanks for the explanation, which was the best plain-language lesson on PID's that I've seen yet.
I dropped my X650 into some sand today so it'll be a few days before I can play with the settings but your post will make it easier to figure out.
Thanks,
Bart
 

matwelli

Member
@crash - depends on what "mode" you are flying.

In acrobatic, the transmitter sticks are essentially telling the Flight Controller what the desired speed of rotation is, and the gyros are measuring the actual speed of rotation, so the P or gain factor holds true in this case.

In other modes, the Acelerometers are the primary measurement source, when the transmitter stick input is telling the flight controller the desired angle of attack.

But to be honest, i dont know exactly how each of the FC prgrammers deal with P,I,D - my post was tying to explain what they mean in general terms :)

@ gary - let me tidy it up a bit first

@ bart good luck with the tuning.
 

In addition to MatWelli's comments, I had the pleasure of introducing Dr. Greg Shinsky at a public forum here way back around 1982. He wrote the bible on PID loop control for Industrial applications dealing with auto-reset windup, feed forward control etc. quite a genius! Once one gets beyond the simple proportional control, the realm of Reset and Rate, i.e., Proportional and Derivative are within the world of calculus.... the science and physics of motion. There are also some exceptional DVD video training programs on this within the "Great Courses" DVD material which I am trying to get my son to take seriously before he heads off for University Engineering etc.

Unfortunately within the RC Hobby, MR and Brushless Gimbal world, there have been some deviation from Greg Shinsky's basics on PID loop control that really throws me for a loop especially with tuning strategies. Regardless, I chose to focus on adjusting the torque parameters for my Martinez BGC to get rid of the small ripples and didn't even need to go near the PID loop tuning. Inadequate motor torque leads to the camera drifting or falling away. Too much torque leads to the ripple...... somehow this sort of relates to deadband so to speak.


Im an instrument tech by trade, PID tuning is one of our "things"

The below might help :)

Error - diference between what you want, and where you currently are

Proportional ("P" from PID) is the "gain" or multiplication factor, basically alters the control output by the Error multiplied by the gain

Integral or "Reset" ("I" from PID) Proportional will get you in the right direction, integral gets you to the finish line, after the "Proportional" bit has done its bit, integral slow sneaks the control values up to get to to where you want to be.

Derivitive ("D" from PID) is the bit that looks to the future..... it looks at the error, looks at how fast you are moving towards where you want to go, and starts backing things off to stop you from over shooting.


To much "P" or Gain , you will see oscillation

To much "I" you will see it fly well past set point "integral windup" as it over compensates, followed by undershooting, ad so on, looks like oscilations, but much slower.

To Much "D" you will see your multirotor attempt to correct, get part way, stop, and then go again, sort of two steps forward, one back. not enough D, you will get over shoot.

Always Adjust P first, then add I to get things back to set point, play with D last
 

Top