0:08

Now let's look at the single-axis DCMs.

Â As Maurice was saying, we're not just rotating about a general axis,

Â we're rotating about either 1, 2, or 3, right?

Â And if you do that, let's say I'm doing a 3 rotation, then the 3 vector component

Â is going to be the same in the first frame and the second frame, right?

Â But it's the 1 and 2 that are different.

Â If you do a 2 rotation, then the 2 axis is going to be the same between the 2 frame,

Â and if you do a 1, the 1 axis is the same.

Â This really builds just on your homework 1 from Chapter 1,

Â where all these frames that you're defining are all typically just

Â different by a single axis rotation, as we cascade them together.

Â 0:44

Here are the definitions, though, if you do a 1 axis rotation,

Â then the 1 axis shouldn't change, and that's a 1.

Â Everything else has to be 0, and this gives you the right cosines and

Â sines that do that projection.

Â I will show you just for one of them, but

Â this is something you should be able to derive readily on your own.

Â The 2 axis has the 1 here, the 3 axis has the 1 down here of course.

Â But you can see the sine is positive on the upper one for the 1 and 3, but

Â it's negative for the second.

Â Just the way the math works out, but that's kind of the rule that how I

Â remember it if I don't have this thing to look up.

Â But there's also functions people can derive for this stuff.

Â But these are the single access rotations.

Â So now if you think about a sequential, how do I go from Euler angles to a DCM?

Â We were saying it's a sequential rotation sequence, where I do with y'all,

Â then I do a pitch, then and adding a role,

Â I'm adding three distinct rotations, and summed up, they give me that.

Â And how do we add, Robert, how do we add rotations with DCMs?

Â >> Multiply.

Â >> You multiply, and this is each, this M1, 2, 3 is each a DCM,

Â taking you from one frame to another in terms of a 1 axis rotation,

Â a 2 or a 3, but they're each a DCM.

Â They're each orthogonal, all the properties we had.

Â So it's just a question of, how do we multiply them together?

Â 2:34

Slight inconsistency in angles, but you guys are big boys and girls,

Â you know what I mean.

Â So this one would be, because this part would be the sine, no,

Â this is the cosine, and this is the sine.

Â So it's cosine in the n1 direction, and then you have sine in the n2.

Â This one over here,

Â if you do a right angle, this is the same omega that you would have.

Â This part would be the cosine and the n2, and then you've got a sine but in the -n1.

Â So we went through an example like that last time on how to do these quarter

Â transformations.

Â You do this one for each of those axes, draw the picture looking down this axis,

Â and you can derive this very readily.

Â So if you haven't seen it, that's what you do.

Â This is hopefully pretty easy and boring.

Â So now, what do we do with this?

Â We need a fundamental way to derive our relationship from any of

Â the 12 Euler angle sets to the DCM.

Â And then we have to have an inverse transformation.

Â If I give you a DCM, what is the equivalent 313, 121, or

Â yaw pitch Euler angles, right?

Â So we need to be able to map to the DCM and extract from the DCM.

Â So let's look at the forward mapping,

Â where we're going from Euler angles to the DCM.

Â It's a sequential rotation sequence, which means fantastic, we can build on

Â our knowledge on how to add DCMs, we simply have to make things multiplying.

Â And you remembered too that we go from right to left, right?

Â If this C was bn, is we go from the end frame to the prime frame,

Â from the prime to the double prime,

Â then from the double prime finally to the body frame, right, that's the sequence.

Â But you always start from right.

Â So these alpha, beta, gammas are simply the numbers, if you're doing a 3,

Â 2, 1, this has to be 3, this is 2 and this is 1.

Â 4:18

Now I said it, ten of you at least will get it wrong on the exam, so

Â let me say it again.

Â If you have to construct this stuff,

Â go from right to left, 3, 2, 1 sequence, 3, 2, 1.

Â The angles in these formulas tell you that.

Â Theta 1 is just a placeholder for

Â the first angle about whichever axis you're rotating.

Â Theta 2 is the second angle, theta 3 is the third.

Â So if you're doing yaw, pitch, roll, this would be the yaw about 3,

Â pitch about 2, roll about 1, that's it.

Â Now, the rest of it, you can pick those M1, 2, 3 matrices that we've derived,

Â I'll show them over these, one of them's derived.

Â Plug them in the right sequence, put the right angle in there, and

Â start to multiply it out.

Â And this will allow you to derive these DCMs.

Â Sounds very simple,

Â I'll show you an example that makes it a little bit more exciting.

Â There's one subtlety, we need to find these angles.

Â Look in those homework problems, it's not enough to just write, hey, here's an axis,

Â here's an axis.

Â This is the angle between the axis.

Â You have to define a direction.

Â Where is positive angles going?

