SimScape multibody rotation matrix
Mostrar comentarios más antiguos
Hello everyone,
I am currently working with simscape multibody and trying to determine a rotation matrix for a rigid transform. Let's assume I have an extruded solid along its z axis and the coordinate of the director vector of the rotation axis of the revolute joint is known QP=[-7 32.7 94.2]. (New origin has to be M=[129.9984 145.1076 353.5218].)
Now I want to calculate the rotation matrix needed to transform the wolrd frame's Z axis so it matches the joint's axis. For that, I caculate first the angle around the X axis, by calculating the angle between the projection of the vector on the YZ plane and the Z axis (-19.1436°), then caculate the angle around the Y axis calculating the angle between the projection of the vector on the XZ plane and the Z axis (-4.2498°).
After that, I determine rotx(theta1) and roty(theta2), and determine the final rotation matrix R=rotx*roty.
To verify my calculation, I multiply Z axis coordinate by the rotational matrix and get QP' [-7.4106 32.7035 94.2102].
Element by element division QP/QP' gives me [0.9446 0.9999 0.9999], which means the rotation matrix is incorrect.
When keeping the same method for the X axis rotation and calculating the angle between QP (coordinate in the new base after the X rotation) and Z axis, I obtain an angle of -4.0156°. The new QP/QP' gives [-1.0581 -0.9971 0.9996], which is still wrong.
Would you have an idea on what is wrong? Thank you for your answers.
rS5x=Zvector(1,2)*rQP(1,3)-Zvector(1,3)*rQP(1,2); %get the sign of the angles (Xa-Yb)*(Ya-Xb)
rS5y=Zvector(1,3)*rQP(1,1)-Zvector(1,1)*rQP(1,3);
rtheta5x=sign(rS5x)*acos(dot([0 rQP(1,2) rQP(1,3)],Zvector)/(norm(Zvector)*norm([0 rQP(1,2) rQP(1,3)])))*180/PI; %angle around X axis
rR5x=rotx(rtheta5x); %rot matrix X
rQPprime=rQP*rR5x; %rQP coordinate in new base
rtheta5y=sign(rS5y)*acos(dot([rQPprime(1,1) 0 rQPprime(1,3)],Zvector)/(norm(Zvector)*norm([rQPprime(1,1) 0 rQPprime(1,3)])))*180/PI; %angle around Y axis
rR5y=roty(rtheta5y); %rot matrix Y
rR5=rR5x*rR5y; % global rot matrix
VerifQP=Zvector*rR5*100; %QP calculated from Z axis and rot matrix
AB=rQP./VerifQP; %element by element division
3 comentarios
James Tursa
el 15 de Feb. de 2021
Can you post an image of how things are related?
Killian Hyron
el 15 de Feb. de 2021
Editada: Killian Hyron
el 15 de Feb. de 2021
Killian Hyron
el 16 de Feb. de 2021
Respuestas (0)
Categorías
Más información sobre Assembly en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
