How does SFRotation works in Simulink 3D world Editor?

18 visualizaciones (últimos 30 días)
Pranjal Biswas
Pranjal Biswas el 11 de En. de 2017
Comentada: Muhammet Dabak el 29 de Sept. de 2021
I am new to Simulink 3D Animation. I have been trying to use the Simulink 3D World Editor. My aim is to translate and rotate a helicopter model. I was able to create the 3D world along with the helicopter. My model is accurate when it comes to translation, but I am not able to understand how rotation works. I have checked the sfrotation block in block parameters. But when I input 3by1 matrix to rotation input of vrsink block in Simulink, it says dimensions are not correlating and asks for 4th dimension. Can someone please explain how can I get accurate rotation of my model in all 3 axis(roll, pitch, yaw)?

Respuestas (3)

Vishal Neelagiri
Vishal Neelagiri el 17 de En. de 2017
'SFRotation' represents a vector of four floating point values you use for specifying rotation coordinates (x,y,z) of an axis plus rotation angle around that axis. You can find this description in the following documentation page:
https://www.mathworks.com/help/sl3d/vrml-data-types.html
You can also read through the following documentation for information to link to simscape multibody models in order to obtain the positions and rotations of machine parts using Body sensor blocks.
https://www.mathworks.com/help/sl3d/link-to-simulink-and-simmechanics-models.html#bu2op3v

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
This yaw,pitch,roll can change with respect to your coordinate system.
For any question, I can answer it.
  2 comentarios
zahra hosaini
zahra hosaini el 1 de Sept. de 2021
hi
i checked this but there is a problem
when i declare all roll=pitch=yaw=0 the output vector gives us something like 0 0 0.5774 1.0472 , resulting to rotate the object even if it shouldnt be.
i feel like there is something wrong in the formulas
*note that if u want to use vector as a parameter from spacework to simulink u neeed to add a -1 to the vector(1,1) for the time.
Muhammet Dabak
Muhammet Dabak el 29 de Sept. de 2021
I edited my answer.
Wrong part was in the multiplication of matrices.
When doing rotation matrice calculation,
Roll should be multiplied,then pitch and later,yaw.
Otherwise, it will be wrong. That is crucial.
In the calculation that I suppose,
Roll is turn around z axis,
Yaw is turn around y axis,
Pitch is turn around x axis.
And object lies on the Z axis.
This coordinate system is corresponding to EAST -UP - SOUTH.
For different objects that lies on a different axis, changes should be made.
For example, if the object lies on X axis:
Yaw stays same however, roll should be entered instead of pitch and vice versa.
And multiplication should be changed like this:
Rotation = rYaw * rRoll * rPitch
Because roll is actually pitch and vice versa.
Thanks for your feedback.

Iniciar sesión para comentar.


J Chen
J Chen el 27 de Dic. de 2020
Simulink 3D rotation input use axis-angle (x, y, z, angle) format, where the first 3 elements specify the axis direction. Euler angles to axis-angle conversion algorithms are available on the Internet.

Categorías

Más información sobre Aerospace Scenarios en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by