Â So that little arrow is important.

Â So let's say you had a 2 axis, but

Â your angle is defined not about plus b2, but about -b2.

Â How would you have to modify this formula when you use M1, 2, 3?

Â 5:36

>> The negative angle in.

Â >> Yeah, that's it, just put in a negative angle.

Â So then instead of doing plus there, the way your angle's defined,

Â it's the opposite.

Â Just put in a negative there, and now automatically,

Â it will account for everything.

Â If you look at these formulas, the cosines don't care if it's plus or minus.

Â They are the same, they're a symmetric function.

Â But the sines are asymmetric,

Â that means sine of -theta is the same thing as -sine theta.

Â And then -sine of -theta is just plus sine theta.

Â And that gives you automatically what you need.

Â So with these formulas, you can do both.

Â If hey, this is an angle about a plus b2 or a -b2,

Â that's what dictates to you, put a plus angle in here or a minus angle.

Â And then you derive it, and then life is good, that's simple.

Â Okay, hopefully, you've done this at some point in your life before.

Â Let's kind of take it a few steps further.

Â So we're going to do yaw, pitch, roll.

Â In this example, I have a set of theta 1, 2, 3.

Â I'm just calling the angles what we usually call them.

Â It's c theta phi, so yaw control, it's a 3, 2, 1 sequence.

Â You plug it into these formulas, you get these three things.

Â You multiply it out, you get this matrix.

Â Now I'm using a shorthand, where c stands for cosine, s stands for sine,

Â otherwise it gets really big.

Â But this is the relationship, this is the formula.

Â This is what's coding up in an algorithm somewhere.

Â You give them the three angles, poof, out comes the DCM.

Â And once I have DCMs, I can do whatever I wish.

Â There's patterns in here.

Â There's always one term for every of the 12 sets that's just by itself.

Â 7:21

There's two other terms that aren't too nasty, works as groupings of these angles,

Â the second angle and some of the others.

Â And here, they happen to be on the upper row on the last column.

Â And then those four terms that kind of look too ugly to

Â mention because it's just, the algebra gets complicated.

Â because why do I care about these patterns?

Â If I have a DCM, I also have to have the inverse mapping.

Â If somebody gives me a DCM and

Â says great, what is the equivalent 2, 1, 2 angles of this?

Â I need to have formulas to pull the right numbers out with the right quadrants and

Â behaviors and all this kind of stuff.

Â So for 3, 2, 1s, we can look at this and say, hey,

Â if this is given to you, the easiest one to find is always the second angle.

Â And you can see it's a minus sign here, so really, all I have to do is the inverse

Â sine of the 1, 3 element of that matrix will give you with the minus sign that

Â pitch angle, and that's it, now I have the page, which is kind of cool.

Â 8:38

>> Yes, or in other words, quadrants, right?

Â There's quadrants issues.

Â because for all the Euler angles,

Â the first and the third are always defined for all four quadrants.

Â So if it only gives you inverse cosine,

Â the cosine only gives you something in the first two quadrants.

Â And inverse sine kind of gives you something in the first and the fourth

Â quadrant, if you look at the sine curve and what it typically gives you.

Â So you only get part of the answer, but then there's issues and

Â in fact, gives you wrong latitudes, if you don't use the quadrants correctly.

Â So very good, that's exactly what's going on.

Â That's why we always use the arctangent function here, which I'm

Â just writing as the inverse tangent, but that's the arctangent function.

Â And I'm writing it as a ratio.

Â In your code, which function do you use?

Â What's that function called?

Â >> 8 times 2?

Â >> Yeah, 8 times 2, right?

Â That's the one, it takes a numerator and denominator.

Â Now, again, to make your life exciting, MATLab does it one way.

Â Denominator and numerator or numerator, denominator,

Â I never remember, we have to look it up.

Â because I also use a lot of Mathematica, and it's just flipped.

Â And C code is one of the two, because it's only 50, 50, right?

Â And Fortra has to be one of those two.

Â So always check if you use a 10, 2, what comes first, what comes second, all right?

Â But you want to give two arguments, and

Â now you get something that will give you the proper quadrants, that's critical.

Â Whereas the second angle, in this case,

Â pitch is actually defined between plus minus 90.

Â And the inverse sign gives you the plus minus 90 range.

Â So this is perfect, that's exactly what we need, and we're happy.

Â And this is for a asymmetric set, the angle is defined between plus minus 90.

Â So again, if you note a asymmetric number,

Â the second angle has to appear somewhere with the sine.

Â This is asymmetric, and the second angle is with the cosine,

Â you did something wrong.

Â Something flipped somewhere, all right.

Â Those are the patterns you're looking for, so good, let me see.

Â Now, yep, here's another one.

