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
Setting initial joint coordinates and force parameters from an STO file
- Jonathan Perdomo
- Posts: 6
- Joined: Fri May 28, 2021 7:00 am
- Jonathan Perdomo
- Posts: 6
- Joined: Fri May 28, 2021 7:00 am
Re: Setting initial joint coordinates and force parameters from an STO file
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.
- Ayman Habib
- Posts: 2252
- Joined: Fri Apr 01, 2005 12:24 pm
Re: Setting initial joint coordinates and force parameters from an STO file
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
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
- Jonathan Perdomo
- Posts: 6
- Joined: Fri May 28, 2021 7:00 am
Re: Setting initial joint coordinates and force parameters from an STO file
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
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