Get Body frame relationship (transformation matrix) in Matlab

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Hilary Cheng
Posts: 12
Joined: Thu Oct 04, 2018 9:10 pm

Get Body frame relationship (transformation matrix) in Matlab

Post by Hilary Cheng » Thu Feb 28, 2019 2:02 am

Hi,

How can I know the Transformation matrix between 2 Body frames at certain State? (eg. between the humerus frame and clavicle frame or even ground frame) Are there any codes that I can use in Matlab to extract the Transformation relationship?

Thanks!

Regards,
Hilary

Tags:

User avatar
Thomas Uchida
Posts: 1792
Joined: Wed May 16, 2012 11:40 am

Re: Get Body frame relationship (transformation matrix) in Matlab

Post by Thomas Uchida » Thu Feb 28, 2019 1:43 pm

I think you are looking for the Frame::findTransformBetween() method: https://simtk.org/api_docs/opensim/api_ ... 902fd30aa3.

User avatar
Hilary Cheng
Posts: 12
Joined: Thu Oct 04, 2018 9:10 pm

Re: Get Body frame relationship (transformation matrix) in Matlab

Post by Hilary Cheng » Thu Feb 28, 2019 8:50 pm

Hi,

Thanks for the reply!
I have tried the following:

dsrFrame = osimModel.getGround();
body = osimModel.getBodySet().get(0)
transform = body.findTransformBetween(state,dsrFrame)


what I get in Matlab is:
transform =
org.opensim.modeling.Transform@2676dc05

I would like to know how can I convert the value above to a Matlab readable Matrix?

Thanks!

Hilary

User avatar
Hilary Cheng
Posts: 12
Joined: Thu Oct 04, 2018 9:10 pm

Re: Get Body frame relationship (transformation matrix) in Matlab

Post by Hilary Cheng » Fri Mar 01, 2019 2:14 am

Problem Solved! =)

for reference:
rotationmatrix = transform.R();
positionvector = transform.p();

Thanks for helping!
Hilary

POST REPLY