0:01

Hello, and welcome to Glue Lecture Four.

Â I'm Smriti Chopra, your instructor for the Glue Lectures, and let's get into it.

Â So this lecture is titled Controllability and Observability,

Â because this week, with Dr. Egerstedt, you guys learned

Â about what is a system and then more

Â importantly, how do you see if it's stable, unstable?

Â And if it's unstable, how do you

Â stabilize it through controls?

Â But before you can do that, you need to see if the system is controllable.

Â And let's say you did stabilize it.

Â Now you want to see if it's observable, because, you know, you

Â don't have state information, so you need to somehow bring in output, etc.

Â And then we see how you put everything together.

Â So in this lecture, we're just going to go over this

Â one big example clearing all these concepts for you guys.

Â 0:50

Okay?

Â So let's start with system stability.

Â Let's say this is my robot, and just an arm is all that we're going to consider,

Â which is your theta 1 and theta 2 to join the angles of this arm, two angles.

Â And I'm going to see that my state is this

Â guy here, which are the angles and their velocities.

Â And my A matrix is this.

Â This is how my state relates to its derivatives, right?

Â This is given to us.

Â So this is what our system looks like, this guy, by this equation here.

Â There you go. So now what are we going to do?

Â We're going to check if the system is stable.

Â Does it blow up, or as time goes to

Â infinity, or is going to be stable on its own?

Â And the way to do that is by checking the eigen values of A, right?

Â So in Matlab you can simply type eig A, or you can sit and find out the

Â eigen values yourself. Either way.

Â Here we just put it in Matlab, and we see that all eigen values of A are 0.

Â And we know from our lectures that when the eigen

Â values are all 0, that means your system is unstable.

Â 2:05

Okay, so that means we need to introduce control, right?

Â But how do you introduce control?

Â We know this pretty equation here, x dot equal to Ax plus Bu.

Â But what does it really mean? What is B?

Â What is u; u of course, is our control signal.

Â Well, we need to first find out what it is that we can

Â control about the system, let's say through

Â putting motors or through putting actuators, etc.

Â So we're going to assume that we can control

Â the acceleration of my first joint angle, theta

Â 1.

Â And if we do that, then we see that our B matrix turns out to be this guy here.

Â Why?

Â Because now, when you put B here in this equation of yours, you'll

Â see that the input u shows up next to theta 1 double dot.

Â That means you can influence the acceleration of

Â my theta 1 double of my theta 1, right?

Â That's where my input shows up.

Â So that's how you generate

Â your B matrix. Now that we have this, great.

Â But can we, with this particular choice of B, actually control this guy or not?

Â That is, do we see if it's controllable of not?

Â And for this we have a very simple test, which is you create this matrix.

Â This is the controllability matrix, right?

Â And then you simply check the rank of this matrix.

Â So here we

Â going to make this matrix first.

Â And you guys should be comfortable with finding matrix multiplications, etc.

Â Not for maybe such big systems, but for let's say a

Â two by two matrix, you should be able to do it.

Â If you want we can really fast go over one example.

Â For example, this is your A, right: 0000, 1000, 0000,

Â 0010. And then you've got, I'm going to find AB.

Â So let's put B here, which is 0100. And now, because my A is a 4 cross 4, and

Â my B is a 4 cross 1, my resulting matrix is going to be a 4 cross 1, right?

Â And let's multiply quick: 0 times 01000.

Â So this guy, because there's a one that lines up at the same place.

Â We're going to get a 1 here, which is here too, right?

Â And then there are no 1s that line up, so you get a 0, 0, and 0.

Â So you see how we got this guy here,

Â which correlates to this vector in the controllability matrix.

Â So you should be able to do AB, A square

Â B, etc, quite easily, for at least 2 cross 2 matrices.

Â And now we're going to check the rank of this guy,

Â and it turns out that the rank here is 2.

Â But we have this condition

Â that the rank needs to be full rank, or the matrix

Â needs to have full rank in order for it to be controllable.

Â That means it should have all linearly independent vectors, right?

Â And what do you mean by full rank?

