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,