How to get orientation of body in Matlab?
Posted: Wed Jun 02, 2021 10:00 am
Hello,
I am trying to get the rotation of a body frame, either relative to the global frame, or to another body frame, using Matlab.
I have been able to get the global positions of the bodies, and convert them to Matlab arrays, using this method:
However, using a similar command for rotation defined in the methodsview "body.getRotationInGround(state)" gives an object of type
I am trying to define the initial offset between the two bodies and the orientation matters in this case. Any thoughts/recommendations/advice would be greatly appreciated.
Thanks for your help,
Evan
I am trying to get the rotation of a body frame, either relative to the global frame, or to another body frame, using Matlab.
I have been able to get the global positions of the bodies, and convert them to Matlab arrays, using this method:
Code: Select all
%% get global body position
hand_L_pos = osimVec3ToArray(HAND_L.getPositionInGround(start)); % take in current state
hand_R_pos = osimVec3ToArray(HAND_R.getPositionInGround(start)); % give global position
handle_L_pos = osimVec3ToArray(HANDLE_L.getPositionInGround(start));
handle_R_pos = osimVec3ToArray(HANDLE_R.getPositionInGround(start));
Is there a way to convert this to a usable form in Matlab? Or is there another method that I could use to get the body rotation/orientation?SWIGTYPE_p_SimTK__Rotation_T_SimTK__Real_t
I am trying to define the initial offset between the two bodies and the orientation matters in this case. Any thoughts/recommendations/advice would be greatly appreciated.
Thanks for your help,
Evan