Page 1 of 1

Get Joint Location via API 3.3

Posted: Sun Jan 28, 2018 11:34 am
by czhang9
Hi all,

I'm trying to get location and orientation of a joint in the child and parent coordinate separately.

Here are my codes (https://web.stanford.edu/~jjdunne/html/ ... Joint.html):

jointset=mymodel.getJointSet();
jointset.get(i).getLocation() ;
jointset.get(i).getLocationInParent();


It is wrong. Could anyone help me find the correct code?

Thanks!
chaofei

Re: Get Joint Location via API 3.3

Posted: Mon Jan 29, 2018 1:46 am
by mitkof6
Hi,

This is how I done it in C++

Code: Select all

SimTK::Transform jointTran = model->getCoordinateSet().get(i).getJoint().
            getChildFrame().getGroundTransform(s);
SimTK::Vec3 pos = jointTran.p();
you can access the child and parent frame with getChildFrame and getParentFrame respectively. Note however that the developers introduced some changes to the API so this approach may not be possible, depending on your version.

Best

Re: Get Joint Location via API 3.3

Posted: Mon Jan 29, 2018 9:06 am
by czhang9
Thanks Dimitar!

Location could only be read in a form of Vec3.
Here is the right code:

l=Vec3(0,0,0);
jointset.get(i).getOrientationInParent(l)