0:00

Okay. So, so far in the course, we have mainly

Â chit-chatted about things. We've seen some models and we have now a model of a, a

Â cruise controller or at least how the controller input affects the velocity of a

Â car. We see it here, x dot was c over m times u. Where x was the velocity, u was

Â the applied input, and c was some unknown parameter, and m was the mass of the

Â vehicle. We also talked a little bit about what we wanted the controller to do. So

Â now, let's start designing controllers. Let's actually do it. No more excuses.

Â What we want, of course, is that x should approach r. And recall, again, that r was

Â the reference velocity that we wanted the car to get to. And x is the actual

Â velocity. And typically, in control design, you talk about asymptotic

Â properties, which is fancy speak for when t goes to infinity. So, what we want, is,

Â after a while x should approach r. The velocity should approach the reference

Â velocity. Or another way of saying that is that the error, so the mismatch or

Â imbalance between the 2 two velocities should approach 0. That's what we want.

Â So, I am going to give you a controller here. This is attempt 1. I have picked

Â some values for, you know, how hard I want to hit the gas pedal. And I'm going to say

Â that, if the error is positive, so positive error means that the reference is

Â bigger than the state, which means that we're driving slower than we should. Then,

Â let's hit the gas. And if the error is negative, meaning that the velocity, the

Â actual velocity of the car is greater than the reference velocity, which means we're

Â going too fast, let's brake. And if we're perfect, let's do nothing. Fine.

Â So, take a second to stare at this and see what you think. Is this going to work or

Â not? Okay, a second is up let's take a look. Yeah, it works beautifully. I put

Â the reference velocity to 70 so it's up here, here is 70. This is the actual

Â velocity of the car and look at what the car is doing. It's basically starting down

Â somewhere and then increasing up to 70 and then it's remaining flat around 70. So,

Â that's, that's awesome. It's doing what it should be doing. Now, I'm calling this

Â bang-bang control and that's actually a technical term from doing things like u

Â max and negative u max. You're switching between two extremes. so this seems to be

Â easy peasy and there's no need to take a course on controls and mobile robots. Now,

Â let's see what the control signals is actually doing. Let's see what the control

Â values were that generated this nice and pretty plot. Well, they look like this.

Â This ladies and gentlemen is miserable. Even though the car was doing the right

Â thing in terms of the velocity, I had u max be a 100, so negative max is minus a

Â 100 and first of all, we are accelerating up for a while, until we hit the right

Â velocity. And then, we start switching wildly between plus and minus a 100. Well,

Â when the error was 0, the u was supposed to be 0, but the error is never going to

Â be exactly 0. Just ain't going to happen, and this is bad, because what's going on?

Â Well, first of all, we get a really bumpy ride. We're going to be tossed around in

Â the car, backwards, forwards, backwards, forwards, because of all these

Â accelerations that are being induced by these, these extreme control signals.

Â We're also burning out the actuators. We're asking the car to respond extremely

Â aggressive and for no good reason. I mean, we're basically doing a lot of work when

Â we're very close to perfect. So, this is actually not a particularly good control

Â design. And the problem is exactly this of overreaction to small errors. Even though

Â the error is tiny, as long as it's positive, we're slamming gas as hard as we

Â can. so we somehow need to change this design. So, how shall we do that? Well,

Â the easiest thing to do is to say, you know what, when error is small, let's have

Â the control signal be small. In fact, here's my second attempt. u is k times e,

Â for some positive k, e is the error. Positive error means we're going too slow,

Â u should be positive. Negati ve error means we're going to fast, u should be

Â negative. So this is a much cleaner design. It's what's called it's, it's a

Â smooth feedback law. It's actually linear feedback in the error, and this seems to

Â be much more reasonable because small error yields small control signals, which

Â is what we wanted. Nice and smooth. We're not going to wildly fluctuate in our

Â controller. And, in fact, this is called a P regulator, where P stands for

Â proportional because the control signal, the input, u, is directly proportional to

Â the error through this k controlled gain. So, here is a completely different and

Â possibly better way of doing it. This is what the P-regulator in action looks like.

Â So, it's nice and smooth, right? It seems even stable. Stable, again, we haven't

Â really defined it, but it's clearly we're not blowing up the course. So, nice and

Â smooth and stable. Now, here is a little problem. You see what it says up here? It

Â says 60 and I had my reference be 70. So, even though we're nice and smooth, we

Â actually did not hit the target value. The reference signal was supposed to be 70,

Â and we got to 58 or so. so even though we're stable and smooth, we're not

Â achieving tracking. And here is the problem. I actually added a term to the

Â model and this is a term that really reflects wind resistance because here is

Â the acceleration of the car, this is our term. Well, if we're going really, really

Â fast, we're going to encounter wind resistance. So, add it a little bit of

Â wind resistance. This says that if we're going positive and fast, then we're

Â getting a negative force, we, meaning, we're being slow down a little bit and

Â gamma is some term or some coefficient that again we don't know. And this was the

Â model I used when I simulated the controller. and somehow, the P-regulator

Â wasn't strong enough to, to deal with this, and in fact, let's see what happens.

Â At steady state, so steady state means when nothing changes anymore, and if for

Â your call from the plot, after awhile, x stopped varying. At steady state, x is not

Â varying. Well, another way of saying that, is that the time derivative of x is 0. So,

Â at steady state, x is not varying, which means that this term here has to be equal

Â to 0. And this is the model right? Well, I know what u is. u is equal to k times

Â error, which is r minus x. So, I'm plugging in u there. And I'm saying that

Â this thing has to be equal to 0. Well, if I write down the corresponding equation

Â now that says that, this term here has to be equal to 0, then I get this. Well, I

Â can do even better than that. What I get is that x, let me get rid of the red stuff

Â there, x is now going to be, ck divided by ck plus m gamma times r, and this, for all

Â these coefficients being positive, is always strictly less than r. Which means,

Â that at steady state, the velocity is not going to be, it's not going to make it up

Â to the reference velocity. And we can see that if we make k really, really, really

Â big, then these two terms are going to dominate and we're going to get closer and

Â closer to having this complicated thing, go to r. So, as k becomes bigger, we're

Â getting closer to r, which means we're having a stronger gain. But we're never,

Â for any finite value of the gain, going to actually make it up to the reference. So,

Â something is lacking and next time, we're going to see what it is that is lacking to

Â actually achieve tracking and stability.

Â