Everything builds on this DCM, this Direction Cosine Matrix. Now we're getting, we're done with the review of just what this schematics is about. Let's talk specifics here so we got a good 35 minutes, good. The Direction Cosine Matrix, again, lots of different names. When I say it is the mother of all parameterizations, I really mean it. Because you will find every single definition that we have of altitude coordinates, if you publish on this, somewhere the reviewers, the editors are going to look for, great, I love these coordinates, but how do they relate to DCMs? DCMs is going to be the way we do fundamental addition rotations, quarter transformations. Like you can translate between Cartesian and spherical coordinates, there's math for that. This DCM is the fundamental way that we'll be translating between sets of coordinates as well. So this is one we really want to understand and we use it a lot. Very, very important one. So hopefully has anybody here never seen a rotation matrix, DCM, transformation matrix, something like that? You should have used this at some point even as a physics major probably or a not just an arrow. So let's go through this again. The fundamentals is more review at this point, but I'm trying to fit everything in the same notation. The first, we have two frames. We have the b frame here in blue, and we have the n frame here in black. And the definitions of angles I'll get to in a moment here. The first thing I want to define is this concept called the vectrix. It is a convenient way to do linear algebra with vectors. So, all vectrix is, it's a matrix of vectors. And, if I do a quick example, now if I have to do math, if I have to somehow evaluate 3 times b1 plus 2 times b2 minus 5 times b3, I can actually write this as [3 2 -5] times this vectrix of b, b2, b3, right? You just do your usual. It's can be this times this, this times this, this times this. And the math implicitly involves scalars times vectors. And that's fine. So the answer is a vector. But the vectrix is just the matrix representation of typically sets of base vectors. This allows us to group this delinear algebra in very convenient forms. Okay, so nothing too scary unusual there. Good, so that's the vectrix. And we have here the n vectrix, which formed by the base vectors n1, 2, 3, and the b vectrix, which is b1, 2, 3. To denote the difference, I'm using a curly bracket around the b hat. That just means this, if you see this you know this is a three by one matrix of some base of the b base vectors. That's it. Now, let's look at this stuff. We did this projection earlier. All right, where we talked about in homework one you're going to have to do projections of e frames onto b frames. At some point we're doing three dimensional rotations and you figure out which sine and cosines to include and so forth. This is really developing to a much more general way. If you have to write this vector here in n frame components you really have, well, b1 is something along n1, something along n2 and something along n3. And these somethings are the projections, these are all unit vectors, so how far do you have to move along this way? It's the dot product between b1 and n1 which gives you magnitude one, times magnitude one, times the cosine, if you're thinking of those plastic laws definitions of the angle between the two. So this element that you have to go, this is simply cosine alpha one one, one one means it's between b1 and n1. One two means it's between b1 and n1. And one three is it's between b1 and n3. So with those three projection angles essentially they're cosines that's where the name comes from, direction cosine angles or direction cosine matrix in the end. You can write b1 in terms of the other for a general rotation. Not just when they differ by one axis. And then for two and three, it's really the same process but instead of having one one, one two, you have two one, two two and three one, three two and so forth. Right? Cause youre doing the first, second or third body vector. So that's an easy way to just do a simple projection. Now that's three equations, three vector equations. I have to solve and do things with them. And as you know, if you have to deal with multiple equations the way to go is really linear algebra. That's the great mathematical tool to kind of manage all this stuff and solve systems of equations. So let's put this in linear algebra form. We have, here in the left-hand side, I'm going to make this the b vectrix. And on the right-hand side, I'm going to have the n vectrix. And then, in-between, we have this three by three matrix of direction cosines. I've just plucked it all into a linear algebra form. Hopefully trivial, at this point, just to go from one side to another. And I'm going to call this matrix the c matrix. Right now, I'm just using one letter. Later on, I'll go to a two letter notation that you'll see, dealing with lots of frames the two letter thing is really, really handy. But we can do this. So good. This is what relates the n frame to the b frame in a general way. So therefore this describes the orientation and as Daniel is pointing out early it's the description of attitude motion. It's what kinematics is. So therefore these cosines are actually attitude coordinates. The question is now how many attitude coordinates does the DCM have? Robert? What do you think? >> [INAUDIBLE] >> Three coordinates? >> Nine. >> Why? It's not a tricky question. You're probably thinking too far. How many cosine values do we have here? Three plus three, nine okay. Say it with authority. Great, nine. How many do we need, Robert, to describe a three dimensional orientation? >> Just three. >> Three, right. So we needed three. I'm showing you this DCM as an fundamental thing and holy crap, we went way too far, we got nine. How do we end up with nine? Well, this is the basic definition. The DCM is a highly over parameterized set of attitude coordinates. So if the DCM has nine, TBow, does this mean all of a sudden we now have a nine degree of freedom system? >> No some of the angles can be written as the sum of others, etc. >> Right, in essence there has to be constraints, this kinematic description has constraints. And if you have nine coordinates, and it's three degree of freedom problem, how many constraints- sorry, give me your name again. >> Andre. >> Andre, sorry, I should know. How many constraints must we have Andre? >> So what happens with the other three equations? If you have nine coordinates, three degrees of freedom? >> But you need six? >> Six, right? So you have nine coordinates minus degrees of freedom. That's how much you've left. You have three coordinates minus three degrees of freedom means you have zero extra stuff. That's it. It's a minimal description. If you have four coordinates minus three, there must be one constraint. Here, there must be the equivalency of six constraints. And there's lots of ways these constraints manifest. What can you tell me about this DCM? If we look at it now if somebody, let's just switch over. You've seen the definition. You're all seen this before. Nobody raised their hand so everybody's fair game now, right? That will wake you up. If I give you DCM 111000000, could this possible be the correct DCM? Yeah, why Chuck? >> Two frames could be- >> Do tell me what it means. But there's looking at it upfront, your gut feeling says this could be right. Something you may recognized that entity, yeah I remember that from somewhere that actually means deserve rotation. Good you might recognized it. Let me put this elsewhere if we have 0,1,1,0,0,0,1,1, bunch of 0s and 1s I've thrown in there. Brian, could this be a proper DCM? >> [COUGH] Excuse me. I don't think so. >> Okay, you have 50/50 chance, so can you elaborate? >> Because that would mean that one coordinate is aligned to two axis. >> Right, so if b1 = n1 + n3, what is the length of b1? >> One. >> It should be one. >> Right >> Is it one in this case? >> No. >> What is it? You're close. You're not there yet. >> Negative two. >> You got n1 in one direction, n3 in another direction, orthogonal. You add the two, what's that length of this triangle? >> [INAUDIBLE] >> There you go. Okay? It's always going to be more. All right? So really, as you can see, because every row represents the b1, b2, b3 vector components, these components better add up to one. You do one squared, two squared, three squared, right? They have to have unit length. So if you're doing some problem and you're doing some, like that, and you end up with a matrix that says [3, 5, 7], right away I've gotta stop right there. [LAUGH] You're not on a good path, right? There's no way this could be a DCM, doesn't make sense. So every row has to add up. Every element has to be a cosine of an angle. And a cosine functions gives us what range of numbers? No, minus one to one right? So you could have a minus one but you can't more than minus one. Sorry, you can't have less than minus one. You can't have more than plus one in this kind of stuff. So immediately you can see there's lots of geometric constraints on what these coordinates can be and in the end they're all equivalent to being six degrees or six constraints that have to be applied. So let's go back to the definitions. We'll discover more and more relationships and what this stuff means. Again, you've seen DCMs. So the definition, the IJth element of the DCM matrix is simply the cosine of the angle between the Ith and Jth base vector of each of the respective frames, right? And this is b and n. Those are place holder like the transport theorem. This could be q and t, s and r, whichever two frames you are doing. The attitude of this frame relative to that frame. So it's a dot product of two unit vectors which just gives you that cosine. So good, so we've got that. This basically maps, you can see here we are going from end frame components and computing now what the equivalent B1, 2 and 3 are. If you want to do the reverse, you could have just taken n1 and gotten B1, 2, 3 components. And two, I can flip b and n really. If you do that, it's the same angles, it's the same two frames. But all the sudden, instead of 1,1 1,2, 1,3 we end up with 1,1 2,1 3,1. The indexes become flipped. If you have to do the projection of n on to the b frame. The other one, it's the same matrix. So the matrix that maps the the b vectrix into the n vectrix is really c transpose. It's just a transpose of the original matrix. But mapping wise, here we're going from n to b, and then here we go from b to n. What type of mathematical operator are we doing here? If one takes you from n to b and now you want to go from b back to n, what do we have to do? >> Inverse. >> Inverse, you could've just taken the matrix inverse up here, brought it over, right? That's where linear algebra really shines. You know how to do that. It's a bunch of numbers. Give it some Mathlab. You just made Mathlab's day. It loves doing this stuff. And here's an inverse. Bring it over. And now you do it. But the beauty is, we can see for the DCM, it turns out the inverse is nothing but the transpose. What do we call such a matrix when the inverse is equal to the transpose? >> Orthogonal. >> Orthogonal or also, in this case if you want to be very specific orthonormal. We'll typically use orthogonal in all the attitude papers, they used to talk about orthogonal, that's good. If you took a linear math and applied math they probably talk orthonormal because it's on a normal link space vector. So really that's what we just discussed. A matrix inverse in this case is just a transpose. That means anywhere we see a not just an attitude dynamics and you come across something in structural modeling and other things and here's assisted math matrix and it's orthogonal. That is good news. Sometimes people shy away from this and go, that makes it sound complicated. No, orthogonal is really good news. That makes your algebra much easier. If you have to analytically solve now for these inverses and do it, anything more than a two by two quickly takes up pages and pages of algebra. Just go with something like MathLab or Mathematica and plug in a four by four matrix and ask it to invert it analytically. It'll do it. Then it will be dumping it out. You'll kill a lot of trees but it will take lots and lots of space to do it. So if you can just do a transpose that is fantastic. Now let me talk about the two letter notation that I use because you will see this often when we solve problems. The c matrix is a classic definition. You see it in lots of different literature. But also if you have multiple frames things get a little bit more complicated. Then you really want to track, this is the attitude of b relative to a, then a relative to q, then q relative to r. And you don't want just c for everything because it gets very confusing. So we'll tend to use what we just defined as c is really what I have as a [BN] matrix. Some people write this as T the transformation matrix with B and N or N and B flipped. There's a whole series of different notations, so if have a paper you're not familiar with and have DCMs in there, first thing you should do is look up and really understand how the they define this mapping. Is it from one to the other or the inverse, it's not universal. In astrodynamics we do everything in the body frame. Our equations of motion are simplest in the body frame. Our sensing happens in the body frame and so everything is mapped into the body frame. If you go to computer science and robotics literature they do a lot of the same stuff. Computer graphics. How do you map all these things and just pixels and vertices and do all this stuff? But they map everything by default into the inertial frame. All the robotic stuff is typically written into respect to the inertial frame. And everything's, the complex kinematics is all mapped back to that. So all their definitions are exactly flipped from what ours are. I didn't invent it, I'm only the messenger. So just pay attention. And even sometimes across fields I found, I was working at Sandia there were some things people called them Rodriguez parameters and you solved to find Rodriguez parameters, but it turns out in that field Rodriguez parameters meant what was to me not Rodriguez parameters but principle rotation vector. That's about an afternoon wasted until I finally tracked down why does this math not work? And they're talking about very different coordinates. So, it's just lots of fields have contributed to attitude schematics. And so, there's just a whole praetorian of different definitions of that race to go. So [BN], why is this handy? This is what we have for b vectrix is equal to [BN] vectrix. With this two letter notation somewhere you're denoting this rotation matrix goes from this frame to this frame. And in the attitude you will see we always tend to go from the right hand side to the left. We start from the right. This is where we begin. Then we start superimposing multiple rotations and at the end we end up on the left. It's just the way it goes, is from right to left. That's good. If I want to invert this matrix, how would I denote that with this two letter notation? >> NB. >> NB. Right. That's it. So, you can just say [NB] ends up being [BN] transpose. It's very simple. And so you will see this. For right now if I'm just doing one frame sometimes you just write c it's easier. So we'll see. Okay so good so this orthoganility inverse. That's really important. If you looked at the DCM examples we did we said every row of this one had to be a unit length. But because if you invert it you're mapping b frame stuff onto m frame m frame also m one, two, three unit vectors therefore every column of your DCM has to have unit length. So there's other issues that come in now with the DCM. Let's talk about that then. Since this maps onto there one onto the other, could I have one, zero, zero. Zero, zero, one. Zero, one, zero. Would that be a proper DCM? It maps one frame to another. [BLANK AUDIO] Why not? You're shaking your head. Sorry, what was your name? >> My name is Ansel. >> Ansel thank you. >> I think it would be left handed. >> Good. So the 0s and 1s make sense. Nothing would violate the cosine requirements, all right. The lengths, this has unit length, unit length, unit length, unit length, unit length. That's all cool but if this maps n to b b1,2, 3 has to be right handed and you can see here if this is one, this is two, one cross b1 cross b2 doesn't give me b3, it gives you minus b3 in this case. So this is where somebody used their left hand to construct a coordinate frame, and you end up, this is also an orthogonal matrix. It satisfies all the conditions of orthogonality but its a left handed system. And so there's some mathematical checks we can do to quickly identify is this DCM left-handed or right-handed? And we'll check for that. These orthogonal matrix also come up when you do projections. So there's some mathematical operations for projections, mirroring, that kind of stuff. With mirroring in particularly you could end up with a left handed type thing. You will see that in a moment. So here too so this I can look at and go well it's not for an attitude description with a right handed coordinate frame. That was the issue. So very good, okay. You've seen this. We're trying to creep through it. Put this all together.