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
Get Joint Location via API 3.3
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: Get Joint Location via API 3.3
Hi,
This is how I done it in C++
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
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();
Best
- Chaofei Zhang
- Posts: 26
- Joined: Tue Oct 03, 2017 11:03 am
Re: Get Joint Location via API 3.3
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)
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)