0:06

I'm just going to work through the Mathematics.

Â I'm not going to do this by hand.

Â I'm going to show you in mathematic notebook, how we do this,

Â because there's all subtle details, because in the homework,

Â especially in the next homeworks, you're going to actually be running this stuff.

Â I'm giving you numbers, there is some key steps you want to do.

Â So here, the book comes with this rigid body kinematics library,

Â I'm going to use it.

Â It doesn't contain a tilde operator so here Mathematica.

Â Its like an M file in Math Lab if you're familiar with that or death in Python.

Â I'm just defining until the operator.

Â So let me execute these, so that's all good.

Â Now, what I'm doing next is in estimation if you do this mathematically,

Â you need the truth.

Â And the beauty in the math world is, we can make up truth.

Â We can say, the true orientation will be in this case

Â a 30 /20 -10 degree 321 euler angle set.

Â That's what I am defining, right?

Â And I am going to use that, use our mappings,

Â to go from euler angles to go from a DCM.

Â So, I am generating BN true and that will give me this matrix and I'll do that step.

Â That's kind of done.

Â The next set here is V1N.

Â This has two observations, like S and M, but instead of calling S and M,

Â it's just V1 and V2.

Â The first observation and the second observation and

Â the first observation in the initial frame is pointing

Â at 1,0,0 just keeping that simple and the second one is 0,0,1.

Â I need some unit vectors.

Â So those are defined and now the true measurements you should have is this is,

Â these vectors and N frame components times this DCM

Â should give me what I would measure at this orientation.

Â Again, assuming you've sensors where you measure using other orientation.

Â So these are the truth, and at least are given to four, five to six digits.

Â But those are the true measurement you would have.

Â 2:03

Now, when you're doing this stuff, we have to corrupt it.

Â And you can see here I'm taking the true measurements instead of 0.8137 and

Â so forth, I'm making it 819.

Â The third digit, I just randomly made something different.

Â If you do the research you would just by hand do this, you would have some

Â random noise generator with some colored noise, white noise, whatever you need.

Â You would artificially corrupt the truth, right?

Â because then you could look at it statistically how well am I

Â estimating this stuff?

Â I just did a simple hand example.

Â So that's where I'm taking this true measurements and I'm tweaking them but

Â a critical step here is we have to normalize them.

Â Don't forget that step.

Â Especially coming from homework assignments.

Â I am giving you these vectors and observations.

Â I am only giving you four or five digits.

Â That's not very precise.

Â Just take those and as the first step, normalize these vectors.

Â And now you are guaranteed it has unit length and all this math will work out.

Â Because otherwise, as we are putting these vectors into your DCM.

Â You have something that is only four digits to unit length vector and

Â your DCM won't be exactly orthogonal, right.

Â So make them to machine precision normal vectors and your life is much easier.

Â So that's a critical step I wanted to show there.

Â So now we do the triad frame.

Â We set t1 equals to v1.

Â V1 was my better measurement.

Â V2 was the ugly cousin that, the cheap one, that was a second measurement.

Â So we have t1 = v1B, but

Â everything's in B frame components which will give me these three vectors.

Â I'm just going to go evaluate this.

Â So this is t1, t2, t3, its within some precision that is showing me on the screen

Â that I quickly compute with the first setting in equal and

Â then a cross product and then another cross product of T1 and T2.

Â But every one of these matrices represent a vector in B frames now, right.

Â 3:54

Now, from the known measurements, I can do the same thing.

Â T1 in the M frame is V1 M, it's going to be equal to this then a cross product

Â gives you this and then another cross product gives you the third one.

Â This sets up the triad frame, same t1, t2, and t3 but

Â in N frame components, following our slides.

Â So now to find our corded frame,

Â we have to set up the B part D that we had, let me just show that.

Â 4:39

here's my mathematica.

Â So if I'm doing this here in Mathematica I can easily add them as rows not columns so

