# Rotation Matrices - omega phi kappa vs yaw pitch roll

72 次查看（过去 30 天）
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:
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 个评论显示隐藏 3更早的评论
@Bjorn Gustavsson I guess I make the same mistake, I tried different combinations but cannot get it right

### 回答（1 个）

Bjorn Gustavsson 2021-10-27
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 个评论显示隐藏 1更早的评论
Bjorn Gustavsson 2021-10-28
Well then you either have to read the code of the eul2r function and figure out which order and what sign-convention is used, or use the method I proposed on that end of your problem, simply plug in a couple of yaw, pitch and roll-angles and see which combination of my 6 rotation-matrix-functions gives you the same rotation-matrices.

### Community Treasure Hunt

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

Start Hunting!

Translated by