quat2eul(quat) and dcm2Angle(R) difference for ZYX sequence
조회 수: 2 (최근 30일)
이전 댓글 표시
I've converted a quaternion to Euler angle using quat2eul(q,'ZYX') and a rotation matrix to Euler angle with function dcm2Angle(R,'ZYX'). However, the resulted graph is inverted (upside down). Example , if yaw angle from quaternion is up, yaw angle from dcm2Angle is down. How could that happen ?
Any help would be apperciated.
Thanks
댓글 수: 0
채택된 답변
James Tursa
2020년 5월 7일
편집: James Tursa
2020년 5월 9일
MATLAB uses two different quaternion conventions in their toolboxes. In particular, the quaternion convention used in the Aerospace Toolbox is essentially the conjugate of the quaternion convention used in their Robotics Toolbox. See these links for more details of that difference:
The quat2eul( ) function comes from the Robotics Toolbox.
The dcm2Angle( ) function comes from the Aerospace Toolbox.
So these functions come from toolboxes with different definitions of quaternion conventions, and how to convert between quaternions and direction cosine matrices and Euler angles will be different between them.
Bottom line is you cannot mix & match functions from these toolboxes and expect consistency. Depending on what you are doing, one can give you the opposite answer as the other. You need to determine what quaternion convention you will be using, and then use the appropriate functions from the appropriate toolbox that uses the same convention.
The Robotics Toolbox "rotation matrix" is in fact a direction cosine matrix ... just another term for the same thing. It is the conversions between it and quaternions and Euler Angles that are different from the Aerospace Toolbox.
추가 답변 (1개)
Ameer Hamza
2020년 5월 7일
dcm2angle does not take the rotation matrix as input. It takes direction cosine matrix (DCM). to convert rotation matrix to Euler angles use rotm2eul() https://www.mathworks.com/help/robotics/ref/rotm2eul.html
댓글 수: 1
Serhii Bahdasariants
2022년 2월 22일
I don't think there is a difference in numerical values of the rotation and direction cosine matrices, is there?
참고 항목
카테고리
Help Center 및 File Exchange에서 Coordinate Transformations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!