0:35

Looks actually pretty compact.

Â All you see is quaternions, there's no fractions of quaternions,

Â there's no ratios.

Â Ratios are always tricky because the denominator could go to zero

Â potentially right.

Â We don't even have a ratio here.

Â It's just quaternions squares and some the differenced in different ways.

Â There's clear patterns there.

Â So it's really nice and easy to program.

Â In the Book Two, I show you other compact vector

Â notations instead of matrix component notations of this.

Â And in your current homework actually, I'm asking you to derive this stuff.

Â 1:17

You will have to use these identities that the sum squared of quaternion

Â is equal to 1.

Â because sometimes you get a form and like, well that looks close but not quite right.

Â But if B1 squared and B2 and B3 and B naught squared all equal to 1.

Â Wel, l then beta null squared is one minus the other three, right?

Â And sometimes you can substitute that and manipulate it,

Â now you're applying these constraints.

Â So those are the tricks you have to kind of do to get there.

Â So very easy mapping, no singularities, no issues with these numbers.

Â Now, how do we get the inverse?

Â This is going to look very similar in the mathematics here

Â to how we went from the DCM to the principle rotation parameters.

Â 1:57

To get the angle, we end up taking the trace of the matrix and

Â there was an inverse cosine somewhere to get all this stuff worked out, but

Â it was a trace of the matrix that was the key.

Â Remember beta naught actually only depends on the cosine of Phi over 2.

Â So also it depends on a principle rotation angle.

Â So we still use the trace of the matrix.

Â If you take this term, this term, and this term and add them up, you add 1 to it,

Â take the square root and then 1 over 2.

Â You will end up with beta naught.

Â 2:32

And I'm going to let you validate the algebra.

Â You guys know how to do algebra, but validate for this.

Â You'll see this pattern as you work through these things with the homework.

Â But that's it.

Â So if this by itself gives me, for beta naught squared is trace + 1,

Â taking the square root I have to get two possible answers, right?

Â This is what we expect.

Â If you know there's two possible sets for an attitude and you go from a DCM and

Â get these coordinants and there's only one set of coordinants, something went wrong.

Â Somewhere we have to have four possible, sorry, in this case two possible sets, and

Â this is where it appears.

Â So either you pick a beta naught that's positive or negative.

Â So Kyle, right?

Â No Cody, sorry.

Â You were Kyle. [LAUGH]

Â >> Casey.

Â 3:33

Let's be honest, when you're programming what are you going to pick?

Â Yeah, we're all lazy.

Â Why add that extra negative sign.

Â That's an extra keystroke, really.

Â That's just really pushing it.

Â Now, so when we're programming we do, hey this is the square root of this,

Â human nature's going to go [SOUND] just pick the plus version.

Â Turns out human nature for once is right.

Â That's actually typically the most convenient

Â answer because beta naught being positive.

Â Sorry, what was your name again?

Â Yes, right there.

Â >> Lucas. >> Lucas.

Â Is that a short or the long rotation if beta naught is positive?

Â That's the short rotation, right?

Â If I have zero rotation, beta naught is 1.

Â If I have 180 degrees, the beta naught reduces to 0.

Â And if I have more than 180 degrees it goes below 0 down to -1.

Â Like the DCNs though beta naught, betas can never exceed one in value

Â otherwise you're going to violate the unit norm constraint.

Â 4:22

So good, so people tend to just pick the plus one but if for some reason you needed

Â the long rotation and there are actually cases where this could be happening.

Â So it does depend on situations, one of them could be you're doing a maneuver and

Â you have to avoid the sun, I want to rotate from here to here without my

Â sensor ever looking straight at you guys.

Â You guys are just too bright.

Â You're going to blind the sensor and burn out pixels.

Â So instead of doing the short way around, we might go,

Â the short way gets me too close.

Â If it's a single avoidance cone and the sun exclusion region you can just go,

Â you know what, for the control just do it all the way around this way and

Â that's when I'm going to drive back.

Â It's a simple example where you might choose to do the long rotation.

Â That's where you control it, right here, with the minus sign.

Â Once you've picked a minus sign, the rest of the math, if you look here.

Â And again, this is trivial.

Â You can see one of them, if I subtract one of these off diagonal elements,

Â these parts are always symmetric.

Â And they're just going to cancel.

Â Leaving you with these other parts, in this case beta threes.

Â I know beta naught and then I can just divide through it and then I get it.

Â Now don't flip signs anymore.

Â You've just get to flip the sign once.

Â That's for beta naught, everything else is completely determined, and

Â this will give you all the four betas.

Â Yes.

Â >> Is it possible the beta not be zero?

Â Is it possible for it not to be zero?

Â >> It is possible for it to be zero.

Â >> Yes, what orientation would that be?

Â When is beta not zero?

Â 6:15

So, this formula is very convenient, but do not program this on the flight system,

Â because otherwise, you're going to introduce singularities just because of

Â your method of how you pulled quaternions from this system, all right.

Â And when it is zero could you use the ultimate set?

Â Well mine is zero, it's still zero.

Â So short and long doesn't really mean anything when you're at one eighty.

Â This method just has issues with this, so

Â there's an ultimate method that I'm about to discuss.

Â And that's the one I really would recommend the singular of that,

Â the Shepherd's method.

Â 6:53

Lets talk this through, this is a slightly modified version of that.

Â The first one I showed you is easy to see,

Â because you can just look at the patterns and it's almost like the PRV stuff.

Â You can see trace, you can see delph diagonal differences and

Â quickly you find the formulas but

Â we there, the fundamentally what we did is we found beta naught first and

Â then we find the other three by dividing by the one we found first.

Â And the one we found could go to zero.

Â That's a very real thing especially if you're in a tumbling situation.

