Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
-
Cai Birch
- Posts: 31
- Joined: Tue Jan 02, 2018 7:40 am
Post
by Cai Birch » Thu Mar 28, 2019 4:54 am
I'm having difficulty getting Inverse Dynamics to run using python. I can run inverse dynamics using the external loads & coordinates file in the GUI but script crashes if I run it using Python. There must be something I'm missing in my code but it seems impossible to find out what it is. The error I'm receiving is stating 'Kernel died' everytime I try to run the idTool. Could anyone please help point me in the right direction?
Code: Select all
idTool = osim.InverseDynamicsTool('KneeSetupID.xml')
idTool.setModel(myModel)
idTool.setName('Subject1_Knee')
idTool.getExternalLoadsFileName()
idTool.getCoordinatesFileName()
motData = osim.Storage('Knee_40_2_IK.mot')
initial_time1 = motData.getFirstTime()
final_time1 = motData.getLastTime()
idTool.setStartTime(initial_time1)
idTool.setEndTime(final_time1)
idTool.getResultsDir()
idTool.getLowpassCutoffFrequency()
myModel.initSystem()
idTool.run()
Tags:
-
Thomas Uchida
- Posts: 1793
- Joined: Wed May 16, 2012 11:40 am
Post
by Thomas Uchida » Thu Mar 28, 2019 6:53 am
Here's a similar example (though using Matlab and running IK):
https://github.com/opensim-org/opensim- ... hExample.m. It might be necessary to call
initSystem() (line 13)
before setModel() (line 2). In general, I would recommend simplifying until you have something working. For example, if you have never run OpenSim code from Python, you should start with an example (located in your "OpenSim\Resources\Code\Python\" directory).