How does SFRotation works in Simulink 3D world Editor?
조회 수: 17 (최근 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!