I have a question related to the definition of external ground reaction forces as controls, to use the in an inverse dynamics analysis, and the realization of the system.
In the model we have defined the Ground Reaction Forces as two sets of three Point Actuators and three Torque Actuators acting at the left and right calcaneous.
We have a mexfile in .cpp that we call from Matlab. We have as inputs coordinates (q), velocities (qdot), accelerations (knownUdot) and GRFs (controls).
Per each time step, the main part of the code is:
Code: Select all
s.setQ(q);
s.setU(qdot);
osimModel.getMultibodySystem().realize(s, Stage::Position);
osimModel.updControls(s) = controls;
osimModel.markControlsAsValid(s);
Tau = idSolver.solve(s,knownUdot);
2. If we realize at Position or Velocity level, the results are the same (and are correct, because we are comparing them our previous way of solving Inverse Dynamics, and also with the results from ID Tool in the GUI). Why there's no difference between realizing at position and velocity level?
But if we look to the definitions of these functions in the OpenSim API, it seems that we should be at the Dynamics Stage:
SimTK::Vector & OpenSim::Model::updControls(const SimTK::State & s) const
This call invalidates the dynamics of the model and invalidates the value of the controls until they are marked as valid when the update is completed
void OpenSim::Model::markControlsAsValid(const SimTK::State & s) const
Mark controls as valid after an update at a given state.
Indicates that controls are valid for use at the dynamics stage. If the stage is Velocity or lower the controls will remain invalid.
3. If we realize at Dynamics level, then the controls are not taken into account (We can see this comparing to the previous results, and also because the residual vertical force is around 500-600 N, that corresponds aprox. to the weight). This means that in updControls or in markControlsAsValid, the stage is realized to dynamics?
Thanks,
Miriam Febrer