eul2rotm missmatch why?

18 次查看(过去 30 天)
Wouter Boessenkool
Hello why do the following don't match:
ax=90;
ay=0;
az=90;
Cx = [1 0 0; 0 cosd(ax) -sind(ax); 0 sind(ax) cosd(ax)];
Cy = [cosd(ay) 0 sind(ay); 0 1 0; -sind(ay) 0 cosd(ay)];
Cz = [cosd(az) -sind(az) 0; sind(az) cosd(az) 0; 0 0 1];
C1 = Cz*Cy*Cx; % 'XYZ'
C2 = eul2rotm(deg2rad([ax ay az]),'XYZ');
C3 = eul2rotm(deg2rad([az ay ax]),'ZYX');
Why is `C1` not the same as `C2`? But `C1` is equal to `C3`...
In the documentation it says for example for 'XYZ':
'XYZ' – The order of rotation angles is x-axis, y-axis, z-axis.
Implying that when 'XYZ' is used you first rotate about X, then Y and finally Z. Same as C1 = Cz*Cy*Cx, right?

回答(2 个)

David Goodmanson
David Goodmanson 2018-5-9
编辑:David Goodmanson 2018-5-10
Hello Wouter,
I don't have the robotics toolbox, but in the documentation for eul2rotm it says:
"When using the rotation matrix, premultiply it with the coordinates to be rotated (as opposed to postmultiplying)"
That sounds like the coordinates are a row vector in front rather than a column vector afterwards. In that case obviously the order of multiplication of the C's is not reversed.

Roger Rouse
Roger Rouse 2021-10-12
This is the command line help for eul2rotm. It does not mention whether to pre or post mulitpy the matrix. It should be stated in this help somewhere!
>> help eul2rotm
eul2rotm Convert Euler angles to rotation matrix
R = eul2rotm(EUL) converts a set of 3D Euler angles, EUL, into the
corresponding rotation matrix, R. EUL is an N-by-3 matrix of Euler rotation
angles. The output, R, is an 3-by-3-by-N matrix containing N rotation
matrices. Rotation angles are input in radians.
R = eul2rotm(EUL, SEQ) converts 3D Euler angles into a rotation matrix.
The Euler angles are specified by the body-fixed (intrinsic) axis rotation
sequence, SEQ.
The default rotation sequence is 'ZYX', where the order of rotation
angles is Z Axis Rotation, Y Axis Rotation, and X Axis Rotation.
The following rotation sequences, SEQ, are supported: 'ZYX', 'ZYZ', and
'XYZ'.
Example:
% Calculate the rotation matrix for a set of Euler angles
% By default, the ZYX axis order will be used.
angles = [0 pi/2 0];
R = eul2rotm(angles)
% Calculate the rotation matrix based on a ZYZ rotation
Rzyz = eul2rotm(angles, 'ZYZ')
See also rotm2eul

类别

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