How SFRotation Works in 3D World Editor?

11 visualizaciones (últimos 30 días)
Andrew Poissant
Andrew Poissant el 4 de Abr. de 2019
Editada: Muhammet Dabak el 29 de Sept. de 2021
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?

Respuestas (1)

Muhammet Dabak
Muhammet Dabak el 14 de Oct. de 2020
Editada: Muhammet Dabak el 29 de Sept. de 2021
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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by