What we're doing now is, let's talk about rigid bodies. We're going to go through some sections. We're going to talk then also about attitude. There are some typical prototypical stuff. You actually derive some of these then in your next homework. No, actually, this one. This one does it too. It's pretty straightforward algebra. Definitely do it in matrix vector form, like this. Don't do it component by component. It will take pages. Here, this is our dynamical system. We only care about rates. This kinetic sequative differential equation has a Q, a control torque Q. No other external torque, just our control torque. That's a very simplified system, but this works. Now we want to go ahead. Our goal here is just to drive omega to zero. That's what we're going to be doing. So this is a regulation problem. Were write our Lyapunov function in terms of the states we care about. Do our rates go to zero? I'm actually using true kinetic energy over rigid body. It's a great one. Right? The inertia tensor has positive eigenvalues called principle inertias, and it's symmetric posit definite, so this works. Good. Now with this as kinetic energy, we can go ahead and take a derivative. If you take the derivative of this function, you end up with this result. Let me show you that step by hand, just to kind of go through. This is the part that sometimes people skip again. You've done this before in kinematics. If V is equal to one half omega, transpose I omega, the left hand side is a scalar. Now we're taking a derivative, as seen by what frame are we taking this time derivative. Scalar. It's a scalar What does that mean? Doesn't matter. Doesn't matter. You see this is inertial derivative, definite marking points off in exam. Right? It's a scalar. There is no frame dependent. Another trick question for them today. It's not a frame-dependent derivative. It's just a derivative of a scalar. However, the right hand side is the result of a bunch of vector and tensor math, where you do care about, as seen by what frame? So the right hand side, as seen by what frame, would you wish to take the time derivative? What would make your life the easiest? Y. Why? Y doesn't change. Yeah. The inertia tensor for a rigid body is going to be fixed as seen by itself, the body. Let's do this explicitly. I'm going to use the shorthand. That this is equal to just the prime. Prime is a body frame derivative that is our typical inertial. This saves you lots of time. If you do this you're going to have---. Let's just be really explicit. I'm going to have omega prime, transposed I omega, plus one half omega, transposed I, omega prime. There's no I-prime, right? The inertia tensor, as seen by the body, is there. That's good. How can we manipulate this to simplify it? What's the trick we use it? Scalar, so you can transpose one of them, if you can. Right. The answer is scalar. All this matrix math, you can always just transpose it or flip it. A times B, if the whole thing becomes transposed, you flip the order, it's B transposed times A transposed. This puts an omega here transposed. The I transposed is still I, it's symmetric. Then the I-prime transposed on the right hand side becomes transposed of a transposed, it's just the same as here. One half and one half just gives you the same omega, transposed I, omega prime. Now, in the equations I showed you, this was one half omega, transposed I, will make a dot. Why can I make this substitution? CK? Because it's angular velocity. So when you-- Because any angular velocity has no frame dependency? Be more specific. Because you're taking the body frame derivatives. Because what? What's this omega? This omega between which two frames? The body and the inertial. Exactly. This is a shorthand. This is confusing. Don't use a shorthand. Make it omega B relative to N. Very quickly we'll do tracking, where it's B relative to R. Then this derivative looks very different. --an extra one half in there. I do. Thank you. Okay. These two things combine. You don't have to do this every single time. In an exam, this step in particular, I think, once you know how to manipulate symmetric scalar matrices like this, it's like what is derivative of three times x squared? It's going to be three times two times x times derivative of x. Right? It's the same thing here. You can do that. You should be able to argue in an exam that this derivative is equal to the inertial derivative, because for tracking, it's different. I'm looking for subtleties there to do that. This kind of math, once it makes sense, you're from here to here very quickly. This can be done in one step, once you believe this math. So good. Let's go back. We were here. Taking the derivative kinetic energy gives us this stuff. Now, we plug in the actual equations of motion. That's what you were asking earlier, right? These are the true. Right now, it's just some expression, has caused definite, taken a derivative. Has nothing to do with my dynamical system. Here, I apply my specific dynamical system and plug it in. What happens then is you get this equation, with this, Q is going to be our control torque. What's going to happen to make omega transpose to omega tilde? We've seen that first part, zero. Right? We love zero. That's good. Simplifies stuff. You end up with this equation. No big surprise. We've seen this just before. The same structure with a generalized mechanical system. You end up with the same form for this rigid body. Here instead of Q-dots, I have a little omega, and the big Q is my, in this case, control variable. This is where I need to come up, now, with a good control to drive it to zero. As what we did with the general system, I'm going to use Q is equal to minus P times omega. P being symmetric posit definite. It's basically a positive gain matrix. This gives me some knobs to tune. Last time somebody said, 'Well, could you just put it in minus Q-dot, which should be minus omega. Yes, it would be stable, but you may not like the closing performance. It may be way too sluggish, it may be way too stiff. You know, having control gains is good, because now you can tune the performance. And you've given it a whole bunch, not just one scalar, but you given it a whole matrix, so you could do cross coupling, and all kinds of things to place those poles but that's it. Now, this control that we have, what information do we need in this control? What do you have to sense? What do you have to know of the dynamical system? Looking at this. Maurice? Do I need to know my attitude? Need to know your angular velocity? Okay. You do need to know angular velocity. What else do we need? Do I need to know anything about the inertia? In the stability analysis, yes. We assume it's rigid. But in the control, there's no inertia that appears. That's going be different on the controls very quickly. That's a really good thing. That means your control is infinitely robust to inertia errors. You don't need the inertia. All you need is to know what the rates are. In fact, with a little math later on, when you go Lyapunov optimal and saturated stuff, we'll show you don't even to know omega perfectly. As long as you have to sign right. It's plus points in radians per second, not minus points to radians per second. If it's 0.3 or 0.5, it doesn't care. The performance will be different but it will still be stable. We can actually guarantee stability. I'm not showing that here, that robustness. But I can show here, immediately, that this doesn't need the inertia tensor, and that's a good thing in these controls. Because you can think of a robotic docking system, they've got Asteroid retrieval. They want to grab boulders. You don't know exactly what that mass is going to be. You pick it up, and you're tumbling. If you want to control that's just gonna go to stop it all tumbling, and it's really robust, this is a fantastic control. It's a linear control, but it will stabilize globally, asymptotically the full nonlinear system. So long as you don't run out of fuel. Then you're just --you're in trouble. Was there a question? No? Okay. So if you plug this in, this is where you get this. And this is now--you know, before we had stuff where we had to go to second and third derivatives for asymptotic stability. This is only a first order system. My V is in terms of omega. My V-dot is in terms of Omega, and negative definite now in terms of omega. Right? If you also cared about attitude, if V-dot was in terms of sigma and omega, and only omega appears, that was the argument we had before, when it's only a negative semi-definite. My omega has to go to zero for V-dot to be zero, but my sigma could be anything, because it doesn't appear. Here, there's no attitude, so therefore this is a negative definite function, and you have global asymptotic stability. For global stability, what did we have to argue as well? That was an actual slide I threw in there. Andrew, do you remember? What were the arguments to make something not local, as Tony was talking about, but global? Do we need to look at a higher derivative? You're thinking convergence. Oh, yeah. That was-- if this were only negative semi-definite, we could look at higher derivatives to investigate if it is going to be asymptotically stable or not. Right? These are if statements not if and only if. If you can show this is negative definite, it is stable. If you can't show that it's not negative definite, it doesn't mean it's not stable. We just don't know. Right? What do we have to argue for global stability? Why can I add this word in there? Kaylee? Radium unbounded. These arguments we're doing have to be true for all states. Otherwise, it's a dead giveaway. Forget radium unbounded, this is only true for a small neighborhood, then it's a local argument. Right? This is true, this is posit definite for any omega which is cool, V-dot is negative definite for any omega, that's good. These arguments are good for infinite vols, basically infinite neighborhoods. Then on top of that, we need this on to be radially unbounded, which it is. Which means, as Omega goes to infinity along any direction, this function will go to infinity as well. Monotonically increases and goes up. We don't have functions that go up but and then asymptotically approach zero but never hit zero, that kind of stuff. That's what causes issues with global stability arguments. Okay? Here, clearly the case, this is readily unbounded. It goes to infinity as omega goes to infinity. It's good for any initial conditions. It's good for any initial conditions. This is a globally asymptotically stabilizing control with infinite insensitivity to inertial tensor, because it doesn't appear. That's regulation. Now, let's do tracking. Tracking, as before, we had a QR-dot and Q-dot. Here we're going to have omega-R, that's our reference. I want this spacecraft to be spinning about this axis and do this particular scanning motion of the sky. Right? This is a time varying reference that we have to track now. Now the state we care about is del omega. When you writing it up on a function, our del omega is, omega, this is B relative to N, this is R relative to N. Just like what we did in the first few weeks with the kinematics. This is the exact equation I was torturing you guys with: take the inertial derivative of this and the body of the derivative in matrix form, right? That's where you've practice already. You can notice now, our V function is only in terms of delta omega. That's what we care about. It's not what my omega B relative to N. This delta omega really is omega B relative to R. We don't typically write it that way in control problems. People like these deltas, because deltas are supposed to go small, and so forth. If you prefer, you could rewrite on del omega as: this is omega B relative to N, R relative to N, so del omega is B relative to R. Right? That's the reference. And we use the same mathematical structure. This is no longer a kinetic energy, but it has a kinetic energy like algebra, because it worked out so well earlier. For a control, there's never just one Lyapunov function that will prove stability. I have a factor of one half in here. The reason I have one half, is because when I differentiate this, that one half drops out. If I didn't have the one half, you have a factor of two floating around, then there'd be a factor of two here. It doesn't impact the stability. Once you have one good Lyapunov function, that function times 10 is still a good Lyapunov function, right? You may even come up with different functional forms and prove stability. This is just one of them that we're showing here, because these are very convenient. We do these derivatives and take-sorry, the derivative of this, as you were arguing before, differentiating this term, this scalar product of tensors and vectors. We like to do body frame derivatives, because then there's no I-dot, the inertial derivative of the inertial tensor. But now, I need the body frame derivative of this one. The same arguments we had earlier. You can do chain rule, and then add these two halves to give you this. I've just stepped right into it. But now I need the body frame derivative of del omega and that's what I'm giving you here. It's very simple. I encourage you to do this by hand. I'm just giving you the answer. Once you recognize the pattern, you should be done in 30 seconds or less. Definitely something I could ask on an exam. With this definition, you have the body frame derivative. The body frame derivative, omega B, and it's the same thing as the inertial, as CK was saying just earlier, right? But the body frame derivative of omega RN is not the same thing as the inertial. You could do now our transport theorem again. It's going to be the inertial derivative-- the R frame derivative of omega RN, which is the same as the inertial plus-to-cross product you need, and it ends up simplifying to this. This is nothing but transport theorem. If I show it to you it doesn't sink in. I just want you to do that, you see what the answer should be. We've computed that now. Immediately, you can see things get a little bit more complicated. Now, I am plugging this into here that we have. At some point, you have inertia times omega-dot, which is nothing but our equations of motion. This is where I'm substituting in our specific dynamical system as well. Then you get this result; a bunch of terms. Now we have to come up with a control Q that guarantees this V-dot is going to be negative definite. A simple trick people do here is, we basically set this V-dot equal to a negative definite term. Again, we care about delta omega here, so minus delta omega, transpose P, delta omega. Then I can set this equation equal to this equation, and you solve for the Q. Del omega is factored out, so this bracketed term has to be equal to minus P del omega. From that, you can solve for Q. That's typically how we develop them. And that's it. This control, compared to here, now this requires inertia. If you are doing a study, you definitely want to look at sensitivities. What if the inertia is off by 5%? 10%? Turns out they're quite robust. You can be off by many tens of percent, and it still works reasonably well, but your performance will be different. It does depend on knowledge of inertia. You have to feed forward the reference motion, the reference acceleration of the angular velocities, and put this all together. Now, keep in mind too, there's no coordinate frames defined here. Your omega R is typically given in reference frame components. Your omega is actually omega B, and that's measured in a rate gyro in body frame components. This is written in a frame agnostic way. If you actually implement this, make sure everything is in the same frame. It's back to day one, right? You don't have a vector --matrix representation of the vector in A frame, plus a matrix representation of a vector in the B frame, you're adding up wrong directions. Here, if you implement this, make sure that omega R in the R frame gets mapped to omega R in the B frame, and the same thing with this vector. Everything has to be in the B frame. That will always be implied in my math. I'm giving it to in a kind of a coordinate frame agnostic way. Whichever frame you're picking, make sure it's all consistent. All right? So that's cool, because you can see in this control, if you plug in this Q up here, this term cancels this term, this term cancels this term, this term cancels this term, and then it adds the desired V-dot behavior to it. But there's a subtlety here. This feedback control quadratically depends on omega. This is inertia times omega times omega, essentially. That's going to mean units of omega squared. If we have really fast tip-off rates, fast squared gets really, really fast. Right? If you have a quantity like that, and you're squaring it, and you control depends on that, that means with fast-tip off rates, you might be saturating. Your stability assumes, right now, unlimited control authority. There's no saturations we're including to guarantee stability. That could be an issue. I want to show you one little trick we can do with these right functions to get rid of that. This is how I derived it. I took the system, I got this V-dot, I set it equal to this V-dot, and then solved for the Q. That's what I have here. This is what it ended up being. There's another thing I can do. Instead of having omega tilde I omega, if I put a control in here that says, omega R tilde I omega, I'm changing my control subtly. It won't cancel with this term, but let's look at the math there. We had omega tilde I omega. Then with the other control, there's a plus. I'm making this now omega R tilde I omega. If this was just omega tilde, the other two would cancel, and life is easy. If you do this, though, you can say, okay, that's going to be minus omega, minus omega R, and the whole thing tilded, times I omega. It's A cross B plus C cross A. You can add the two vectors up and then cross-product. If you go look at the cross-product operators you can combine those. This becomes nothing but del omega tilde I del Omega. Now, why is that nice? If you take a look at this other term, all of this stuff is being pre-multiplied times del omega. If we moved an R here, this term and this term combines to be del omega tilde times something, and whatever that product is, it gets dotted or transposed with del omega, and that's our wonderful identities: del omega dot, transpose del omega tilde is always going to be zero. Both of the controls, actually, you can guarantee global asymptotic stability. One of them then only linearly depends on the rates, whereas the other one depends quadratically. Now, what's better depends on performance. Maybe you like the quadratic part. Maybe it's doing good things for you, and you have enough control authority, it gives you a better closed loop response right. That's where stability is one level of arguments and performance is a whole another one. Different controls, as you saw with the multilink systems, they're all stable, but they give you different performances. Depending on your application, you can play with either. Okay? Good. We've done rate-based control, right? We use kinetic energy for regulation. We also use kinetic energy like things for tracking. Tracking gets a little more complicated and sometimes there's tweaks you can do. But we can prove global asymptotic stability.