0:00

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..

Â