How SFRotation Works in 3D World Editor?

7 vues (au cours des 30 derniers jours)
Andrew Poissant
Andrew Poissant le 4 Avr 2019
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?

Réponses (1)

Muhammet Dabak
Muhammet Dabak le 14 Oct 2020
Modifié(e) : Muhammet Dabak le 29 Sep 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

Catégories

En savoir plus sur Simulink dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by