What is the point of tuning PIDs?

pungbjoern

Senior Member
Is there such a thing as "correct" PIDs for a given airframe/motor/ESC combination, or are PIDs more personal? Do you tune PIDs to suite your flying style? Is there an inherent advantage to "high P" or "low I" or whatever the case may be?

Clearly tuning PIDs is a really big deal, but I haven't yet understood why. As an example, when I took my latest quad out for its maiden voyage, there were no oscillations or anything like that. Sure, the yaw was off, but I alter that with the yaw rate, not the PIDs. I perfectly understand why you'd tune pitch/yaw/roll rates, but why tune PIDs? I get that PIDs need to be tuned, but beyond getting rid of oscillations, why is it done?
 

ZoomNBoom

Senior Member
Because PIDs determine not only low and high frequency oscillations, but also how swiftly your quad reacts, how much/little it will drift, how well it locks its attitude. ITs entirely possible with stock PIDs yours flies well (after all, stock PIDs are chosen to at least work in most cases) , but it doesnt happen often.

And no, there are no ultimate "correct" PIDs for a given frame, some of it is down to preference, but nobody will prefer a badly tuned quad over a well tuned one.
 

pungbjoern

Senior Member
Along which axis to you judge "tuned", though? That's what I'm asking. Is that an objective or a subjective axis. Will you and I judge a set of PIDs differently?

Looking at people talking about PIDs, they say things like "tune to the highest value where everything goes wrong, then back off". This implies to me that you want high values for things. What's the inherent benefit of high values?
 
Last edited by a moderator:

ZoomNBoom

Senior Member
Simply put, high values = "more" control. If your PIDs are low, the quad will react sluggish, not only to control input by the pilot, but also to external factors, like wind, turbulence or even self induced instability. The result is a quad that will wander around, doesnt listen well to control input and doesnt hold its attitude (not to be confused with altitude). That those are not good things, Id hardly call that subjective.

On the other extreme, with too high values, you have quad that will be too twitchy, wobble or oscillate, and potentially go out of control. Again, hardly subjective.

Inbetween you can have many variations that could be considered well tuned. Some may like more dampening than others, some may like a more robotic instant response while others will prefer some smoothness. Thats subjective and will depend a lot on things like your flying style. What works for me, is not gonna work for finalglideaus
 
Last edited:

pungbjoern

Senior Member
Simply put, high values = "more" control. If your PIDs are low, the quad will react sluggish, not only to control input by the pilot, but also to external factors, like wind, turbulence or even self induced instability. The result is a quad that will wander around, doesnt listen well to control input and doesnt hold its attitude (not to be confused with altitude). That those are not good things, Id hardly call that subjective.

On the other extreme, with too high values, you have quad that will be too twitchy, wobble or oscillate, and potentially go out of control. Again, hardly subjective.

Inbetween you can have many variations that could be considered well tuned. Some may like more dampening than others, some may like a more robotic instant response while others will prefer some smoothness. Thats subjective and will depend a lot on things like your flying style. What works for me, is not gonna work for finalglideaus

I see. that's good information, thanks =)
 

Robbie

Senior Member
I can't decide whether FGA is busy prepare a hell of an argument to shut this thread down in one foul swoop or whether he just sees it as below him and not worth his time.

I guess we will have to wait and see...
 

Cyberdactyl

Misfit Multirotor Monkey
Here's an old video explaining how the extremes of PI control looks. This was made before most of us were even into multirotors.

 
Last edited:

LooseBruce

Senior Member
Hi, I don't fly multirotors but I was an instrument tech and teacher in industry before I retired, In control scenarios PIDs can be very helpful and confusing.
A simple way to think about them is this:

Your control system is trying to correct something that has already happened.

Because of this the correction is LATE. When the correction goes into effect (fractions of a second in your case) it may overcorrect or undercorrect causing oscillations. PIDs help to prevent this. They are very sophisticated algorithms they take in to account mass, speed,stored energy etc. and are designed to tighten control without inducing oscillations.

In industry there are folks who specialize in tuning PID loops for control.
LooseBruce
 

Robbie

Senior Member
it must have been so hard for the first quad copter flies who used wii circuit bords and had to design all of the pids
 

jhitesma

Some guy in the desert
Mentor
The point of tuning PID's is to optimize the feedback loops so that the controller is able to stabilize the craft.

That doesn't mean auto-level, it just means stabilize as in hold the same attitude in 3D space.

The better the PID's are tuned the more accurately and quickly the loops are able to stabilize the craft. So instead of "hunting" for it's position and oscillating it just holds.

When your PID's are well tuned in calm air you should be able to hover hands off in rate/acro mode.

I'm not a big fan of adjusting PIDS to get a different feel - that's what rates and expo are for - at least in a macro sense. On a smaller level PIDs can be adjusted for different feel...but I'd rather have a tight accurate control loop handling stabilization even if I want to fly soft or loose - I'd just dial back rates and dial up expo if that was what I wanted. Some people like to soften the loop to get a softer feel...and to some extent that's ok. But for gross changes I'd still say it's the wrong approach.

When I'm tuning my goal is to optimize that feedback loop so instead of hunting for it's equilibrium it just lands right on it and holds it. That's what gives the "locked in" feel most people are after.
 

Snarls

