Setting initial joint coordinates and force parameters from an STO file

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Jonathan Perdomo
Posts: 6
Joined: Fri May 28, 2021 7:00 am

Setting initial joint coordinates and force parameters from an STO file

Post by Jonathan Perdomo » Thu Jun 24, 2021 12:02 pm

Hi everyone,

I was wondering if it is possible to use an *.STO file with initial values at time 0 (for joint coordinates and force parameters) to load and set up the initial state for a model in C++? I want to set the initial state of the model before running a simulation.


Sincerely,

Jonathan Perdomo
Drexel University

Tags:

User avatar
Jonathan Perdomo
Posts: 6
Joined: Fri May 28, 2021 7:00 am

Re: Setting initial joint coordinates and force parameters from an STO file

Post by Jonathan Perdomo » Thu Jun 24, 2021 12:08 pm

My current approach is to load the *.STO file as a SimTK::Storage object, and then try to update each of the parameters individually in a for-loop.

User avatar
Ayman Habib
Posts: 2244
Joined: Fri Apr 01, 2005 12:24 pm

Re: Setting initial joint coordinates and force parameters from an STO file

Post by Ayman Habib » Thu Jun 24, 2021 12:23 pm

Hi Jonathan,

Many of the items you described are state variables and have a default value stored in the model's osim file (e.g. default value for coordinates or muscle activations). You can set these in the file and you get the initialization for free on call to initSystem(). Generally it could be hard to come up on your own with a consistent set of states, especially if a model contains constraints, but if you list what you want to initialize in your case, it could be easier than the more generic but harder problem.

Hope this helps,
-Ayman

User avatar
Jonathan Perdomo
Posts: 6
Joined: Fri May 28, 2021 7:00 am

Re: Setting initial joint coordinates and force parameters from an STO file

Post by Jonathan Perdomo » Mon Jun 28, 2021 11:58 am

Hi Ayman,

OK thank you for the suggestion. I ended up finding a useful utility, the OpenSim::ForwardTool(), to set the initial state and controller files via the input XML.


Sincerely,

Jonathan

POST REPLY