I am now using OpenSim to model an ankle with some ligaments, and would like to get ligament forces and lengths during a drop landing simulation. I can now use python to get the ligament lengths, as show below, but I don't know how to get the ligament forces. I have read the API documentations and many posts here but didn't find the function of getting the forces through API. Could you please tell me how to use API (python) to collect the ligament forces during simulation? Which function should I use? I really need help so any suggestions would be greatly appreciated.
Code: Select all
osimModel='D:\Drop landing\Fullbodymodel_droplanding.osim'
myModel=opensim.Model(osimModel)
fset=myModel.getForceSet()
lig1=opensim.Ligament.safeDownCast(fset.get("ligament_1"))
state=myModel.initSystem()
lig_length=lig1.getLength(state)
Xijin