Page 1 of 1

Get Body frame relationship (transformation matrix) in Matlab

Posted: Thu Feb 28, 2019 2:02 am
by hilarycheng
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

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

Posted: Thu Feb 28, 2019 1:43 pm
by tkuchida
I think you are looking for the Frame::findTransformBetween() method: https://simtk.org/api_docs/opensim/api_ ... 902fd30aa3.

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

Posted: Thu Feb 28, 2019 8:50 pm
by hilarycheng
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

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

Posted: Fri Mar 01, 2019 2:14 am
by hilarycheng
Problem Solved! =)

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

Thanks for helping!
Hilary