Page 1 of 1

What is the correct usage of initSystem()

Posted: Tue Oct 23, 2018 4:00 am
by nicos1993
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

Re: What is the correct usage of initSystem()

Posted: Tue Oct 23, 2018 7:20 am
by tkuchida
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.