How SFRotation Works in 3D World Editor?

조회 수: 2(최근 30일)
Andrew Poissant
Andrew Poissant 2019년 4월 4일
편집: Muhammet Dabak 2021년 9월 29일
I am trying to hook up my UAV Simulink model to VR Sink by sending translation and rotation values from my model to VR Sink. I am able to successfully input translation values but I am confused on how I can send my model's Euler angles. I have the following rotation angles that I am trying to send to VR Sink: roll (reference frame is x-axis counter-clockwise), pitch (reference frame is y-axis counter-clockwise), and yaw (reference frame is z-axis counter-clockwise). How do I convert these Euler angles with their respective reference frames to a 4 element vector that is required in VR Sink?

답변(1개)

Muhammet Dabak
Muhammet Dabak 2020년 10월 14일
편집: Muhammet Dabak 2021년 9월 29일
function vector=Rotator(yaw,pitch,roll)
rRoll=[cosd(roll),-sind(roll),0;sind(roll),cosd(roll),0;0,0,1];
rYaw=[cosd(yaw), 0, sind(yaw); 0,1,0; -sind(yaw) ,0, cosd(yaw)]
rPitch=[1, 0, 0; cosd(pitch), -sind(pitch), 0 ;0 ,sind(pitch) ,cosd(pitch)]
Rotation = rYaw*rPitch*rRoll;
vector=vrrotmat2vec(Rotation);
end
Roll,yaw,pitch angles' order can change due to your coordinate system, you can arrange it.
For any question, I will be glad to answer related to V-Realm Builder & 3D World Editor

Community Treasure Hunt

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

Start Hunting!

Translated by