Â If you do the same math for 3, 1, 3, plug them in, multiply it out,

Â this is the relationship.

Â Now, again, second angle by itself, but it is for

Â a symmetric set which gives me an inverse cosine.

Â And cosine gives you a number between 0 and 180, which is perfect for

Â inclinations.

Â That's exactly what we're looking for.

Â So the second one is easy, inverse cosine here of the 3, 3 element.

Â The first and third, again, have four quadrants.

Â So we have to pick the right stuff.

Â But you can see one of them has a negative sign.

Â So if I need this ratio, 3, 1, 3, 2, so 3, 1 over 3, 2,

Â the sine theta 2, sine theta 2s cancel.

Â I'm going to have to assign theta 1.

Â And to be a tangent, I need cosine theta 1, but I have minus cosine theta 1.

Â That's why there's a minus sign here to make that minus minus.

Â I need a cosine theta1 on the bottom, all right?

Â 11:30

No, right, immediately if you do that, you are flipping quadrants,

Â then you're not getting the right thing.

Â So hopefully, you've done quadrant inverse tangent stuff before,

Â you can look at this.

Â Sometimes it helps to me if I just draw a picture,

Â if I'm looking at these values and seeing, I have y is positive.

Â Great, that puts it somewhere here, but if x is negative, I must have this angle.

Â And if I did drawings of a picture, if the calculator just gives me one of

Â the answers, if I draw myself a picture, what's positive and negative?

Â You can pretty much interpret, I need to add 180.

Â It's either the answer you got or plus, minus 180.

Â And you can go there, so different ways to do that.

Â 12:52

When I was doing that animation that showed a 3, 2, 1 and a 3, 1, 3 equivalent,

Â it's different angles, but in the end, they have the same orientation.

Â That's what I did, I took the 3, 2, 1, I mapped it into a DCM, and then I used

Â the 3, 1, 3 formulas to extract from the DCM, the equivalent 3, 1, 3 angles.

Â So in that sense, and you'll find this very commonly, sometimes it's nice,

Â direct ways to translate, but if nothing else,

Â people always know how to go to and from the DCM.

Â That makes a DCM kind of the universal translator, to put this in Star Trek talk.

Â No matter what you do, if as long as you can go to the DCM,

Â you can do Euler math there and extract things out.

Â Or even if you're matching things, or changing things, you've got quaternions,

Â and some Euler angles, and some other stuff.

Â As long as you can map it all to DCMs, you can do all the attitude additions,

Â subtractions, and then the answer has to be the Rodrigues parameters.

Â I just need to know the right formulas to pull the Rodrigues parameters

Â from that stuff, okay?

Â So attitude conversions between one set and

Â another can always be done with the DCM, and sometimes, directly.

Â 14:33

This is your BN matrix.

Â This came out of some math, some stuff, somebody just gives it to you.

Â Hey, here's your attitude.

Â It's a choice to give it to you in terms of DCM components.

Â Typically, I arrange it in a 3 by 3 form.

Â Now you go back and look at the formulas that we had, and you can say, wait

Â a minute, for the pitch I believe was the minus 1, 3 element with an inverse sine.

Â So whatever that is, you know what it is, right?

Â because these are always the same locations.

Â Now that's a good question because sometimes people get,

Â wait a minute, don't we have to know how we constructed it?

Â That's the representation of that particular element in terms of

Â those angles, and then that's where it goes.

Â Okay, any other questions?

Â What we'll start, I'll start this, we're going to definitely finish,

Â this takes more time to finish, but, Here's a fun frame.

Â I think I did this in 3200 too, so those of you who've seen me,

Â you've seen the final tricks here.

Â But this is an interesting problem, where we can just use and

Â practice Euler rotations and how to add to different orientations.

Â So where we're going to start out from is there's an inertial frame, n1, 2, 3,

Â that's basically our ECI, Earth Centered Inertial frame.

Â 1 points towards vernal equinox, 3 is your polar axis, and 2 just completes the set.

Â Then if I have a longitude and a latitude angle, there's a certain angle to how

Â much you've rotated, which I'm calling here my local sidereal time, or gamma.

Â That's a common variable people use for that,

Â so just think of gamma as an angle that varies with time.

Â because the Earth rotates, right?

Â So it's two hours from now, we'll be pointing at a different part of the sky.

Â And then you have a certain latitude, how far up you come,

Â and then we have a final coordinate frame.

Â Which typically, if you go look at your maps, it shows east to the right,

Â north, up, on your page, and the up direction,

Â the anti-gravity direction's actually out of the page, all right?

Â That's what I'm illustrating here.

Â So what we want to do now is use these things to go from the inertial to this,

Â what I call topographic frame, it's a surface frame from the Earth.

Â And we'll have to figure out how many rotations we need to get there,

Â