So, last time we saw that the PI regulator, or its slightly more elaborate

brother, the PID regulator, was enough to make the cruise controller do what it

should do. Which is, achieve stability, tracking and parameter robustness. Today I

want to talk a little bit more about PID control.

And, the reason for that is, this regulator is such an important regulator

or controller that's out there in virtually every industry you can think of,

there is a PID regulator going on underneath the hood in almost all

controllers. And, there are really three knobs you can tweak here. One is KP, which

is the proportional gain. The other's kI which is the integral gain and then kD

which is the derivative gain. And I want to talk a little bit about what are the

effects of these gains? Well first of all P As we saw. It's a contributor to

stability. In the sense that, it makes the system, not guaranteed. But it's helping

out to make the system stable. And it's, it's making it responsive in the sense

that. You respond if someone, if you click, or press 70 miles per hour on your

cruise controller. It drives the system towards that value. I'm calling it medium

rate responsiveness. Because it's not super fast. And the speed. In fact, the

rate of responsiveness is a function of how big kp is. But as you saw, it wasn't

typically enough to achieve tracking. But the I component is really. Good for

tracking and in fact if your system is stable than having an eye component is

enough to assure tracking in almost all cases. It's also extremely effective at

rejecting disturbances so that integral part is a very effective Part to have in

your controller. Now it's much slower in the sense that you have to accumulate over

time errors to respond to them because it's an integral. So it, it re, responds

slower and there is a very there is a little bit of a warning I need to make

there, by making k i large. You may very well induce oscillation so this is not, oh

I'm going to pick all of the Them. A million and go home. Yo u have to be a

little careful in how you actually select, select these gates. Now the d part, well,

since it's not responding to actual values, their values but the change is in

their values, it's typically faster responsiveness, so something is about to

happen. Well, the rate is changing so the, the derivative part kicks in typically

faster. now there is a little caveat to this. And that's the derivative is

sensitive to noise. Because if you have a signal that's noisy then if you compute

the derivative of that signal you're going to get rather aggressive derivatives that

don't necessarily correspond to what the non noisy signal would be. So you have to

be a little careful with the d part. So making KD too large is typically an

invitation to disaster because you're, you're over reacting to, to noise. So, the

last thing I want to point out though is when you put this together you get PID

which is already by far the most used low level controller. Low level means whenever

you have a DC motor somewhere and you want to make it do something Somewhere there is

a PID leak. Whenever you have a chemical processing plant for getting the right

concentrations in your chemicals, somewhere there is a PID regulator. It's

almost everywhere there, or in almost all control applications, PID shows up under

the hood in some form or another. But, I do want to point out, that this is not a

one-size-fits all. We can't guarantee stability with a PID regulator. Sometimes

it's not enough. In fact, when we go to complicated Robotic systems, the PID

regulator will typically not be enough by itself. So we need to do a lot of more

thinking and modeling to, to use it and at this point we actually don't really know

how to pick these gains. However, I want to point out that this is a very, very

useful type of controller. And since it is a feedback lob because it depends upon the

error it actually fights uncertainty model parameters in a remarkable way and the

feedback has this remarkable ability to overcome the fact that we don't know

gamma, we don't know c, we don't know m. But still, we seem to do well when we

design controllers for a wide range of, of these parameters. So having said that,

let's hook it up to our car and in fact we had a PID regulator for velocity control

on the urban challenge vehicle, Sting 1 as it's called. We had this model that we've

already seen, and I pick It's completely random and arbitrary numbers here for the

parameters. I even put r equals to 1, so we're going to go 1 mile per hour. let's

say 1 meter per second. it really doesn't matter These are arbitrary values. Just so

you'll see what's going on. So, if we start with our friend The p regulator so

we have kp = 1 here and all the other gains are 0 then well, we don't actually

make it up to 1 we only make it 2 - 0.1. This we had already seen. So the p part by

itself was not enough to, to both be stable and achieve tracking. Well, that's

Ok in the i part. It's cruise-controller again kp is 1, kI is 1 and now we are

having a very nice so called step response which means we are responding, we are

waking up and then we are hitting it with a step, in this case the step of height 1

or 70 if its 70 miles per hour. so then this thing makes it's way up and it stays

up there perfect. So this is actually a good and successful design right here. Now

,if this is so good why don't we make ki higher to make it even better? Well if I

To crank up KI to 10. Then, all of a sudden, my system starts oscillating. So

this is an example of where the integral part may actually cause oscillations.

Which is, we should at least be aware of this fact. And be a little careful when we

tweak our parameters. And if we see oscillations That is a. Clear indication

that the integral part is typically a little bit too large. What about the d

part? Well, let's add the d part. In this case, it actually doesn't matter too much.

What you see here is that I had a small d part. I'm a little bit paranoid when it

comes to large kd terms because they are a little bit Noise sensitive.

But what you're seeing here is that you're getting a faster initial response because

of the introduction of a D part, but then, we actually get almost a slower response

towards the end so the D part is there to drive it well up in the beginning, but

then So were stand in this particular application, having a d gain that's not

ser, it's not even clear if that was, was useful. But this is some of the thinking

that goes into tweeking PID regulators. So what we are going to do next time, is

we're going to go now, from this rather abstract, integrals and derivatives, to

something that we can actually implement. And we're going to see how these PID gains

show up when we control a the altitude of a hovering quad regulator..