How to extract roll, pitch, and yaw values from a Simulink transform sensor

14 ビュー (過去 30 日間)
석준
석준 2024 年 7 月 23 日
コメント済み: Umar 2024 年 7 月 23 日
Hello,
I am currently developing a system to extract and provide feedback on the 6 degrees of freedom (Surge, Sway, Heave, Roll, Pitch, Yaw) motion of a follower coordinate system relative to a base coordinate system. While I can extract the feedback for Surge, Sway, and Heave motions from the options in the Transform sensor, there are no specific options for Roll, Pitch, and Yaw motions. Therefore, I have used the Coordinate Transformation Conversion block as shown in the image below. However, even with this block, it seems that I cannot extract Roll, Pitch, and Yaw motions separately for feedback. Is there a way to extract Roll, Pitch, and Yaw motions individually?

採用された回答

Umar
Umar 2024 年 7 月 23 日
編集済み: Angelo Yeo 2024 年 7 月 23 日
Hi 석준 ,
Try using the rotation matrix obtained from the Coordinate Transformation Conversion block. By decomposing the rotation matrix, you can extract the Euler angles representing Roll, Pitch, and Yaw. Here is a simple code snippet to demonstrate this:
% Assuming R is the rotation matrix obtained from the Coordinate
Transformation Conversion block
roll = atan2(R(3,2), R(3,3));
pitch = asin(-R(3,1));
yaw = atan2(R(2,1), R(1,1));
% Convert angles from radians to degrees if needed
roll_deg = rad2deg(roll);
pitch_deg = rad2deg(pitch);
yaw_deg = rad2deg(yaw);
disp(['Roll: ', num2str(roll_deg), ' degrees']);
disp(['Pitch: ', num2str(pitch_deg), ' degrees']);
disp(['Yaw: ', num2str(yaw_deg), ' degrees']);
For more information on coordinate transformation conversion, please refer to,
https://www.mathworks.com/help/nav/ref/coordinatetransformationconversion.html#
If this Answer resolved your question, please Accept-click it.
  2 件のコメント
석준
석준 2024 年 7 月 23 日
移動済み: Angelo Yeo 2024 年 7 月 23 日
Thank you for your support :)
Umar
Umar 2024 年 7 月 23 日
No problem Angelo, glad to help out 😀

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeUnit Conversions についてさらに検索

タグ

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by