0

In a ZYX Euler rotation, my understanding is that the initial intermediate-rotation around the Z-axis rotates the basis for the subsequent rotation. It seems that Euler angles are typically measured relative to a frame fixed to the object itself, known as the body-fixed frame. As a result, the Y-axis involved in the second intermediate-rotation is not the original Y-axis, but rather the Y-axis that has been updated or rotated by the first intermediate-rotation of Z.

Consider the following code as an example: first, a rotation of 90 degrees is applied around the body's Z-axis, followed by a rotation of 90 degrees around the body's Y-axis

% Angle of rotation in radians
psi_z = 90;  % 90 degrees
theta_y = 90;  % 90 degrees

% Compute the elements of the rotational matrices
R_z = [cosd(psi_z) -sind(psi_z) 0;
       sind(psi_z)  cosd(psi_z) 0;
       0              0             1];

R_y = [cosd(theta_y)  0  sind(theta_y);
       0              1  0;
      -sind(theta_y)  0  cosd(theta_y)];

% Initial vector
v = [1; 0; 0];

% Apply the first Z-axis rotation
v_z = R_z * v;

% Display the resulting vector
disp("Z->");
disp(v_z);

% Apply the second Y-axis rotation
v_zy = R_y * v_z;

% Display the resulting vector
disp("Z->Y->");
disp(v_zy);

I expect [0; 1; 0] and [0; 0; -1] but I get

Z->
     0
     1
     0

Z->Y->
     0
     1
     0

I'm struggling to understand why, in this specific case, the second rotation does not appear to rotate the vector. Let's visualize the vector as an aircraft, where the input vector [1; 0; 0] represents the nose direction. After the first intermediate-rotation of 90 degrees around the Z-axis, the nose now points in the direction of the original Y-axis, which has become the new X-axis. Additionally, the new Y-axis (representing the body's right wing) aligns with the previous X-axis in the negative direction. Considering this, I expected the second rotation around the body's Y-axis to rotate the vector and align it vertically with the previous Z-axis (in the negative direction), resulting in [0; 0; -1].

I suspect the convention or definition of body-fixed frame or intermediate-frame is not clearly defined. For the sake of this question let's define these terms in the context of this question:

  • R: represents a complete Z-Y-X sequence of Euler rotations.
  • R0: denotes the initial orientation or condition before the execution of R (specifically before R is performed).
  • R1: refers to the first Euler rotation around the Z-axis, which is a component of R.
  • R2: represents the second Euler rotation around the Y-axis, which is also a component of R.
  • R3: third Euler rotation around the X-axis

It is evident that the rotation at R1 is specifically around the Z-axis of R0, and subsequently, the rotation at R2 should occur around the Y-axis of the body after the completion of R1. However, based on the Matlab result, it appears that the rotation at R2 is actually taking place around the Y-axis of R0 instead. Could this be the reason why the vector is not undergoing rotation as expected? Does this indicate that each angle in a Euler rotation sequence is always relative to its initial condition?

KMC
  • 19,548
  • 58
  • 164
  • 253
  • The axes do not change because the position of the viewer does not change. Your rotation about the z axis results in a vector along the fixed y axis. Any rotations about the y axis of a vector along the y axis will have no effect. – beaker Jun 04 '23 at 14:22

1 Answers1

2

Your R_y is not correct.

These are the standard rotation matrices:

a=[90 90 90]     % [ax ay az] angles in degree

Rz=[cosd(a(3)) sind(a(3)) 0;-sind(a(3)) cosd(a(3)) 0;0 0 1];

Ry=[cosd(a(2)) 0 -sin(a(2));0 1 0;sind(a(2)) 0 cosd(a(2))];

Rx=[1 0 0;0 cosd(a(1)) sin(a(1));0 -sind(a(1)) cosd(a(1))];

v=[1 0 0]';

v2=Rz*Ry*Rx*v

If you apply these matrices as here shown you rotate the initial vector as expected.

John BG
  • 690
  • 4
  • 12
  • I guess I'm not understanding why the Rz * Ry * Rx matrix multiplication is applied in reverse order. The first rotation is around the z-axis but it is Rx being the first rotation matrix multiplied to the vector. – KMC Jun 06 '23 at 04:11