# Rotation Matrices - omega phi kappa vs yaw pitch roll

68 views (last 30 days)

Show older comments

Hello,

I have omega phi kappa and corresponding yaw (Z) pitch (Y) roll (X) measurements from a sensor.

Both are in degrees but I convert them to rads.

I try to do some tranformations for a photogrammetry project.

While using the yaw, pitch, roll values and the Robotics Toolbox function:

R_euler = eul2r(yaw_rad, pitch_rad, roll_rad)

the result of the transformation is as expected (visually)

However, I need to calculate the rotation matrix also based on the omega, phi, kappa values.

I use my own rotation matrix for (w,f,k) = (omega, phi, kappa) that I have used successfuly in the past for similar transformation problems:

R=[ cos(f)*cos(k) cos(w)*sin(k)+sin(w)*sin(f)*cos(k) sin(w)*sin(k)-cos(w)*sin(f)*cos(k)

-cos(f)*sin(k) cos(w)*cos(k)-sin(w)*sin(f)*sin(k) sin(w)*cos(k)+cos(w)*sin(f)*sin(k)

sin(f) -sin(w)*cos(f) cos(w)*cos(f)];

but I do not get the same result, and indeed it looks not as good. I tried various transformations, also using the inverted

R = R'

but it doesn't work.

I am wondering which transformation matrix is used in the Robotics Toolbox function, as I could not find anything in the documentation.

Just in case, I give you my exaple values in degrees:

omega phi kappa = 3.927820353,4.052795303,44.806238302

and corresponding

roll pitch yaw = -174.358491845,0.100258014,44.950203063

Any help? Thanks!

##### 4 Comments

### Answers (1)

Bjorn Gustavsson
on 27 Oct 2021

If you have mixed up the order of the rotations you might step through the different combinations of rotations and sign-conventions by separating your R-matrix into the different single-matrix components:

Rx = @(w) [1 0 0;0,cos(w) -sin(w);0 sin(w) cos(w)];

Ry = @(phi) [cos(phi) 0 sin(phi);0 1 0;-sin(phi) 0 cos(phi)];

Rz = @(k) [cos(k) -sin(k) 0;sin(k) cos(k) 0; 0 0 1];

Then you can combine them in different order:

R_1 = @(w,phi,kappa) Rx(w)*Ry(phi)*Rz(kappa);

R_2 = @(w,phi,kappa) Rx(w)*Rz(kappa)*Ry(phi);

R_3 = @(w,phi,kappa) Ry(phi)*Rx(w)*Rz(kappa);

R_4 = @(w,phi,kappa) Ry(phi)*Rz(kappa)*Rx(w);

R_5 = @(w,phi,kappa) Rz(kappa)*Ry(phi)*Rx(w);

R_6 = @(w,phi,kappa) Rz(kappa)*Rx(w)*Ry(phi);

After that you should be able to find the correct one by stepping through the different sign-combinations for w, phi, and kappa. That should at worst be 2^3 cases for each of the 6 matrices, so 48 combinations...

HTH

##### 2 Comments

Bjorn Gustavsson
on 28 Oct 2021

### See Also

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!