Working with Yaw-Pitch-Roll

Started by
4 comments, last by alich 19 years, 2 months ago
i've searched the articles archive with no luck... can anyone direct me to one about the subject?
Advertisement
Do a search for Euler angles.
Thanks, but still no luck... only aticles about quaternines...
Just don't do it - work internally with quaternions or 3x3 matrices. If you need to present yaw/pitch/roll to the user, then convert (not difficult).
ok, i think i got a little confused :) i don't want to use any angles, except when creating the rotation matrices...
so i need to use quaternions, not euler angles?
What you want to to is calculating the composition of three matrices

M_yaw * (M_roll * M_pitch)

the order could be different. And it is how you define yaw, pitch and roll which all correspond to rotations about x,y,z correspondingly.

So how could this be done? I will do the first matrix (yaw) and you can figure out the rest. so lets create M_yaw.

We look at how the basis e_x = (1,0,0)^T, ..., e_z = (0,0,1)^T transforms which is very easy:

M_x * e_x = e_x
M_x * e_y = (cos v * e_y) + (sin v * e_z)
M_x * e_z = (-sin v *e_y) + (cos v * e_z)

(tip: draw a picture..)

But now we know the matrix M_x since M_x * e_x = first column, M_x * e_y = second column and M_x * e_z = third column (very nice way of calculating a matrix if you are not used to it, just find how the standard basis is transformed).

Your M_x is then:
M_x = [1 0 0 0; 0 cosv sinv; 0 -sinv cosv]

(rotation is counter clockwise, just transform v' = -v to get it clockwise)


Doing this also for roll and pitch and finally calculating the composition (given above) gives you the final rotation matirx.


The reason why everyone is talking about quaternions is that they have some advantages in 1) memory efficiency 2) no gimbal lock 3) nice and very fast for doing spherical interpolation.

Regards

This topic is closed to new replies.

Advertisement