So, the next step is, how do we add rotations? We're going to do this for every single corners that we have. But we're going to go though this quicker and quicker and quicker. Because, really this slide what it highlights is, while we write these attitudes, these could be y'all pitch and roll off these reference relative to inertial. We write them as 3-2-1s. Notationally we may even write them as a set with a vector notation or something because it's a three by one. It's a very common thing people do. But our attitude angles when you write them as a three by one, do they really represent a vector? Sean? Are attitude coordinates vector sets? >> I don't think so. You're still dependent on the n. >> Well, it's just the attitude description is part of the so3 group mathematically. Which means they are not vector sets, you cannot just add and subtract them. Position vectors are. And here's the odd thing, while attitude descriptions are not vector sets. The attitude rate omega is a vector set, right? So that's a cool thing with omegas if I have omega B relative to A and A relative to Q, I can just add them up. We'll subtract them whatever I have to find and I can deal with it. But the core of this is fundamentally not added to sense. So with DCMs, how did we add orientations in DCMs? [COUGH] CK, you remember? >> Multiply them. >> You multiply them right. One matrix times another. So, this goes from N to B, B to C, and then we do the two letter. It is easy to track any complexity. It allows you to break it all up. So, this is the key of this slide. You probably would make me literally cry if I see anybody do this in an exam. If you actually add up all the angles y'all 20 and 30 it must be you all 50. So I mercy for partial credit because proportionally down with how many tears I shed when I grade this stuff okay? So don't you think, hey cool, I made my professor cry. Well, it comes at a price, that's all I can say. Don't do this, any attitude coordinate sets. When would you maybe even consider doing this? What do you think? Because people do this in real life. [COUGH] I yell at them but they still do it. >> For 1D option? >> Yeah 1D could work. That's good actually I hadn't thought of that. That was good. 1D you could add them up so if all you're doing is 1D motions and [INAUDIBLE] 20 something rotated 30. You're going to have to map a bunch of 1D motions into DCMs and do that stuff and bring it back. Well you can but really now you're just showing off let's be honest. You can do it directly. Good 1D motion would work. What other kind of scenarios? >> Metric sets. >> We'll get to them. Let me ignore that answer for now. That's a really good answer. But that takes other stuff to get there absolutely. It's a metric set. >> Small angles. >> Small angles, that's a common thing people have, especially if you're doing tracking error, attitude motion. There's a lot of controls that fly where they go great, this is all the stuff and I'm just looking at small departures. If the space craft points more than two degrees where it should be, we just declare an emergency, that's their protocol. They don't like nonlinearities. They would rather have emergencies. Myself? I love nonlinearities. I can handle them. So if you're doing the linearized stuff, and we'll do this bunch, especially when we do gain analysis. You'll find nonlinear control has lots of theory in how to get Stability proven. But it's very hard to get performance you want. Linear conrol has fantastic tools to set performance. I want it criticlly dmaped. I want it to just get there but not overshoot. Or I do want to overshoot a little bit. So I get close quicker. And so we often deal with linearizations as well. If you're dealing with linearizations, then if we did all this DCM stuff, you will find that it's simply yaw plus yaw, pitch plus pitch, roll plus roll. That works. But just keep in mind, if you do that, it is only an approximation of the full thing. In your code, there's no reason to do that. You will typically not do this, you just do the full mapping. So what is the full mapping? We can always go to the DCM. You guys are now experts. We can look up. You can derive them, or you can look right at the appendix in my book. You can find all of the sets. Somebody's giving you a 3-2-1s, and somebody else is giving you 1-2-1. And you just map all of them into the DCM form, with the right. And this goes into this frame, into this frame, this frame to this frame. And then you carry out the multiplication and after you have the answer, this is the b relative to n and somebody wants then a third frame, a third set of order angles, they want three one two, something we haven't talked about, great. Then you have to find the right formulas to extract in this process how to go from the DCM to the right order angles. So the DCM you can see is really at the heart of many of these attitude descriptions. It allows me to translate, as we were talking earlier, if somebody has a t3-2-1, a 1-2-3-1-3, I would just take the 3-2-1, map it to a DCM, and then from the DCM, I have formulas to map it back, all right? That always works. Sometimes there's faster ways, but that's always possible. And for addition-subtractions, mapping 321s and 321s, all the DCMs do the multiplication and then map extract will always work. And it is good to numerical precision. You're not making any approximations here. So that's why in code, we always want to do the full thing. Don't do the linear stuff. But sometimes in analysis we're trying to predict well just how is that closed group response going to be once we get close to the attitude. Is it going to keep oscillating forever and take a long time to settle? That's where the linearization might be handy, and we'll deal with some approximations of them. But this is the full answer that we have. So we can mix and go back and forth, as needed. If you have mixed coordinates, [SOUND] I don't think I've even actually seen nice, elegant, compact formulas. People typically just mix. If they have something in quaternion, some of you have heard of quaternions, some of them in Euler angles and have to add them, I'm just mapping them all to DCMs. because then I can deal in DCMs and then I extract out what I need. So now we know how to do addition. We know how to do subtraction the same way. We do it with DCMs. It's just the key is the mapping to and from of areas. So subtraction have this the same kind of a process you take your angles you have b relative to n, r relative to n, and I'm looking for b relative to r. I have to just map these all into the equivalent, DCM formulas then I do my br is bn times rn transposed because rn transposed is nr. So bn nr gives me br, right? So that two letter stuff, as long as you have good bookkeeping, no problem, you will get there. So that's almost boring at this point. You know immediately now hopefully how to do additions, subtractions with any sets of other angles, mixing sets of Euler angles, and in your input and your output, you should be able to go any which way the problem requires with this formula. Simple example, just if you want to make sure that you've got this right. This is out of the book. So we've got a yaw, pitch, roll sequence at (3-2-1). I'm giving you sets of angles. This is b relative to n. f relative to n. If you take this plug them into the DCMs, you would get formulas we had, all the sins and cosines we had earlier. You would get these nine numbers and for the f frame you would get these nine numbers and now you've got it in matrix form. Now you carry out the matrix math, math lab, any mathematical tool would love to do this for you. And you can get, this is now the final attitude of b relative to f that we're looking for. And if you're looking for, not a DCM answer, but you're looking for, again, 3-2-1s. This is where I use the right inverse tangent for first and third, and because it's an asymmetric sequence I'm using an inverse sine function here, I believe, that was of this element. Yep, and then you get the angle. That's the process. So just as a quick numerical if you want to make sure, yes, this is the steps. Do this in the homework, too. The next one you'll be actually translating between not just Euler angles, but other angle sets. You don't have to write formulas, the DCM is kind of as I call it the universal translator kind Star Trek, right, everyone speaks english, American english shockingly in the future. So this is a way that the translators always put it. With this DCM, this is essentially your universal translator. If you publish an attitude set in a journal somewhere and here's a cool set that we can use, four coordinates, complex numbers, has all these cool properties and you don't show the editor how it maps to the DCM, it's going to come back for revision for sure. They will be looking for this. All right, that's the fundamental thing that ties all of these sets together.