Â So is there a better way a more robust way to extract these coordinants?

Â So this is Shepherds method, and instead of just finding beta naught squared

Â first and then doing the square root and deciding + -, we actually found

Â beta naught squares beta 1 squared, beta 2 squared and beta 3 squared.

Â And so looking at these formulas I will let you look at this yourself.

Â This is the trace, this is what we had earlier in the slide.

Â But using the trace and

Â these other elements, you can quickly just double check the algebra,

Â got yup, these formulas do give you beta one squared, beta two, beta three squared.

Â So we can compute all of these.

Â So could we just stop here take the square root of each one of those, and I'm done.

Â Matt, what do you think?

Â 8:10

The answer is obviously no, otherwise I wouldn't continue with this stuff, right?

Â But the real question is why, why don't I just stop here?

Â >> [INAUDIBLE] >> Exactly, that's it.

Â because there's two sets we said.

Â And one's just a minus of the other.

Â However, you have to be consistent.

Â You don't just change the sign on one of the betas.

Â If you're changing the sign, it has to be on all four simultaneously.

Â Otherwise, you're not looking at two points that are anti-points

Â along this unit sphere.

Â But you've just flipped one to the other quadrant, and

Â that's a whole different orientation.

Â So with this formula,

Â we do know the magnitude squared of every beta, I just don't know the right sign.

Â So this is why we can't stop here.

Â It puts you on the wrong quadrant on this

Â four dimensional space that we're dealing with.

Â So we have to go further.

Â So before we just had three formulas taking differences

Â of the off diagonal terms and that's how we found beta one,two,three.

Â Here,this is a slightly modified version,you can see three differences

Â and three additions of diagonals,so you end up with six possible equations.

Â 10:20

What must it's, if I have B naught, B1, B2 and B3, what equation must they satisfy?

Â [INAUDIBLE] >> Exactly, right?

Â They have to reside on this unit surface.

Â It's just a hyper surface because it's in four dimensional space.

Â But they have to reside on the surface.

Â There's no way you can go from, if you think of the Earth's globe,

Â let's pretend it's a three dimensional surface, right?

Â We have to move on the surface of the Earth, I wouldn't all

Â of a sudden have a position that just tricks me to the center of the Earth.

Â That would give me 0-0-0 coordinates.

Â I cannot have 0-0-0-0,

Â four zero's here because I have to reside by the units sphere.

Â That would violate the unit [corturnium?] condition.

Â So by definition, it's not possible that all four of them are zero.

Â 12:00

>> So, right now, we know we're going to have to divide by whichever one we pick.

Â So, I'm picking, the first step is pick the largest square of a quaternian and

Â then I'm going to have to here, if I pick beta 2,

Â I'm going to divide by beta 2 here.

Â So I have to find out what is beta 2?

Â Not beta 2 squared.

Â I take the square root of this term and

Â square roots have two possible answers, plus and minus.

Â Do you pick plus or do you pick minus?

Â 13:07

that would give you a minus beta 2, but you're still doing a short rotation.

Â It's the quaternion that responds to the scalar part, which is, here, beta not.

Â That was always [INAUDIBLE] So here, if we want the short one,

Â we would pick the positive one.

Â Yes, Casey?

Â >> [INAUDIBLE] >> No, not really.

Â The reason I picked the positive one is because I just don't know and

Â the lack of knowledge.

Â So, in this case these I don't know if I pick a positive or negative,

Â I'm not going to be guaranteed a short or long.

Â Without looking at this one as a result of that choice I can't make

Â that determination.

Â So for this modified one don't spend a lot of time

Â dreading over positive and negative.

Â Just encoding people to pick the positive one, right it's a valid description.

Â And we're not going to finish this method and at the end I can look at my beta and

Â not the scale one and see if I picked the long or short, if it is long, I flip them.

Â To give back the short rotation.

Â At this stage you don't have enough information to really determine that.

Â So I'm glad you guys made that distinction.

Â Don't pick beta 1, 2 and 3 to do long or short.

Â You can't pull that information from there.

Â So let's say beta 2 was the largest.

Â You do the math, do the square root.

Â And pick the positive one.

Â Just Because I don't know, so I'll make it easy, pick the positive one.

Â Here, you have to pick the three equations that have beta two,

Â which is this one, this one, and this one.

Â So, you divide this right hand side by beta two to get beta naught, all right.

Â You divide this equation by beta two and you end up with beta one.

Â And you divide this equation by beta two and you get beta three.

Â So in your code you end up with these if statements.

Â If this is the largest then I use these three,

Â if this is the largest I use this, this and this.

Â If beta one is the largest I would use this one and these two, and so forth.

Â Right.

Â Yes.

Â >> Do we pick the largest for numerical reasons?

Â >> Yes. >> Okay.

Â >> Yeah, because you have finite degree.

Â And especially if you're dealing with old five computers that only had

Â eight bits and other stuff, then you can start to really make a difference.

Â With 16 bits if you picked 0.4 or 0.6, it doesn't make much difference.

Â So just again people just go with the biggest.

Â Which one of those is the biggest?

Â I found the good big one, off I go.

Â That's it.

Â So, this is the step.

Â So, instead of just having one set of the trace, and

Â then taking three of these formulas, we end up kind of, the first step is find

Â the biggest quaternion squared, take the square root, just keep it positive.

Â Use the right three formulas to get the other three and now as a final step we can

Â check that we have the short rotation, if you want that.

Â If you don't care, the you either quarternion is correct.

Â That makes sense?

Â So this is Shepard's Method, this is typically what we use.

Â And that's whats coded up typically because now you're completely singularity

Â free, but it takes some logic thinking there to see get good conditioning,

Â and pick the right numbers and the right formulas to extract it.

Â These quaternions always exist.

Â