0:05

Adding, subtracting, well we know how to do this now.

Now that we know how to go from quaternions to DCMs we can add, subtract.

This is still very useful in particular if you're mixing coordinate frames.

If your B relative to N is tracked in terms of the out pitch roll and

the second set is tracked in terms of quaternions,

now by moving everything to DCMs, it kind of gives a common architecture.

That's where we multiply it out.

And then when you have the answer and if you want it in terms of quaternions,

use Sheppard's method, that's what I would code.

And this is how you robustly pull out a set of quaternions, both sets.

But we typically return the short one.

And if it's 180, flip a coin.

They're both valid.

Did I tumble upside down going left or right?

At an instant you can determine distinction, so just pick one direction.

In the code there's usually something that decides either left or right.

So good, so that can always be done with Euler angles,

symmetric Euler angles that we've seen.

There's also elegant direct addition properties where we just go

using spherical trigonometry, it's the easier way to derive it.

And you end up with some direct formulas and how you can add them.

We can do the same here.

And you get these equations.

1:19

This is the primes are the ones that take you from N to B,

that's the first rotation.

Double primes take you from B to F, that's the second rotation.

And then the betas are the answer that takes you from N to F directly, right?

That's the final one.

This is your curtonian math that you would have.

Some papers you see these written out with a q note with a cross product and

a circle around it.

That's basically the quarternion addition.

This what you're doing in matrix component role.

It's typically what I program, I cannot show this version.

But that's the quarternion algebra that we're looking at.

This is how we can add them.

Now in your homework you will actually derive this properly and

the way you do it is you go back to the definition of a DCM and

this one has prime, this one had double prime, and you carry out a 3x3.

You saw those DCMs.

You can do this and then you get an answer and

then you want to extract from here the beta knot, so you take the trace of that

plus one, take the square root and there you go, you get that term.

Lots of algebra.

2:25

This becomes an exercise in bookkeeping at some point.

In Algebra, if you miss an i, a two becomes a three or

these magic identities don't cancel, okay.

So, start carefully.

I'll get right to you.

My tips and tricks here are really be systematic.

I would really go after how do I extract this.

That means I need the diagonal components of this.

So I can figure out which of this rows and columns contribute to that and

I just record one at a time.

If I record the whole thing, it's going to take pages and

pages just to write everything out and don't even need all the terms.

So just be smart use only the ones that you need and then you can derive it.

And then you eventually reduce it down to this form.

But to get to this form, you will also have to use the unit identity.

At some point you can have beta double prime one, beta double prime two, squared,

squared, squared, all added up.

And you recognize all these things are just one.

Well that's going to get rid of all of those, all right?

And then you apply it.

If you think you get here without ever applying the unit constraints,

you did some magic in your math.

I'd love to see that.

But, so this is kind of one thing.

So Jordan, you had a question?

>> Yeah, I don't know if this is indicated in the homework when we do this problem.

But how much are you okay with us doing Mathematica for this?

>> So, you're welcome to use Mathematica as well or MATLAB.

Both of those tools do symbolic manipulation.

It's not going to do everything for you.

Is not that smart yet.

Unfortunately I love it to do that, but it's going to get you there and then

probably have to manipulate and saying hey these terms apply this constraints.

So you're welcome to use symbolic manipulators as well.

Many in the class do.

Many in class have not used them before and this is typically the problem that

goes you know what this might be worth learning.

[LAUGH] Which is good.

These are fantastic,

this class has lots of algebra and I'm not grading on the algebra.

I'm grading on doing the right algebra, right, and that's where you come in.

So you're welcome to turn in mathematical code that you've developed and did it this

way and this is where I manipulated and this is how I get to the answer.

Or for many of you, it'll be purely done by hand, which works, it's just We need,

the key is don't do everything at once.

Figure out, I'm going after this one.

Which terms do I need?

If I'm going after this one, I needed two off diagonal terms differenced.

Go after only those two terms, and that's going to keep your algebra manageable.

Then it works pretty readily.

You can't drop any I's and J's and so forth, Katie.

>> And along that same note,

how much of our code are you wanting us to turn in for homework.

So if you're doing this as a derivation just show me everything.

It won't be that much.

I mean, you'll have some steps, then I take this, maybe you did it by hand,

you can handwrite over it, that's fine.

If it's a longer programming assignment like integrate these differential

equations just put the code at the back or

right there with the assignment, then we can see it.

Just include the code include the primary code.

Later on when I've done sub problems already that I can use as sub routines.

You don't have to turn in 60 pages of sub routines that you happen to use.

I'm really looking for the main integration parts like that so.

So for most it sends a being easy, if there's a question, and

this is really a lot, ping me.

If you've written in a way that's very verbose, and

you'd rather turn it in online, that part instead of printing everything out,

we've done that before as well.

Yes, Nathaniel?

>> Just a question, while we're on the topic.

You said in this class you'd like us to

develop sort of one program or one sort of set of programs.

>> Yes. >> When we have an assignment that you

sort of intend on us making something would you say explicitly code this up,

it will be used later or should we just be coding things?

>> Yeah I generally give some general guidelines.

Like for this integrator my suggestion is do it in a general way.

Lets make one program that computes these angle sets, but make it as a state vector.

And the integration we do it by hand in terms of the state vector set.

So now it's three coordinates, later on it might six coordinates or eight.

You could use the integrator and that's all you need at this stage.

7:12

I see some eyes pop up, right?

[LAUGH] Huge benefit.

Now, all of a sudden, you simply transpose it, bring it over to the left hand side,

and voila, you're there, all right?

[INAUDIBLE] The amazing, the beautiful, the elegant properties that come out of

the uniquarternions that give you these kind of direct addition subtraction.

So I don't have to go through this, but you will do it once.

It's a good practice to really understand these properties, all the stuff, and

then you'll prove this, to go from here to here.

But there's an inverse problem too.

What if I know this one and I know this one I cannot invert a one by four.

9:04

You'll be deriving them as well in the homeworks.

My tips here are also, you want to comparmentalize.

You will find getting the scalar requires certain types of math.

Getting the vectorial parts requires different math, one with a trace,

the other one we take off diagonal elements and sum and difference them So

just go after one at a time.

But once you've done the scalar and once you've done one of these

you don't have to go the homework through all the algebra for the other two.

Just show me the pattern.

This is how you set it up.

And at this point this is equivalent to what you just did for beta one prime.

This is how beta2-prime sets up, and then it's really the same algebra again.

You don't have to repeat the same algebra and get it all to convert three times.

So that's going to save you quite a bit of paperwork there, but

also the same thing with the DCM part.

Once you have the scalar parts defined, and that for addition, and now you want to

do the other one, once you do one of the vectorial parts, the patterns repeat.

So look for that, and that's going to greatly reduce the workload there.