Euler Angles and the Euler Rotation Sequence

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone and welcome to another video today I'd like to talk about Euler angles or the angles are three angles that were developed and introduced by the very famous mathematician Leonhard Euler in the 1700s and we're going to see that they help play a very important role in describing the orientation of an object in space now since I'm an aerospace engineer the examples I typically like to look at involve aircraft so why don't we go ahead and let's take this GI Joe Toye aircraft in it as an example so what I'd like to do is I'd like to be able to describe the orientation of this aircraft in space so the first thing I need to talk about is orientation with respect to what so we need to define a reference coordinate frame and I think that's pretty easy to do why don't we take some virtual point maybe right here I'll call this the origin where my fist is and in my case North is actually pointing that directly that direction East is coming out of the page directly toward the camera and then a right handed coordinate system is going to make the z-axis be the down axis which is obviously down toward the floor so that gives us the north east down with its XYZ axes respectively so let's call that our reference frame now as I'm sure you know you can attach another coordinate frame to say this aircraft so this aircraft has a center of gravity let's call that the origin let's place that origin at the same origin as this northeast down frame so for example right here something like that now as you know the x axis for the body frame of the aircraft starts with its origin at the center of gravity and then the x axis comes out the nose the y axis comes out the right wing tip and the z axis makes a right handed coordinate system which comes through the floorboard of the aircraft now as you can see right here we have a slight I don't want to call it a problem because it actually is kind of interesting it makes it a challenge but we see that the body frame is not aligned with the reference frame the Northeast down frame so what we want to do is we want to be able to describe how are these two frames quote unquote misaligned or different than one another right what is the orientation of the body frame with respect to this reference frame or the Northeast down frame now we're going to see that is exactly what other angles do help us describe these the differences in these two frames so what we need to do is we need to jump over and start thinking about exactly what are the definition of these Euler angles as well as develop some of the mathematics that might be necessary to operate on Euler angles and subsequent operations so if that sounds like more fun than a clown on fire why don't we jump over to the whiteboard and get started okay so why don't we jump into it so one thing that I'll mention right off the bat is the thing that makes wheeler angles actually interesting is not only are they just three angles but they are actually associated with an Euler rotation sequence so let's write that down not only do we care about the angles but we actually care about the Euler rotation sequence what I mean by that is that there's a specific order of rotations that we need to perform so the goal with the Euler angles and this Euler rotation sequence is I want to basically be able to develop a set of rotations to go or start in some reference frame we're gonna call this F V here F V for the vehicle carried northeast down frame the one that we were just talking about okay I want to be able to start in the vehicle carry northeast down frame and I want to be able to end in F be right which was the vehicle carried body frame okay that's the whole goal of the Euler angles in this Euler rotation sequence is to basically develop a rotation matrix that is going to take a vector expressed in F V to make it expressed in F be the goal the way that we're gonna do this here is we're going to first we're gonna start in the northeast down frame okay so again maybe let's write this down F V is the same thing as F northeast down okay and what we're gonna do is you're gonna go through a series of three rotations which use two intermediate frames so the first thing we're going to do in this or the rotation sequence is we are going to use a right-handed rotation about the Z V axis okay which is going to be the same thing as the Z we're gonna call this the one frame we're gonna see you later this is these intermediate frames and we're talking about so the first intermediate frame we're going to call the one frame we're gonna go through this right-handed rotation about z V through angle sigh okay and this goes and it gets us to go to f1 and again bear with me if some of this notation might not make a ton of sense right now but it will in a second I just want to write down the sequence okay so that's a first thing we're gonna rotate about the z axis through angle sy to get to frame one then once we're at frame one we're going to do another right-handed rotation about narrow we're going to go about the y axis and this is going to be the y one axis which is going to be the same thing as y two these two axes are going to be aligned and we're gonna rotate now through angle theta okay and again this is to go to F to our second intermediate frame okay and then finally the third and final step that we need to do is we need to take a right handed rotation about the x2 frame okay which is gonna be the same thing as the X body frame right the one that we're trying to end at okay and we're going to rotate through the angle five and then this is basically to go to finally F body okay so that's the general gist of it we were gonna start in the vehicle carried northeast down frame we are then going to rotate through angle sigh by rotating about the z axis that will get us to the one frame once we're at the one frame we are gonna then rotate about the y axis through angle theta to get to the two frame then finally we're going to go from the two frame by rotating about the x axis through angle five okay so this might be a good point to maybe pump the brakes a little bit and if not familiar with all of this discussion on the rotation or rotation matrices or these frames I would highly recommend taking a moment make sure you've watched our previous video where we discuss expressing vectors in different frames using rotation matrices because we're about to jump into it and utilize those rotation matrices quite extensively okay so if you've done all that um I think we should be okay so maybe let's draw a picture of this so we're all on the same page about what do these three rotations look like so the first one let's let's draw a picture for the or the sequence one okay so we said sequence one was basically rotating about Z right the Z V which is the same thing as a z1 axis so what I mean by that is let's draw ourselves the Northeast down frame okay so I'm gonna make North in this direction let's so let's call this X of the vehicle northeast down frame this is basically north okay then East is this way so here's the y-axis of the north east down frame well this is basically the east direction and then down is into the page in this case right so here's Z of the vehicle carried north east down frame which we're also going down okay now the idea is I want to now rotate my aircraft or my body or whatever so through some angle sigh which is up rotated about the z axis right so the z axis is into the board so a positive right-handed rotation of about the z axis is going to yield me this one frame which sort of looks like this so here's my X of the one frame through angle sigh okay and then similarly you would have Y of the one frame and then here's where you can see that Z of the one frame they're the same thing right because I'm rotating about the z axis the Z of the Northeast down frame is the same thing it's the same axis as a z of the one frame okay so the idea is we're gonna start in the vehicle northeast now Frank we're gonna rotate my aircraft so that it now is aligned with this one frame so I'm gonna this is my horrible picture of an aircraft oh gosh this is gonna make this thing very let me go let me clean some of this up so we can hopefully see this a little bit better okay so here's my horrible picture of an aircraft so something like that you get that right here's the wings here's the the the empanadas and the vertical horizontal stabilizer gosh that's a horrible picture maybe let me get my let me get my prop here maybe this is an easier way to say it right so the vehicle starts aligned with the the Northeast down frame and now I'm gonna rotate it about the z axis through angle sy to get to this one frame okay so that's the that's how these things that are different okay alright so that's the picture that goes along with the first sequence how about the second sequence okay so sequence two right this is a rotation about what do we say the y axis right about y1 which is the same thing as the Y of the two frame right so that's sequence - okay so again let's draw this picture and I think it's probably easier to look at it from the side so again let's draw the origin here okay and now the one frame let's just make this thing sort of aligned like such maybe I'll try to take up so much of room I might need that room in a second here okay so here is the x-axis of the one frame the y-axis of the one frame is coming out of the page okay and then the z-axis of the one frame is obviously down okay so there's our right-handed one frame now if we look at this sequence here for for rotation number two I'm gonna rotate about the Y one axis which is coming out of the board right so now in this case coming out of the board is is the road the axis of rotation so a positive right-handed angle theta is actually in this direction right so a positive is something like that so here's the X here's how the x-axis will rotate from the one frame up to the two frame through a positive angle positive theta maybe we should have put the positive sign on this - just to make sure we're we're on the same page okay so again that's gonna obviously make the z-axis also rotate here z - and you can see why again why the y1 frame and the y 2 frame are this sorry axes are the exact same right because we're both rotating about the y axis as the axis of rotation so they stay the same both of them are still coming out of the page so now if I wanted to draw our aircraft I guess this is now our side view of the aircraft here's the cockpit oh boy and again I apologize I am NOT the best artiste so here's maybe our wing here's the cockpit right so again maybe the better way to do it is look at our prop so we did a couple of things first of all we were aligned with the Northeast down frame we rotated about the z-axis through angle sy that got us to this orientation okay and now what we're going to do is were going to rotate about the common Y axis which is coming out of the page up through angle theta to get this thing pitched up slightly okay great so now the last thing that we need to do is rotation sequence number three and let's see if we can shove all this in in the boards in one place so sequence three this was a rotation about the x-axis right the X to which we said is going to be that oops the x2 which is the same thing as X body okay so the picture that goes along with this is I think maybe it's easiest if we look at this kind of from the back okay so if we look at it from the back what we've got here is let's draw the y2 frame to start with so here's y2 is in this direction okay x2 is going into the board so here's x2 going into the board and then finally that means a right handed rotate coordinate frame z2 is down like such okay now reading this we said that we're going to rotate about the X 2 axis so again X is going into the board so a positive angle Phi is going to look something like this it's going to rotate this picture to make this look like the Y body so here's our positive angle Phi right and that'll also a kick over the z-axis so now here's Z body and again we have the same thing the x2 and the X body axes stay the same because that's the axis of rotation so now again if we draw the aircraft or again we're looking at it from the back so gosh how am I gonna draw this so here's here's one of the wings here's another one of the wings and then I guess we should probably see the tail like this here's the T tail configuration and maybe the cockpit is over here so again my horrible picture is you know we're looking at the back of the Erica I don't know if you can see that too well in the camera but you're looking at the back of the aircraft and now we're going to rotate that way right the right wing tip goes down for a positive Phi okay that gets us to the body axis so what if we put all of this together maybe I'll come over here where you can see this a little bit better what we're talking about now is let's let's point it let's again let's go back to our example I guess what we're gonna pretend North is is that direction okay so what these three Euler angles are are they're defined relative to these intermediate frames so this first angle Sai that angle Sai is how much do we rotate about the z axis so we're gonna rotate this aircraft through an angle side so in that case that was that looked about like saya 45 degrees or something like that to me so now we're not pointing north we're kind of pointing northeast exactly actually exactly northeast in this case okay now we're gonna go to this rotate through an angle theta so if theta was was I don't know uh 20 degrees all I would do is I would tip this up 20 degrees from where we are now okay that's 20 degrees and now we are we can use the angle Phi which is sort of our quorum call bank angle again I put this in quotes you're gonna see why I'm putting this in quotes a little bit later when I discuss theirs we gotta be a little bit careful but our bank angle now is let's make something up again 45 degrees or something that so what take a look let's make it negative 45 just to be interesting so negative 45 degrees would mean from this frame right right now we're sitting in the two frame correct now I want to rotate from the two frame through negative 45 degrees that's actually this direction right a left-handed rotation so something like this so now this aircraft right now though or this body frame is oriented associated with an Euler angle of sigh of 45 degrees theta of what do we say 20 degrees and Phi of negative 45 degrees okay so that's what these other angles are again I apologize if that was not entirely clear from me like drawing this out on the board or playing with toys why don't we jump over to MATLAB I've got an animation to show you how these order angles and all these intermediate frames play together so let's jump over to MATLAB real quick and let's see if we can visualize this a little bit better all right so to get a little bit more practice let's use slightly different numbers let's use a Phi Theta inside of positive 70 positive 130 and positive 225 degrees for the yaw pitch and Bank angle respectively so the first thing that we want to do is let's draw the starting frame or our vehicle carry northeast down frame which we were calling FV so again the x-axis is pointing directly north the y-axis is pointing directly east and the z-axis is pointing directly down so the first thing we want to do in our Euler rotation sequence is starting from this V frame we want to rotate about the z axis through the yaw angle of sight equals positive 70 degrees so let me just draw the one frame in green so the green frame is f1 and as we can see if sy is equal to zero as you can see in the figure title there's no difference between the one frame and the V frame however as we start increasing the sy Euler angle we see that we offset the one frame from the V frame by rotating through the common z-axis and now we reach the one frame as drawn here in green so the next thing we want to do is we are now going to pitch through the y axis to go from the one frame to the two frame so that's what I'm drawing here in orange so orange here is the two frame and again as you can see if theta is equals zero if the pitch angle is zero there's no difference between the two frame and the one frame so there's no difference between the orange frame and the green frame however as theta starts increasing what we're gonna do is we are going to start rotating about the common y-axis right so that here is is this axis right here so this is the y one axis which should be the same thing as the Y two axis so let me go ahead and let the animation run and what we're gonna do is as the pitch angle increases you see that the two frame just starts being offset from the one frame but their Y axes stay the same right that's the axis of rotation so the third and final sequence in our Euler rotation system is to use the bank angle of positive twenty five degrees so again let me just draw that here in blue so blue is our final body frame right and right now if the bank angle is zero again as denoted here in the title the body frame in blue is the same thing as the two frame which is drawn back here in orange now what we have to do is now we are going to rotate about the x axis right the X body axis which is the same thing as the x2 axis and that should be this one right here okay so again let's let the animation run and you can see that if we Bank through positive twenty five degrees the body axis in blue becomes offset from the two frame which is in orange okay and now we finally arrive at the body axis in blue which is now relative and offset from the vehicle carry northeast down frame here in red and tell you what just to to make that clear I will draw them here without any of the intermediate frames so again all we were trying to do here is describe how this body frame in blue is different or oriented slightly offset from the reference frame which we drew here in red and we saw that the way we got there was by going through this Euler rotation sequence of utilizing those two intermediate frames of f1 and f2 okay and actually tell you what let me let me just rerun this entire animation without stopping and maybe we'll plug one of them on top of each other and let it all run smoothly in one shot so it might make a little more sense so let me go ahead and close all these and again we can just refresh our memories and we said that we're going through it a young angle of 70 degrees first about the z-axis then we're gonna pitch through 130 degrees by rotating about the resulting Y axis and then we are going to Bank through positive 25 degrees through that subsequent resulting Z x-axis excuse me so if I just run that whole script one at a time we see here's the Z rotation and then where here's the Y rotation and now here's the X rotation and we finally end up at our body frame relative to the V frame so for giggles I'm just gonna run this one more time so you can see how those three sequences interact with one another and we see that they are subsequent sequences one follows the other okay all right so with that being said I think it would now be helpful now that we can visualize and understand how we go from the vehicle carrying northeast down frame to the body frame let's jump back over to the white board and look exactly and what are the rotation matrices and the equations that we need to relate one another alright so now that we saw how those oiler angles are defined I think we can start writing down what are the equations that relate a vector expressed in the vehicle carrying northeast down frame to a vector express in the body frame using these two intermediate frames so as a quick disclaimer we're going to be using some notation using rotation matrices and expressing vectors that we covered in one of our previous videos so if you haven't watched this video please make sure you watch this first because we're going to be leveraging a lot of the tools we developed in that in the subsequent math so to start with I left up our core the rotation sequence here on the board cuz we're going to want to use this and help us refer to the sequence because we're gonna see that the sequence is actually key so the first thing let's do is let's tackle this first rotation here which goes from the V frame to the one frame so in other words what I'm saying is let's say that we've got a vector right expressed in the vehicle carrying northeast down frame right that's that's the this one right here right and now what we're going to do is we're going to rotate about the z axis through an angle side so all that is right is that's a rotation matrix from a from one frame to another about a z-axis through an angle sighs so all that is right is it's a rotation matrix from V to the one frame through the angle side right and that is going to yield a vector the same vector but now expressed in the one frame okay so in this case this rotation matrix that we said earlier and our other lecture right as we said that this c1v oversight right the oldest guy is it's a rotation matrix I guess we're gonna run out of room here let me let me just erase part of this picture so we can have enough room to draw the rotation matrix hopefully you've got the rest of that in your notes right this is just again it's a three by three rotation matrix about the z-axis so we've got a one down here and then 0 0 0 0 and then in these other intermediate entries all this is right this is now just cosine sorry sine so i minus sine sigh and then cosine sine right that's all that rotation matrix is so there we go we are basically we've taken care of this first rotation okay now let's my optically look at just this second sequence of our or the rotation sequence right so just this second rotation right here all this is is if you look at this long enough again it's just a rotation from a starting frame to an ending frame by rotating about a common Y axis through an angle theta here so in other words what we're gonna say is let's say you have a vector expressed in the starting frame which was just the one frame right and I want to rotate this using a rotation matrix which goes from the one frame to the two frame rate goes from the starting frame to the ending frame through an angle theta right so we're going to note it like such this and that is going to give us this exact same vector but now expressed in the two frame and again this thing is right is this rotation matrix is if we want to write this thing out to one theta right it's again another 3x3 rotation matrix sorry I'm gonna have to keep erasing my picture to get us a little bit more room okay again it is a 3x3 rotation matrix but all we're doing now is we're rotating about the common Y axis so the the ones got to go here and put out zeros everywhere else and other terms and then to get the rotation it's now just cosine theta all right and then minus sine theta sine theta cosine theta great so that's does it let's take a care of this second sequencing now again let's come down here to the third sequence or the third rotation on our Euler rotation sequence and just myopically stare at just this one so that's over here again if you look at this picture again all it is it's a rotating from some starting frame to some ending frame by rotating about a common x axis through the angle Phi okay so again we're saying I've got a vector now expressed in what the starting frame is which is now in this case - and I'm gonna rotate this guy from - to the ending frame which is the body frame right to the body frame through an angle Phi okay and that's gonna yield me a vector expressed in the ending frame which is the body frame and again this rotation matrix this c2 to be through the angle Phi it's again it's nothing more than a three by three rotation matrix about a common x axis so the X the one goes here and then these terms are going to be cosine Phi sine Phi and then minus sine Phi and then cosine Phi there we go okay so well we can now is I guess we can continue over here let's let's see if I can jam all this into this small part can you actually see that on the board yeah okay good so let's go ahead and I may about draw a line here we'll start what I want to do is let's see if we can now get an expression which takes us from the starting frame our original strategy frame which is the vehicle carrying northeast down frame all the way to a vector express in the body frame okay so let's just start with this equation right it says you b is equal to c b2 of phi x u2 right okay and well what is you two well if you look here here's an expression for u 2 so let's just take this right here and substitute in for you two all right so this now becomes cb2 of Phi and now I'm going to substitute my expression for u 2 which is this one right here right it's c2 1 over theta times u 1 right ok now again where's u1 aha here's an expression for u 1 right here so again substitute this in for u 1 and again ah shucks I'm running out of room aha I hope this is gonna fit cb2 let me see if I can just try to draw this cleanly c2 1 over theta and our expression for u 1 is going to be C 1 V over sy times U V perfect and now let's box this thing up all right and maybe I can fit everything on to this is onto the board ok this here is our expression which goes from the body our sorry goes from the northeast down frame to the body frame and though that's the one single rotation matrix that's going to take that care of that for us is actually the product of these three rotation matrices multiplied like such so this whole thing the thing I'm circling here in blue right we could alternatively write this in one compact form where can I do that I want to keep this line up because uh tell you what look let's erase some of this up here okay let's erase this I think we don't need the picture too much we're gonna leave the words up okay all right so what we end up with our final expression here is basically that you have a vector in the vehicle carrying northeast down frame I want the vector expressed in the body frame it is going to be some matrix right it's some rotation matrix which goes from V to be right and now this is a function of actually five theta and sigh okay and what this matrix is it's just this term in blue here so here this thing is one giant rotation matrix EB let's see what do we call Phi Theta this I write this thing is the product of these things all together right it's cb2 phi times c2 1 theta times c1 v sigh all right so well boy I don't want to do this by hand because as you can see it's it's three matrix multiplies with a bunch of cosine signs let's run over to Mathematica and have it calculate this we'll just do this quickly just so we can see what exactly is this matrix okay all right so let's go ahead and define those intermediate rotation matrices so let's do the first one so this was going from the northeast down to the one frame through the angle Sai and again we said that was a three by three rotation matrix matrix where it looked something like that right so then we got cosign of Sai sign of Sai and then minus sign of Sai and then cosine of saya right whoops psi ok that was the first rotation matrix and then the second rotation matrix actually I've got this already copied here so you don't watch me type it all in but here this is going from the 1 to the 2 frame over the angle theta and finally the third rotation matrix which was going from the 2 to the body frame over the angle Phi was some thing like that okay so now what we can do is we can go ahead and get the final rotation matrix well tell you what let's let's shift enter and get those guys into Mathematica first and now let's compute the final rotation matrix right we said this is going ah whoops I got it the wrong way I got to make sure we get this right BV right so this is going from the vehicle northeast down frame to the body frame and we said this was as a function of Phi Theta and sigh right and this was going to actually be what its CB to of Phi so that time C to 1 of theta times c1 V of sigh there we go so that's what this should be so let's shift enter that guy and now let's take a look at what this guy looks like and as you can see it's uh it's it's not pretty but it's easily calculate able so we can calculate it quite easily so let's jump over the board and ask ourselves what does this thing do what's it called how can we use it and things like all right I'm trying to transcribe as best as I could the Mathematica output here to the board I've used some abbreviations like C theta means cosine theta and you know s Phi means sine of Phi just to save ourselves some room and and again I might have made some mistakes here so trust what was on the Mathematica output and not necessarily what about what was put up here but I just want to just again point out that again this rotation matrix it's just a three by three rotation matrix and all of its entries are just a whole bunch of cosines and sines of the Euler angles okay so this here is this rotation matrix which takes us from the vehicle carried northeast down frame to the body frame now the one thing that I might want to note here we might want to discuss here is if you think about this long enough we might also want to add a slight bit of notation to this rotation matrix so we might want to call this you know oh I'm sorry V to be over again of Phi Theta sigh right but the reason I've kept this up on the board for so long is because it's now relevant to our discussion in the sense that these wheeler angles sine theta and Phi they are referenced to a very specific seek or ordering here of going about the z-axis then the y axis then the x axis so we might want to say put a superscript or something that that says this is like z Y X right to denote that that's the sequence that this Euler angle rotation sequence is taken with right there's nothing that said we couldn't have gone X Y Z or Z X Y right some other arbitrary order so it might help to add this notation here right so that you're very explicit about what are these Euler angles okay so that's the first thing to note here is let's make a quick note length n 1 order matters right so this sequence of zy x is typically understood to be the standard version in the aerospace industry so usually we will drop this notation so if you don't see explicit notation about what the sequence of the Euler rotation angles are understand it to be at least an aerospace application is it is going to be z Y X in this order right the other thing to also note let's make a note n - ok typically most people again while we're talking about aerospace conventions here aerospace conventions people are typically going to be want to be talking about Phi Theta psy kind of in that order so I've written that here as the order of the input arguments of this oiler rotation sequence okay now this is well I'll just maybe write that v theta psy is typical reference order so people when you're when you're putting together a state vector or things like that typically it goes 5 theta side now the reason I again call this out here is if you look at this it's a little bit m-michael clang in your head because really you're actually rotating oversee then theta then phi so your natural inclination might be to say oh i'll talk about things if I give someone a sequence of three or their angles I'll give them size Theta Phi ok you just have to be careful about what you're doing here because most people in aerospace are going to assume that if give them three three Euler angles it's gonna be Bank pitch yaw right so in other words if somebody gives you a vector or you're reading this in code and you see something like Oh your state vector is something like thirty degrees eighty degrees negative twenty degrees right you just have to be very explicit which one of these are these most likely this means this is Phi Theta inside right so it means that you have a bank angle of thirty a pitch angle of eighty and a yaw angle of negative twenty degrees even though the actual ordering of how you execute those rotations is actually the other way around right you first y'all through negative twenty then you pitch through eighty degrees and then you Bank by positive thirty degrees but as long as we're all consistent we're all on the same page I think everything should work out so this is typically understood to be the rotation matrix which takes you from the Northeast down to the body frame the way you get there is you go through this ordering of you first go rotate about the z axis then the y axis then the x axis so again you typically won't see this superscript notation but just be cognizant of where you are doing this okay all right so I cleaned up the board a little bit to get us some room a couple more remarks about this matrix this rotation matrix this product of these three matrices you'll also sometimes or hear this referred to as the direction cosine matrix or DCM and you can kind of see where it gets this name right it has something to do with tell you about directions and as you can see there's a lot of cosines and sines in it so this is sometimes referred to as the DCM one thing that we might want to make a quick note of here is this DCM isn't necessarily unique in the sense that you can have different sequences of Euler rotations that will get you to the same DCM and therefore get you to the same sort of orientation of the aircraft so as a quick example maybe let's come back to our arm our aircraft toy here right and we said that okay typically you know here's your starting northeast down frame let's rotate this to some new body frame like for example what happens in we were to just do nothing but pitch through 180 degrees okay so all the only order angle that we're gonna have is let's look at maybe case one where your Phi is equal to 0 theta is equal to 180 degrees I'll write this in radians and then your Bank angle is 0 right so what that looks like is okay you start here and all you're gonna do is pitch through 180 degrees so you basically end up with the vehicle flat on its back pointing due south right okay so that's one way you could get to this orientation but another sequence of Euler angles that could also get you there right is what if you were to say yaw through 180 degrees whoops 180 times pi over 180 you were then to do no pitch at all but you then Bank through 180 degrees again okay so again going through our Euler rotation sequence now for case two that is yaw through 180 degrees which will get you pointing like this okay Bank sorry pitch through zero degrees and then Bank through 180 degrees a positive hundred eighty and I got to make sure I get that right so the positive rather than the resulting x-axis so you get like this right so again we end up in the exact same orientation right given to two completely separate sequences of Euler angles both of these if you plug these two into your DCM both of those are going to result in a DCM which equals front I wrote it down so I want to forget you can even plug it into Mathematica basically just jam those sequences into the DCM expression I think you're going to get minus 1 0 0 0 1 0 0 0 minus 1 ok so again we got to be a little bit careful and just make a note here that these other angles are not unique here ok so all this leads to a discussion here that Euler angles are not unique okay this has some bearing on some of this discussion now you may have heard of gimble or things like that and actually this sets the stage nicely for later on down the road when we want to talk about quaternions ah you know if you don't care about that now just forget about it but just to tickle your fancy we'll talk about this a little bit more later but again they're not unique now unique though that kicks off another discussion you know even though the Euler angles are not unique that might lead you to ask the question of well if they're not unique does that mean this matrix is singular at some points the answer that that is actually no so tell you what let's erase the board let's take a look at that next okay so the question now is is this DCM is it ever singular the answer is actually no we can actually do better then not only is the matrix never singular it's actually it's actually unitary we can show that okay so what we want to do now is let's show that DCM is unitary right which but basically is going to make it so the answer to this is basically no it's never singular okay so the way that we can show that this thing is unitary if you remember it with the idea with a unitary matrix right is that you've got this matrix C VB I'm gonna I'm gonna forget all these arguments now just to make our notation a little bit easier what the ideal what the unitary matrix is that if the inverse is equal to the transpose basically this implies this happens if and only if this thing is unitary right that's the cost of a unitary that's why unitary matrices are so great I don't need to take the full inverse I just need to take the transpose of this okay all right so what we should do then is let's go ahead and check is this actually true so let's see can I compute what is CB v inverse okay so well this thing let's expand what is CB v we have it right here CB v is the product of three other rotation matrices so it's CB 2 times C 2 1 times C 1 V right ok inverse okay if you remember the property of inverse is right I can distribute this inverse through by just flipping the order of this so I end up with C 1 V inverse times C to 1 inverse times C B 2 inverse ok so now the question is what are all of these inverses here by themselves so what we need to do is we need to have a quick side discussion right on what is C 1 V inverse C 2 1 inverse and C B 2 inverse now we can actually show that all of these are going to be unitary C 2 1 CB 2 transpose so these guys as inverses are their transpose so that happens because all of these guys are basically unitary ok so again let's check that all right don't take my word for it let's just make sure that this is true ok so again we need to back up and let's ask ourselves are one of these individual rotation matrices are they unitary ok so again to do that let's see where can I go to get some room let's come over here ok and let's go check that so let's go ahead and compute what is in order to check if one of these are unitary let's start with just C 1 V ok so if this thing is unitary then if I multiply it by its transpose right I should get the identity matrix right because if that's true that means this term right here is paid by definition the inverse of this term ok and similarly I need to check the other direction right C 1 V transpose times C 1 V I better get the identity matrix there right if this happens that means that this matrix is unitary ok so let's go ahead and do this and I actually don't want to do this by hand let's go over to mathematic and do this because we see that each one of these are just very simple 3x3 matrices with a bunch of cosines and sines let's just take the matrix multiply it by its transpose and see if we can get it to if that's actually the identity matrix alright so here we are in Mathematica so let's go ahead and check if C a1 V is unit area right so we said the way we're going to do this is we're gonna go c1v of SCI and we're gonna dot it with its transpose by basically that's basically doing our matrix multiply so this is basically checking here if seed 1 V times its transpose what is that equal to so let's call to some temporary matrix and then I guess we can look at this thing in matrix form and okay well that didn't exactly look like the identity matrix but actually it does right if you look at this closer what's cosine squared plus sine squared isn't that one and same thing cosine squared plus sine squared isn't that one so actually if I asked Mathematica to simplify this thing yes we see that that is indeed the identity matrix now let's also go ahead and do it for the opposite which is just this transpose dotted with itself and again we get another big fat identity matrix so yeah we know that c1v the rotation about the the base rotation matrix about a z-axis is unitary we can do the exact same thing for the rotation matrix about the y-axis right well that was what do we call this thing up here see yeah here we go see 1/2 of theta so see 1/2 of theta times this thing of theta and then again we'll check it like this and again we should see that this is unity whoopsy what did I do here oops sorry nope see I messed that up there we go okay yep yay another bunch of unitary matrices so we see that that the rotation about the y axis is unitary and finally just for completeness let's make sure that a rotation about an x axis is also unitary so again we'll do this guy whoops of Phi and we'll multiply it by itself transpose and then we'll do the same thing down here we'll go transpose of the x axis rotation times itself should again yayyyy turn out to a whole bunch of identity matrices so we see that these three matrices these rotation matrices about the Z Y and X jeez those are all unitary matrices all right so we just showed that all three of these things are unitary matrices so what we can do is up here back to our discussion is I don't need to take the full inverse I can just go ahead and take the transpose dotted with c21 transpose times cb2 transpose right that's the exact same thing let me erase down below as we get a little bit more room ok so if those are true ok let me go ahead and rewrite this again remember your put your your rules with the transposes I can pull the transpose out of this by again reversing the order of this so we end up with C be 2 times C 2 1 times C 1 V all this transpose here and this here that was just C be V alright that's this entire thing in parentheses and then I put the transpose out here so we end up seeing that again this DCM the full DCM is unitary right so therefore it is never singular right which is actually pretty darn cool so we see that this rotation matrix even though it looks complicated since it is made up of a product of three unitary basic rotation matrices it itself is also unitary so again if you're implementing this in code anywhere or doing something that never ever waste time taking the inverse of this thing just take its transpose to get the the inverse because it's unitary the other thing that might be helpful to talk about what we're just staring at this is also note that sometimes you may want to recover the Euler angles if given the DCM so sometimes you're given the direction cosine matrix basically this guy and you want the Euler angles Phi Theta and SIA right so there's a couple easy ways to do this I think the easiest way to do this is if you look at you know for example Phi or actually no tell you what let's do fit this is easy right here if you look at this entry here one three entry of the DCM is basically negative sine theta so really what you end up with is if we back solve that thing you can basically say that theta is basically negative inverse sine of the 1/3 element okay so c1 3 is supposed to be the 1/3 element of the DCM similarly if you look at this there's a couple of other relationships you can get by basically playing around with the 1 1 and the 1 2 and I think if you stare at this thing long enough you can see that ok Phi is basically going to be the atan2 of the 2/3 element and the 3/3 element so again we've got to be a little careful at the atan2 right I'm assuming that this is the Y component and then the X component of it okay that's how that's how I'm writing this atan2 argument and finally sigh here is going to be a tan 2 of c1 2 and C 1 1 all right ok so this kind of information is going to be useful later when we study Pisans kinematical equations and we're going to see that if you we're gonna maintain the entire DCM and then any time during the process or the simulation we may want to understand that where their angles well we can just use these three equations to to get those Euler angles now we've been talking about how the Euler rotation sequence is made up of these three individual unique rotations you may have heard though that it's possible to go from one frame to any other frame through a single rotation about some unique axis of rotation using just one single rotation and that's definitely true and I want to talk about how we get there in particular how this relates to Rodrigues rotation formula so you may remember that we talked about this formula in one of our previous videos over here so again if you haven't seen this video I would recommend taking a moment to stop and watch this video because we're going to be using Rodrigues rotation formula to investigate and derive what this axis of rotation that we're talking about is that will take us from FV to FB in just one single rotation ok so on to do this let's tell you one let's first go ahead and what I want to do is let's compute the eigenvalues of the overall rotation matrix C BV okay so let's go actually and have Mathematica do that because as you saw this room this matrix is kind of ugly so as you can probably imagine the expression for its eigenvalues might be kind of ugly so let's jump over to Mathematica and get the eigenvalues quickly all right so just continuing on with our Mathematica notebook let's go ahead and now compute the eigenvalues of c bv okay so this was our matrix so let's just go ahead and ask Mathematica to calculate the eigenvalues of this thing and as you can kind of see that appears to be not super pretty but you know what's interesting if we look at this as a list and actually tell you what let's simplify this because maybe that'll make this a little bit smaller well it's a little bit smaller what we're getting out what's terribly interesting about this is as you can imagine the second and third eigenvalues are a little bit ugly here but what's fascinating about this is that look at this one of the eigenvalues it's just one right the very first eigenvalue is just a it's just unity right doesn't matter what your Euler angles are you know v theta site it can be anything it doesn't matter one of the eigenvalues is just the number one so let's hop back to the white board and feet and think about what are the implications of that okay so this is really fascinating so we saw that one of these eigenvalues I don't know let's call this lambda it doesn't matter let's call lambda I one of the eigenvalues of this thing is gonna be one okay of this matrix okay so what's the definition of the eigenvalue eigenvector if you remember right the definition of the eigen value / eigenvector right for any matrix it's just the the the matrix where I go sorry I don't cuz I want to call it a let's keep calling at C because that's the matrix we're talking about right cbv the matrix times the associated eigen vector let's call it VI is equal to lambda I VI right that's the definition of an eigenvalue and eigenvector is it has this relationship here right well if you remember what is this eigenvalue for this particular one if I look at the eigenvector eigenvalue pair associated with the eigenvalue of just one we end up with this right it's C be V times V I is equal to VI okay what does this mean if you remember this is a rotation matrix and this is the vector that the rotation matrix is operating on so if you think about this long enough what this says here is it says that this vector if you pick this vector V I this rotation matrix after you rotate it it does nothing to the vector right it is completely unchanged so the vector VI is not rotated by the by the DCM cbv right so this is kind of an interesting statement here right it says that the rotation matrix doesn't actually rotate this vector so the next question should probably be like what kind of vector is unchanged by a rotation matrix all right now to answer that question let's go ahead and recall Rodrigues rotation formula okay so let's take a quick sidenote and if you remember what rod read rotation formula it said that if you had a given vector u right so this is a given vector okay it could be any vector in space and then you had some axis of rotation n right so here n is a the axis of rotation okay and what you ended up wanted to do was you wanted to rotate this vector u about this vector n through a angle mu and Rodrigue had this as a left-handed rotation for whatever reason again we discussed the details of this in the previous video on the on Rodrigues rotation formula but again this is not going to matter here the idea here is if you rotate you about N through a left-handed angle mu you would end up with a new vector V right so here's the rotated vector ok so again what's going on here I made a little prop earlier in the video but just to refresh your memory let's say that that maybe this this green pen is your axis of rotation and the black pen here is this given vector U and what I want to do is I want to rotate it through a left handed rotation mu to end up at this new vector V here okay so let's go ahead and first let's write out the the the Rodrigue rotation formula right we it said that given this set up it said that V is equal to one minus cosine of MU right times the inner product of U times the axis of rotation n times n plus cosine of MU times u minus sine of mu times n crossed you right that was the formula okay now here's what's fascinating what if we choose the vector that you're you're you're rotating let's choose that to be you know aligned with the axis of rotation so it's some scalar let's call it alpha times n here so physically what this means here is the the vector being rotated maybe we should write this down vector being the ing being rotated is aligned with the axis of rotation okay so all we need to do now is plug in U is equal to alpha n into expression okay so let's quickly do this maybe I'll do one step and hopefully this is going to see where this is going right so cosine of MU this times the inner product of what is this this is alpha and dotted with n all right times n plus cosine of MU and then here is what is U here again it's it's alpha times n minus sine of MU oops sorry sine of U close that parentheses times n crossed with alpha n right okay so let's go ahead and do this okay with a couple things that we notice here this cross product right this is going to go away because n is a line with n heating uu it's in the same direction right you cross two vectors in the same direction becomes a big fat zero so this term is gone right okay so what do we end up with so we end up with let me see this is 1 minus cosine of MU times dot product of I guess we can pull the alpha out of this it really wouldn't matter so I guess we can write this here as alpha times n dotted with n times n plus cosine of MU times alpha and ok ok now what we should have also recalled here is that N is a unit vector so it's magnitude is 1 maybe we should have forgot to put this up here this acts as a rotation this n is a unit vector right describing it okay so what that means here is what do we end up with this term right this just becomes u it's basically this is 1 right because it's a it's it's a dot product of a vector which is magnitude 1 times itself which is magnitude 1 so this thing is a big fat one right so we end up with 1 minus cosine of MU this whole thing times alpha times n all right that's that thing Plus here this one cosine of MU alpha times n right and okay so I think if you start distributing this out through you see that this term is cosine mu alpha n here's negative cosine mu alpha n so this guy will get knocked out by this guy all right so what do we end up with here we end up with this is just alpha n right okay and if you notice what is alpha N alpha N is just u right so at the end of the day we end up with this what does this say here what this says is that the vector if you choose it to be aligned with the axis of rotation it doesn't change which makes perfectly good sense if you think about this so let's let's maybe summarize this here so if you rotate any vector about its axis of rotation it is unchanged right so that that makes perfectly good sense right if you if is it makes physical good sense right because again coming back to our picture right if you have some axis of rotation right which is the this this green pen and you choose a vector any vector that happens to be aligned with this axis and then you just start rotating it through this angle mu I mean I don't care what mu is you can be you can rotate it through any angle the overall vector doesn't change right it stays the same isn't that exactly what we were just talking about right over here with this eigenvector eigenvalue analysis so what this is saying here is this eigenvector right you rotate it through the DCM by any any side Theta Phi right and it does not change right therefore doesn't that imply that this vector here this eigenvector has to be the axis of rotation of this this this this Euler rotation sequence right so we end up here with basically that this eigenvector VI right this thing this is the axis of rotation of the entire Euler sequence and again you probably want to normalize this just and you know you well you can normalize it just make a unit vector if you want but otherwise you know it doesn't matter if it's normalized or not it basically defines the axis of rotation right so again this VI here this is the eigenvector associated with the the unity eigenvalue in your direction cosine matrix right so this is pretty darn cool this gives us a way to calculate that axis of rotation which should take us from the vehicle carry northeast down frame to the body frame if we rotate about this single axis we should be able to get there with just one unit one rotation instead of three that we're using in our Euler sequence right so um that's pretty cool why don't we go over and look at looking at an example of this alright so we switched over to MATLAB again just because I think it's a little bit easier to do some of the plotting but let's use that exact same example we were looking at earlier where we had a yaw angle of 70 degrees a pitch angle of thirty to one hundred thirty degrees and a bank angle of twenty five degrees so let's go ahead and whoops that should be compute cbv so let's compute the entire direction cosine matrix as we did earlier in Mathematica right it's just the product of these three Euler rotation sequences and now what I want to do is let's get the eigen vectors and the eigenvalues of that matrix right here on line 56 tell you what let's take the semicolon off so that we can actually see the output to the screen and I will put a breakpoint right after it okay so let's just run to that spot let me just scroll back up here okay so we just executed line 56 and you see that here are the eigenvectors and here are the eigenvalues again on the diagonals remember what matlab does is it sticks the eigenvalues here on the diagonal so you see here's an eigenvalue and you see that is so that's one of those weird ones in Mathematica where we saw it was kind of complicated so it's imaginary in this before in this case here's a second one which is also imaginary but look at this as we saw earlier it doesn't matter what the Euler angles are one of these eigenvalues is guaranteed to be one and here it is it turns out it's the third eigenvalue is what Matt MATLAB decided a return so what we need is we need the third column of the eigenvector matrix right this column right here is going to be the eigenvector associated with the unity eigenvalue so that's what I'm just doing here on these next three steps here is we see that the index of the identity for the identity the unity eigenvalue is the third index right index three so i'll just pull off that eigenvalue right here that better be a one right lambda has to be one as you can see right here and V the vector that we're interested in is again this third column here so I'm taking all rows the third column of the eigenvector matrix so if I just go ahead and step through these right now we have lambda which is one yep and V which is the eigenvector so this is the union is the axis of rotation that we just discussed on the whiteboard so what I want to do now is tell you what let's go back and draw ourselves the vehicle carry northeast down frame and then the body frame that was obtained by rotating through these three angles right it's basically that oiler rotation sequence that we were looking at earlier in the the lecture so I'll just hit f5 to then we can draw this picture and let me just dock this figure okay so again this should look very similar right the red was the Northeast down frame the blue was the body frame and earlier what we had done is we had done our three unique rotations by going about or sorry I shouldn't say unique I should say three individual are separate right we first rotated about the Z then we rotated about the Y then we rotated about the x axis to get to the blue axis right that's how we got from the northeast down to the body frame now what I want to do is let's plot this axis of rotation here right I think in Rodriguez terminology we call that the vector n right and is the axis of rotation we are gonna choose that to be the eigenvector that's associated with the unity eigenvalue so if i go ahead and just plot that that is this magenta line right here right so this magenta line is the axis of rotation so what I want to do is basically I'm going to apply Rodrigues for a rotation of a vector formula using this magenta line as the axis of rotation and let's just go ahead and rotate um the X the X northeast down the Y northeast down and the Z northeast down frame through an angle mu so I'm just gonna go ahead and let this run and let's see what happens to this x y and z of the Northeast down if I rotate them around this single axis of rotation here so let's go ahead and just do that and I'll let this run oops sorry I got to take off the these break points so this thing runs a little bit more smoothly and there we go so that's the green is we're rotating those and we see eventually with the mu equal to here about two hundred thirty three and a half degrees look at this we basically went from the body the vehicle carry northeast down frame to the body frame by just the single rotation about this magenta line right about that I ghen vector so this is pretty darn interesting I think it's pretty helpful and very I guess interesting is maybe the right adjective while because it's it's neat to notice but again most of the time we are going to be using these three individual boiler angles of v theta sigh but this just is used to illustrate that you know what there's more than one ways to skin a cat right you could also get to the body frame through a single rotation about this single axis of rotation okay and maybe one final remark before we leave our discussion on other angles sometimes you may hear intrinsic vs. extrinsic Euler angles and all this is referring to is in our sequence here of Euler angles these are sometimes referred to as intrinsic or the angles what that means is that the Euler angles are defined relative to frames but these intermediate frames rotate with respect to one another right we saw that the one frame is not aligned with the with the original northeast down frame the two frame is not aligned with the one frame and the body frame is not aligned with the two frame right we have to go through this sequence of everything changing on one another in order to get to that so this is what we just did discussed right so this is Phi Theta sigh how we typically define it extrinsic could also be defined this is sometimes referred to as if the Euler angles are defined relative to a reference frame which is fixed and doesn't move okay now the reason I bring this up is because our choice all right because it's the the aerospace industries choice or whoever's choice like the typical sequence that you'll see here is using these intrinsic Euler angles this is going to have some ramifications later on down the road where we want to relate how do other angles relate to say instantaneous say rates of change say like the angular velocity vector of a vehicle okay so that sets the stage for our next discussion here on kinematic matrix relationships for rotation and I hope you'll consider joining us at discussion because we're going to take this relationship that we just derived about using these intrinsic Euler angles and look it's developing a sequence of equations that are going to allow us to relate rates of change of the body to rates of change of Euler angles okay so that's our next discussion so with that being said I think this is probably a great spot to leave it I hope you enjoyed the discussion today and if so I also hope you'll consider subscribing to the channel surprisingly if you just scroll a little ways down and click on that subscribe button it really does help me continue making these videos and with that being said I hope to catch you at our next discussion where we're going to be taking a look at kinematic relationships between rates a chance of a vehicle and their rates of change of their Euler angles so until we talk later I'll see ya bye
Info
Channel: Christopher Lum
Views: 19,646
Rating: undefined out of 5
Keywords: Rotation matrix, angular position, direction cosine matrix
Id: GJBc6z6p0KQ
Channel Id: undefined
Length: 70min 51sec (4251 seconds)
Published: Wed Apr 01 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.