Hi all,
I am wondering whether someone can inform me of the correct usage of initSystem() and when it is appropriate/not appropriate to use?
I am currently using it once after my initial call to load the model as a global variable in my mex function:
Model *myModel = new Model("folder/something.osim");
SimTK::State *myState = new State(myModel->initSystem());
I then subsequently use myState throughout my main mex function to set my state variables, update the model to the position and velocity stages, obtain position and velocity information of stations, and compute state variable derivatives etc.
e.g. SimTK::Vector derivs = myModel->computerStateVariableDerivatives(*myState);
Kind regards,
Nicos Haralabidis
What is the correct usage of initSystem()
- Nicos Haralabidis
- Posts: 196
- Joined: Tue Aug 16, 2016 1:46 am
- Thomas Uchida
- Posts: 1792
- Joined: Wed May 16, 2012 11:40 am
Re: What is the correct usage of initSystem()
You can find examples throughout the GitHub repo (https://github.com/opensim-org/opensim-core), including the "Simple example" in README.md. You may also find the "OpenSim Architecture at a Glance" section of the API Guide helpful: https://simtk.org/api_docs/opensim/api_ ... chitecture. There is another C++ example here: https://github.com/opensim-org/opensim- ... pperDevice.