Servers by jDrones

General Questions about PID / InnerLoop


(CN) #1

Hello everybody,

I’m completely new to this forum. Now, I will learn more about the PID Setting and “InnerLoop”. For my understanding, with a changing in the PID Settings, I directly change the InnerLoop. Is it correct?

All FlightModes based on the StabilizeMode. So, I have to tune the PID Settings in Stabilize? Or does I have to use the AcroMode?

For example, I have to be sure, that if I say the UAV has to fly with 4m/s in a AutoFlight, it has really to fly with 4m/s and not 4m/s for 1 second and 4,5m/s for the next second.

Also, if the UAV has to fly with an angle of 30degree for example, it has really to fly with 30degree and not 33degree.

So, the I-Term of PID Settings has a big influence to hold the right angle for the whole flight. Is there any documentation, where I can read and learn about this things? Or can somebody explain me the basics of that?

Thanks a lot for your help guys and always a safe flight for everybody!


(rmackay9) #2

@CN,
Here’s some wiki pages that might help a bit:

Hope that helps…


(Eduard Mráz) #3

Hello @Copter_Newbie ,
I found this on wikipedia, which I couldn’t say better in my own words, so:

“PID controller continuously calculates an error value e(t) as the difference between a desired setpoint and a measured process variable and applies a correction based on proportional, integral, and derivative terms (sometimes denoted P, I, and D respectively) which give their name to the controller type.”

I guess you are able to look for some video on YT, which shows, how each term (P,I,D) affects the process of controlling.

So to the core, you’re asking if I-term has a big influence on “holding the right angle”. I would say yes, because the longer the error in output persists, the more of a correction is applied. BUT! If the P-term is set too high, the longer it would take to minimize the error. What I was trying to say, there is no one and only key feature to set to perfectly tune your COPTER.

To conclude - I strongly recommend you to read the documents given by @rmackay9, there is a plenty of useful tutorials and videos, even the basics of understanding how PID works.


(CN) #4

Hey guys,

at first, thank you very much for your answers. For sure, I will study all this documents, given by @rmackay9.

Which parameters in the logfiles are the most important to check the right PID values? So, with the logfiles, it should be possible to find very good settings, or?

Thank you guys!


(Eduard Mráz) #5

Hello again,

I am not sure, if I understand exactly what you’re asking. You should check if your desired values are right (angles, speeds…). You do not need to check PID values. If desired values are fine, you don’t need to care about PID settings.


(CN) #6

Hi,

sorry for my delayed answer. Yes, I understand your message. My question is which settings influence the angles and speed?

For example with “P”, I change the “power” to hold the angle. If the angle moves/change after a few seconds, which value will have influence to hold the desired angle? “I” will react for wind influence and so on. So, if it not hold the exact angle, I have to increase “I” to hold it better with influence from weather/wind, right?

What is the exact task from the “D-Term”? I read a lot but I’m not pretty sure how it will works in real. “Looking to the future”? In a world without any influence from wind/weather/gravitiy changes and so on, we wouldn’t need “I & D”, right?

Thank you very much for your help!


(CN) #7

Hello everybody,

attached two screenshots of the logfile about DesiredPitch to Pitch and DesiredRoll to Roll.

Does anybody see a possibility to change some settings to bring the graphs close together?

For me it looks not to bad but the final goal should be a identical graph, or not?

Thanks a lot!


(CN) #8

It looks that the graphs in “Stabilize and AltHold” are closer together as in “Loiter”.

For the moment, I didn’t understand why this is. The flight was with the Firmware 3.5.0-rc11. Vibrations are pretty good.

Thank you guys for your help!


(CN) #9

Does anybody have an idea to get better/closer graphs?

Thank you guys!


(Eduard Mráz) #10

Hello,

With this one, you are mixing two different things. PID Controller, theoretically, is designed for ideal conditions. Wind, in this case, is considered as a noise. Lets divide noise to two main categories for this purpose: Measurable and unmeasurable noise. Wind is noise which you cannot measure in this case. Maybe you can read on something on this too.

Again, PID control loop as works as one system. Each (P,I,D) component controls one output. It does not work separately.

As for the graphs, it is only matter of “tuning” of PID control. Try autotune/whatever is available for PID tuning in mission planner or so.

Maybe I finally understand what you are thinking. In mission planner->config/tuning->APM:Copter Pids there are several setting for example: “Stabilize Roll” and below you can set P value. This does not mean, that P component of controller affects Roll. It means that controller used for stabilizing roll is “P” type. Then you have other controllers to control different parameters. PID controller does not necessarily need to have all 3 components - it can be P, PI, PD, PID (ID does not makes sense)… - all combinations.

I hope this is clear enough,
Have a nice day


(ppoirier) #11

QuadCopters are highly nonlinear systems, so we cannot expect having perfect control loop matching across the operationnal range, and much of the settings are determined experimentally ( or AutoTuned).

PID can inject a lead and a lag in the control loop, and you have to understand where the nonlinear system needs lead for stability (PD) and where it needs lag (PI) for steady state response.