Rotation Matrices - omega phi kappa vs yaw pitch roll

123 次查看(过去 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:
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 个评论
Elisavet Konstantina Stathopoulou
@Bjorn Gustavsson I guess I make the same mistake, I tried different combinations but cannot get it right

请先登录,再进行评论。

采纳的回答

Bjorn Gustavsson
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
  3 个评论
Bjorn Gustavsson
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.
Remo Pillat
Remo Pillat 2024-4-2,2:14
编辑:Remo Pillat 2024-4-2,2:19
Just like Bjorn mentioned, you can find the source code for eul2r on GitHub. You can see that the rotation matrix is composed of a Z-rotation, a Y-rotation, and a Z-rotation: R = rotz(phi) * roty(theta) * rotz(psi). You can find the source code of the rotz and roty functions in the same repository.
If you have a copy of Robotics System Toolbox, you can easily convert between Euler angles and a rotation matrices with the eul2rotm function. You can specify any axis order you want, but for your example, you get the same result as in eul2r by calling:
eul2rotm([-174.358491845,0.100258014,44.950203063], "ZYZ")
ans = 3x3
-0.8236 -0.5671 0.0000 0.5643 -0.8195 0.1001 -0.0568 0.0824 0.9950
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Coordinate Transformations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by