I'm attempting to update a piece of code to OpenSim 4.0, however, am running into an issue about getting the joints of a particular body.
In previous versions, you could easily access this through: Body::getJoint(). However, this method has now been removed.
Essentially, I am trying to create a list of joints (which have at least 1 dof) which are spanned by a certain muscle (bodies are given in the particular muscle's PathPointSet).
I have a list of the bodies, e.g.,
Code: Select all
muscle_attach_bodies = ['pelvis', 'femur_l']
Code: Select all
distal_body_name = muscle_attach_bodies[-1]
body_name = distal_body_name
counter = 1
next_proximal_body_name = muscle_attach_bodies[-1 - counter]
joint_set = osim_model.getJointSet()
# Work around because Body.getJoint() has been removed in OpenSim 4.0
for joint in joint_set:
# Parent body of joint is the more proximal body to the current body
if next_proximal_body_name in joint.getParentFrame().getName():
spanned_joint = joint
spanned_joint_name = str(spanned_joint.getName())
Thanks for your help