Page 1 of 1

Collect ligament force and length using API. Please help!

Posted: Mon Feb 07, 2022 3:52 pm
by xhua
Hi, all

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)
Thanks

Xijin

Re: Collect ligament force and length using API. Please help!

Posted: Mon Feb 07, 2022 7:00 pm
by tkuchida
I think you're looking for the getTension() method (https://simtk.org/api_docs/opensim/api_ ... 7aff29e512). Here are some examples: https://github.com/opensim-org/opensim- ... getTension.

Re: Collect ligament force and length using API. Please help!

Posted: Thu Mar 03, 2022 8:37 am
by xhua
Hi, Thomas

This is what I am looking for. Thank you so much!

Xijin