I am using the C++ API to update the coordinate values of my model (estimated previously by calling mInverseKinematicsSolver.track()) and then use computeCurrentMarkerLocations to get the new marker locations in the ground frame.
Unfortunately, the values of the marker locations are not correct because it seems like the state is not updated somehow. I can set the coordinate values to other values, the marker locations values will not change.
Here below is the code I am using where I am setting 0.0 for each coordinate of my model for testing:
Code: Select all
auto& state = mModel->updWorkingState();
state.updTime() = 0.0;
// Predict coordinates using the Evolution matrix
*mXPred = (*mA) * (*mX);
// Update the model with the predicted coordinates
const OpenSim::CoordinateSet& coordinateSet = mModel->getCoordinateSet();
for (int i = 0; i < coordinateSet.getSize(); i++)
{
coordinateSet[i].setValue(state, 0.0);// (*mXPred)(i));
}
mModel->getMultibodySystem().realize(state, SimTK::Stage::Position);
auto markerNames = mMarkersReference->getNames();
int nbrMarkers = markerNames.size();
SimTK::Array_<SimTK::Vec3> markerLocations(nbrMarkers, SimTK::Vec3(0));
mInverseKinematicsSolver->computeCurrentMarkerLocations(markerLocations);
Thank you for your help
Vincent