Â Basically, your rank should be equal to n, Where

Â n is the number of states that you have.

Â Here n is 4, right?

Â So clearly, this guy has rank 2, not equal to 4,

Â and that's why this guy is uncontrollable. And in case you don't want to sit and,

Â you know, compute rank, etc, of all these things, you can even do this in Matlab.

Â And this is the code for it.

Â 5:34

Okay?

Â All right, perfect.

Â So now what do we do? It's uncontrollable.

Â Should we just give up?

Â No.

Â We need to introduce more controls somehow, right?

Â And then we saw earlier,

Â how do you introduce control?

Â It's by putting actuators, putting motors, seeing what else you can control.

Â So here in this case, let's say now we can control theta 1

Â double dot, and theta 2 double dot, the acceleration of theta 2 as well.

Â And of course, then what will happen to your B matrix?

Â This is how the B matrix will look, right? And to double check again, put it here.

Â See if, in fact, u shows up for both theta 1 double dot, and theta 2 double dot, and

Â then we know that u is influencing these accelerations, right?

Â Okay, so now we have this new guy, and

Â we have to check if this is controllable or not.

Â And we do the same thing again. We create the controllability matrix.

Â And we're going to do this in

Â Matlab, because we don't feel like computing everything.

Â And this is the code again for it.

Â Again, very similar to what we did earlier.

Â This time your controllability matrix is going to

Â be much bigger, because you have two vectors here in B.

Â So your AB is going to have dimension 4 plus 4 times

Â 4 cross 2, which gives you 4 cross 2 instead of 4 cross 1.

Â So each guy here is going to be your, you know, B, AB, A square B, A cube B.

Â So you see, now your matrix has expanded.

Â And anyway, now you find the rank of this guy

Â in terms of this rank is 4, which is equal to

Â the number of states we have, and so we are

Â full rank, which is great, because that means we are controllable.

Â 8:07

And theta 1 double dot, theta 1 dot. So we've just gotten rid of theta 2.

Â No problem.

Â So we have this new guy here, but again,

Â now we have to do this entire charade again.

Â First we need to find out, is this guy stable or not?

Â And I'm just going to give you the answer.

Â You should do it yourself, just to convince yourself.

Â But yeah, this guy is unstable.

Â So I'm going to introduce control through this plus Bu thing.

Â And again, I'm going to say I can control the acceleration.

Â I'm going to get this as my B matrix. And now, is this controllable?

Â Because that's the second question you ask, right?

Â And I'm going to tell you it's controllable.

Â You guys can find out on your own.

Â Just make the controllability matrix.

Â Do it. It's good exercise.

Â 9:01

We know that our system is controllable, and

Â we have this guy, u equal to negative Kx.

Â So let's put u into this equation of our x dot, and we get

Â this new guy here, right, x dot is equal to this big guy here.

Â Okay.

Â So we just put the values inside. A, this is A.

Â B, your K is this. 1 cross

Â 2 matrix, k1 and k2, two gains, and what you finally get

Â after solving this entire thing is this new guy here, or simply A dash, right?

Â So you have this new A dash, where you've put

Â in your control and everything, which is this matrix here.

Â And we all know that if you are given a system

Â x dot equal to Ax, or A dash x, or whatever,

Â to see if it's stable or not, you check the eigen values of A or A dash.

Â In this case, we have control over k1 and k2, so we're actually going to force the

Â eigen values through our k1 and k2 to B to make sure that the system is stable.

Â And if you remember, the eigen value's one condition is that the, the

Â real part of the eigen value should be in the left half plane, right?

Â So we're going to force, through our k1 and k2, the eigen values to be

Â in the left half plane of the world.

Â 10:43

then you have, so when you actually solve the system, you're just going to get minus

Â lambda 1, 1 minus k1, minus k2, minus lambda 2 as your final matrix.

Â And then you find the determinant of this guy

Â and solve it, and you'll get this equation right here.

Â Okay.

Â Another exercise that you guys should be doing on your own.

Â And it's good stuff.

Â Okay.

