Welcome to module three of control of mobile robots. what we're going to do in this module is try to be a little more systematic in how we think of our design choices and how we actually Model the systems that we're dealing with. So, so far in module one we did some basic control theory. We developed PID regulators. we could do some rather elegant things, but we really didn't know Why anything worked. And in module 2 we started talking about robots and some of the more standard robot models we're going to use, what abstractions are useful for thinking about sensing modalities, and how do the robots know where they are. so what we're going to do in this module is actually take a step back and start to revisit some of the things we did. And what we need to do first of all is develop a Model class that is rich enough in the sense that it's quiet general and it will catch and capture a lot of different robotic systems that we're interested in. But it has to be simple enough so that we can actually say things about it because, you know, very complicated models don't really give us anything because we have no effective ways of interacting with them. the model also needs to be expressive enough and relevant enough, and what I mean about With that is, it has to capture the aspect of the systems that we're interested in, in a way that matters and actually translate into the actual systems doing what they're supposed to be doing. Because one thing to remember is that models are always approximations, adn you want to make suere that you, the things that you don't fully model. Don't matter so much. And what we're going to do is we're going to go into the wonderful world of linear systems. So, linear systems are particularly effective and compact, and well behaved system representations of dynamical systems. So let's start with what I want to call the world's easiest and simplest robot. This is a point mass. So what it is, is that it's just a mass. On a line and I can immediately control the acceleratio n. So if you start controlling but p is the position of the robot then acceleration which is the second derivative of the position is just p double dot is equal to u. Now we won't actually like to write it in this way, we don't want the double dots, we don't want to have. P is for positions and then we're controlling something else. We have new variables. So, we want to come up with a compact/general form that captures what we want but somehow glosses over the, the, the minor details of what separates a point mass robot from a. Humanoid robot, say. So the way to do this is to introduce some new variables. And I'm going to introduce in this case two variables. The first one I'm going to call x1 and simply say that that's the position. So x1 is the position of the robot. And then I'm going to say that x2 is the velocity of the robot. And if I do that, I can actually write down the derivatives. The dynamic's of these new variables. So x1 dot, well, we have x1 dot is equal to p dot but p dot was equal to x2. So, x1 dot is simply equal to x2. X2 dot is P double dot, right? So X2 dot is P double dot, which we have up here, which equal to U. So X2 dot is simply equal to U. So this is a slight reformulation that so far doesn't seem to buy us anything. But what we can do is we can actually We put now this system on what's call state's based form. And the state of the system is going to be our excess. So I'm simply going to lump x1 and x2 into a new variable that I'm going to call x, and now note that this is actually a 2-dimensional object. And then what I'm going to do is I'm going to talk about the dynamics of this 2-dimensional object. So x dot is x1 dot, x2 dot and we know that x1 dot was x2 and x2 dot was u. So I can simply write x dot is this x2 u vector. Well it gets even better because if I have a matrix. If I have x1 x2 there and I multiply this by 2 by 2 matrix, let's say that I would like to get out x2, well what do I have to multiply x1 and x2 with? Well, this is zero times x1 so I'm going to write 0 here and 1 times x2. Is going to give me that, right. So what I am going to do is simply write this as a matrix, so x dot is zero times x1 and 1 times x2 and x2 dot is simply u, so its zero times x1 and zero times x2 but we get one u out of it so I am now rewritten my dynamics using these matrices, which may or may not look easier. But trust me, it actually will be much easier. Moreover, the thing we care about in this case would be x1. So, I'm going to take the output of the system to be x1. And, I can also write this as a matrix. In this case it's a it's role vector times x. This simply means that I get one of x1, and zero of x2. So, I have now re-writ them, everything in a much more, I'm going to claim compact form, using these matrices. So, to summarize, on state space form x dot is this thing, And x and y. Sorry. The output is this thing. Now, if I introduce some matrices. I'm going to call this thing my a matrix. I'm going to call this thing my b matrix. And this thing my c matrix. Then, all of a sudden, I can write everything like this. x dot is ax plus bu, y is cx. And now we've hidden all the particulars of the model inside this a, b, and c matrices. But this is a very. General way of writting systems so this in fact clearly deserves one of these sweethearts because what we have done is to take a system that was really particular and written it in a very general form involving these system matrisis and to make sure that we believe this is in fact generally usefull let's consider 2-dimensional point mass now. Where, what I can do, is I can move in both the x and y directions say. So, the position is going to be the x and y position, the input is my acceleration in the x and y direction. And then the dynamics of course is p double dot x is ux, which means my acceleration, my accelerating in the x direction with the my ux input, and similarly for my, My y direction. Well, now we need to do the same thing. So I'm going to introduce a bunch of new variabl es. So x1 is px. x2 is p.x. As I said before. But now I'm introducing 2 more. X3 is py, and x4 is p.y. I have two inputs and two outputs. So if I do this. I can actually write this new system, also using a b and c matrixes. So if you take a look at this a matrix, up here in this corner is the old a matrix that we had for a 1D point-mass. Well this is just the x component of the a matrix. And this would be the y component. Similarly b, this is my old b Now I have two copies of it. And for C, this is my old C. Now I have a copy of it. So with this choice of A, B and C matrices, voila. I can write the same Or that this system on exactly the same form X dot is Ax + Bu. Y is Cx. And one thing that I'm going to encourage you to do is make sure that you go through the matrix multiplications here and convince yourself that this choice of a, b, and c matrixes is actually corresponds to the original dynamics that we had up here. but the point that I really want to make with all this is You know what, x dot is Ax plus Bu, y is Cx, is a very general way of writing down, the system dynamics that you have. And in fact, this is what's called an LTI system. Linear time invariant system on state space form, and we're going to see this a, b, and c. triple quite a lot in this course, because they will show up over and over again. And they will allow us to be general about how we reason about our systems. And then we're going to hide the particulars of the dynamics inside the a, b, and c matrices. Before we move on to the next lecture we're actually going to see a little bit more where these models come from. Let's say a few words though about the dimensions of what we have here. If x is an n dimensional vector so it's a Rn for the point mass on the line x is 2-dimensional or a 2D point where we control exploration x was 4-dimensional. Anyway, x is in Rn, then A is an n by n matrix. If U is in Rm, meaning we have an m dimensional inputs, then V is going to be an n by m matrix. And similarly if the output is p dimensional, meaning we're sucking out p different things from our system, then the C matrix is a. P by n matrix. And the reason this is right. you can see that if you actually write down the equation. X dot is Ax plus Bu. Well, x dot has to have the same dimension as x. So it has to be n by one. Now, I know that a is n by n. And x is n by one. Whenever you have matrix multiplication like that. The first thing is that these numbers have to be the same otherwise you cannot do this multiplication. So you have to make sure these are the same. And when you end up with n at the end, it's an n by one or n pieces here Which means that ax actually becomes and n by one factor. Which is what we need, right? Because x dot n by one. Similarly with b, b is n by m And you u is m by one, well these things cancel out that they should and we end up with something that's n by one. If you look at y similarly, y is p by one, well is p bt n and x is n by one. These guys cancel out, and what we end up with is a P by one vector. And, it's important that the dimensions lineup. So, as a sanity check, we're always going to be forced to insure that the things that we build, have the right dimensions. And, if they don't have these dimensions, then what we write down is actually nonsense, and we can't perform these multiplications. Okay, that concludes the first lecture on linear systems. And in the next lecture, we're going to see a little bit more where these systems actually come from.