What is the correct usage of initSystem()

The 2018 Fall Virtual Workshop will bring together a group of international scholars and OpenSim experts to help each other advance their research using modeling and simulation. This forum is a place to accelerate OpenSim based projects while also buildin
POST REPLY
User avatar
Nicos Haralabidis
Posts: 196
Joined: Tue Aug 16, 2016 1:46 am

What is the correct usage of initSystem()

Post by Nicos Haralabidis » Tue Oct 23, 2018 4:00 am

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

User avatar
Thomas Uchida
Posts: 1792
Joined: Wed May 16, 2012 11:40 am

Re: What is the correct usage of initSystem()

Post by Thomas Uchida » Tue Oct 23, 2018 7:20 am

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.

POST REPLY