Get Joint Location via API 3.3

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Chaofei Zhang
Posts: 26
Joined: Tue Oct 03, 2017 11:03 am

Get Joint Location via API 3.3

Post by Chaofei Zhang » Sun Jan 28, 2018 11:34 am

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

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Get Joint Location via API 3.3

Post by Dimitar Stanev » Mon Jan 29, 2018 1:46 am

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

User avatar
Chaofei Zhang
Posts: 26
Joined: Tue Oct 03, 2017 11:03 am

Re: Get Joint Location via API 3.3

Post by Chaofei Zhang » Mon Jan 29, 2018 9:06 am

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)

POST REPLY