Gravity Tester
Mentor
I'm not going to give you a technical explanation of PIDs, but I will try to convince you to give tuning a try. When I first started flying my mini quad (like a month ago) I though the stock PIDs had me set. The quad sat well in the air, there were no oscillations, and I was able to fly around my yard well. When I started flying FPV I noticed small tendencies. The quad would wobble a little in ascents in descents, and looking at my recorded video I would see that I was constantly adjusting the attitude of my machine to keep it flying where I wanted. I spent a lot of batteries and days tuning, but when I was done (more like satisfied because you're never done tuning) the quad felt like it flew on rails. The video is much smoother and me and the multirotor feel much more natural together, rather than constantly fighting each other. As you get closer to the right tune it starts to become all about the little things. There will be small oscillations after rolls that you will want to tune out, or maybe you are sliding out in tight turns. If you're new to flying you might not notice these things, but as you progress to more demanding maneuvers you will want these tendencies removed.

If anything, you might feel like your quad flies great now, but once you try getting a unique tune for it you will find you can make the machine much more stable and you will be a lot more comfortable flying it.
 

Robbie

Senior Member
Is there such a thing as "correct" PIDs for a given airframe/motor/ESC combination, or are PIDs more personal? Do you tune PIDs to suite your flying style? Is there an inherent advantage to "high P" or "low I" or whatever the case may be?

Clearly tuning PIDs is a really big deal, but I haven't yet understood why. As an example, when I took my latest quad out for its maiden voyage, there were no oscillations or anything like that. Sure, the yaw was off, but I alter that with the yaw rate, not the PIDs. I perfectly understand why you'd tune pitch/yaw/roll rates, but why tune PIDs? I get that PIDs need to be tuned, but beyond getting rid of oscillations, why is it done?

Look i will be honest with you, I know how PIDs work and I reguarly tune my quod for different flight characteristics. However in all honesty some of the best flying my quad has done is when I directly copy and pasted borris B's PIDs. They worked great and flew really well.

That is what i would recomend most people do. Take someone elses PIDs for a quad which is similar to your and then tune from there. Saves time and effort.

Robbie
 

makattack

Winter is coming
Moderator
Mentor
In some ways, stock/default PID's are like flying a RTF you might get from a toy company or something like the nanoqx/dromida/hubsans of the World... you get what the original manufacturer / designer gives you. If you build your own quad, it sort of follows you probably want it to fly the way you want it, not something that might "work for most"

I'll add that my latest interest in flight controllers started with fixed wing aircraft, and you really need to customize the PID's in those as the defaults are generally made for a very safe, non-acrobatic flight envelope. So much so that you'd be a little stressed out with the turning radius if you weren't in a wide open area.
 

ZoomNBoom

Senior Member
I'll add that my latest interest in flight controllers started with fixed wing aircraft, and you really need to customize the PID's in those as the defaults are generally made for a very safe, non-acrobatic flight envelope. So much so that you'd be a little stressed out with the turning radius if you weren't in a wide open area.

I have the opposite experience. PIDs on a plane arent nearly as crucial, because a plane is inherently stable (most planes anyway), and so they tend to just fly without controller and even without control input. Often despite the stupid control input of the pilot. Yeah, I know, not forever, but a quadcopter without flight controller wouldnt last 5 seconds, probably not even with a skilled pilot.

Thats not to say there isnt a ton to configure on plane flight controllers with something like the pixhawk I believe you are also flying, but thats not just to fly, thats mostly to navigate. As illustration, have you seen where the acro mode PID's and gains are in ardupilot? AFAICT, there are none. You can configure roll and pitch rates, thats about it. The other 1000 or whatever parameters are for other things. That turning radius you mentioned, isnt a PID loop, its just a value.
 

ZoomNBoom

Senior Member
The video is much smoother

Word! I recently saw a video you posted elsewhere, and yours is possibly the smoothest miniquad free style video Ive ever seen. Let me post your latest for others to judge:


Did you do any post processing stabilization on that ? Even if you did, I dont get mine to look half as smooth.

btw, you really only started a month ago ?

Wow!
 

Ocean

Member
Word! I recently saw a video you posted elsewhere, and yours is possibly the smoothest miniquad free style video Ive ever seen. Let me post your latest for others to judge:


Did you do any post processing stabilization on that ? Even if you did, I dont get mine to look half as smooth.

btw, you really only started a month ago ?

Wow!

Ummagawd is another great 'smooth' flier.


I remember there was a good 4 page discussion on whether he used a gimbal or not.

PS: Can we please have a sticky on how to tune? It comes up so often.
 

Snarls

Gravity Tester
Mentor
Did you do any post processing stabilization on that ? Even if you did, I dont get mine to look half as smooth.

btw, you really only started a month ago ?

Wow!

Thanks! No there is no post stabilization going on. I actually feel like I have had it smoother in the past with higher I gains, but I have them lowered currently because I had to tune out some weird oscillations.

I started flying my miniquad and FPV at the beginning of July so really it has been closer to one and a half months. Prior to that I had never flown FPV, but I had some hours flying my AP quad LOS and during the school year I flew exclusively on a simulator.

I think getting smooth video is large part tuning, but it is also large part the ability to add really calculated control inputs. Getting the machine where you want it to go without having to add input to correct a previous input. And if you are heading towards an obstacle you have to refrain yourself from adjusting anything and just pray it works. I'm still working on this kind of stuff.
 

Cyberdactyl

Misfit Multirotor Monkey
I remember there was a good 4 page discussion on whether he used a gimbal or not.

It's kind of difficult to tell if there's servo leveling of the camera if the multi stays at a relatively constant speed and stays in a fairly tight altitude window, as that video does.
 

Ocean

Member
It's kind of difficult to tell if there's servo leveling of the camera if the multi stays at a relatively constant speed and stays in a fairly tight altitude window, as that video does.

I agree, however IMHO designing and tuning firmware to make it stable but not stable enough to arouse large amounts of suspicion would be harder than flying the quad smoothly itself :)