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.

Â