How does SFRotation works in Simulink 3D world Editor?
18 次查看(过去 30 天)
显示 更早的评论
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)?
0 个评论
回答(3 个)
Vishal Neelagiri
2017-1-17
'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
0 个评论
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
This yaw,pitch,roll can change with respect to your coordinate system.
For any question, I can answer it.
2 个评论
zahra hosaini
2021-9-1
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
2021-9-29
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.
J Chen
2020-12-27
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Aerospace Scenarios 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!