Â So now that we have this characteristic polynomial, what we're going to do is

Â we're going to pick our two favorite eigen values on the left half plane.

Â And let's say we pick negative 1 and negative 2.

Â So now what we're going to do is, this is what we got.

Â And this is what we want, right, which is just this guy here.

Â So we are just going to simply compare these two guys,

Â and get our values for k2 and k1, just by simple comparison of two polynomials.

Â 11:53

Just one quick thing.

Â So yeah, when you put this k2 and k1 here, in this guy, right,

Â in this matrix, now your A dash is definitely going to have this eigen value.

Â This is what it really means.

Â And because we chose these eigen values to be in the left

Â half plane, we know that this new system is going to be stable.

Â Okay.

Â So yeah. There you go.

Â We have state feedback on a simpler system.

Â We chose our key, and now we know that this guy is stable.

Â So,

Â woo-hoo.

Â But now, we come to another annoying thing,

Â which is that we don't know our state.

Â We are very happy saying that, oh, you should

Â be negative Kx, but we don't have this x.

Â 12:45

And for that, again, now we have to introduce this concept of output.

Â What can we see?

Â What are our senses?

Â What can we measure?

Â That's why the whole y matrix and the whole thing comes in.

Â Why?

Â Because now we say, assume we can see this guy here.

Â Theta 1.

Â So, accordingly, my C matrix is going to be this, and my y is equal to Cx.

Â Again, why? Because when

Â you put the C guy inside here, you'll see that your

Â y becomes simply theta 1, and that's what we can see, right?

Â So we choose what we can see, we choose the senses we have,

Â and then we create C, and accordingly, get this y equal to Cx thing.

Â 13:53

And for that, you have a very

Â simple test, very similar to the controllability matrix.

Â This guy is called the observability matrix.

Â And because we have just two states here, this is going to be a short little matrix.

Â And you find out what it is which, you guys can.

Â And then you check the rank of this guy.

Â This rank is actually equal to 2. Is it full rank or not?

Â Well it is, because our states, our number of states are, sorry, 2, right?

Â Here. So yes.

Â It is in fact full rank, which means that this guy is observable.

Â Perfect. That is great.

Â So yay.

Â 16:09

And now all together, execution, because this is the most important part, right?

Â We have got these little blocks

Â everywhere, controllable, observable, blah, blah, blah.

Â But we really don't know how to

Â put it all together. And that's what we're going to do now.

Â So this is our system.

Â X dot equal to Ax plus Bu, y is equal to Cx.

Â With this particular choice of x, A, B,

Â and C, which we've been solving all this while.

Â Okay, and then we have found out that x dot equal to

Â Ax on its own is unstable, and then by introducing B and C,

Â the system is controllable and observable. Great.

Â 17:26

Because I don't have my state information, all I have is the

Â output, so I'm going to read what my output is giving me.

Â Okay,

Â then using that, I'm going to compute my control, u equal to negative Kx hat,

Â not using the output, using the estimate, the initial estimate that we had.

Â Simply.

Â Okay and, remember that you've already designed K and L.

Â Okay, so you compute your output, sorry, compute your control,

Â and then you send this control signal to your system, right?

Â 18:22

all I have here is x hat dot.

Â How do I find out what my x hat should be the next time instant, you know what,

Â you're going to use this Oiler's approximation, which we

Â all studied together in the Glue Lecture One, I think.

Â And of course you've

Â been going over it with Dr. Egerstedt.

Â Basically, your next step is your previous step, plus dt times your dynamics.

Â Right? So that's what we're going to do.

Â We're going to find out x hat dot, and then we're going to just say our next

Â guy is our previous guy, which was this estimate here, plus dt times x hat dot.

Â And that'll give us our new guy.

Â And now we're going to repeat.

Â So now when we come back, we can read the

Â output again, compute the new controls and the control update

Â x hat, etc.

Â This is how we put all of this

Â stuff together, for execution, in your code, etc, whatever.

Â Okay, and with that, check the forums, good luck with Quiz Four.

Â All the best.

Â