Â I'm adding my first row, second row, third row but then I transpose in the answer

Â that makes them first, second, third columns essentially.

Â And so that's my B T.

Â N bar t, the same thing and now all you have to do

Â is multiply one matrix times the other with the right transpose and that's it.

Â This is now my estimated attitude.

Â 5:20

this was the true DCM that we have.

Â 813798 and down here, we end up with 818799.

Â It's close, not exactly the same, right?

Â How good is this estimate?

Â >> And DCMs are horrible to give you that.

Â because you get the numbers and who knows,

Â I don't know it's kind of close, is that good?

Â Is that bad?

Â So we don't use DCMs to quantify this how close that estimate was to the truth in

Â this case.

Â What we do instead is we want to get the relative attitude.

Â 5:56

What is the attitude of b relative to br?

Â Right. The true B was here.

Â The estimated b wasn't exactly the same.

Â It's tweaked a little bit.

Â So in DCM space, I just need to know what is B to B bar or B bar to B.

Â That's the relative DCM that we need.

Â And we can do that again, matrix multiplication.

Â So I've got B bar to N and BN true.

Â Transpose one that gives me B bar to B and if I evaluate this,

Â now I get something that's actually for me easier to look at because I got a matrix.

Â But this is close to what type of matrix now?

Â 6:34

It's close to an entity.

Â Why is that expected?

Â The identity means what in DCM space?

Â >> Zero rotation.

Â >> Zero rotation, they're identical.

Â So your estimation, if you do good You should expect at this point something that

Â looks darn close to an identity matrix, right.

Â And that's what we get.

Â So, that's good but I still can say, is it really close, or just close.

Â I am an engineer, I want numbers, how close am I in this stuff?

Â And so, what we're going to do here,

Â the c to prv takes my DCM to principle rotation vector,

Â that was the p times e had one, the gamma one we had in our book.

Â That is what it is and the norm of it, and I'm converting to degrees just from here

Â we have to extract a principle rotation angle.

Â Different approaches how could have used that.

Â But that's what I'm getting.

Â This number, that's where that principle rotation angle is handy,

Â because the actual B frame and estimated B frame are close to within 1.85 degrees.

Â An estimation theory you don't typically care if you're off one degree about B1,

Â or one degree about B2 and so forth.

Â It's just I'm off by one degree, and

Â there's a whole series of rotations that could happen.

Â So that gives us our error in this estimation technique.

Â Yes sir.

Â >> Did you say that that rigid body kinematics thing came with the book?

Â 8:07

There's a library.

Â I always keep the latest ones up there so you can get the Mathematica,

Â MatLab, there is C versions of Rigid Body Kinematics and some other libraries.

Â So if you just go to my website there is a numerical tool section.

Â I keep the very latest one there.

Â With AA, I think last year I gave him the latest ones but I don't do it, monthly,

Â these I kind of tweak.

Â See on my website, you're welcome to just go there and you can find some of them.

Â Again, for the homeworks you're welcome to use this, perfectly fine, unless

Â the homework says create a sub routine that takes all other angles to DCM.

Â Don't just give me back my sub routine from my book believe me I've seen it,

Â I've written the bloody thing I will recognize it, do in your own style.

Â That's the purpose,

Â if it do this estimation stuff, you're welcome to use these tools absolutely.

Â Or write your own we both have Interesting, you know,

Â you can learn from both.

Â 8:57

Cool.

Â But I want to just step this through, and we're going to do this for

Â other methods, but that normalization of these vectors is really key,

Â otherwise you end up with something that's going to quickly cause issues.

Â If you measure only to 8 digits but enter in your computer,

Â you're holding 16 digits, take that measurement and normalize it again.

Â That way, you're making sure this DCM has a proper orthogonal behavior that you

Â would expect, or you're going to be stretching and

Â scaling these vectors in ways you didn't necessarily want them to be.

Â