opensim-core
opensim-core copied to clipboard
Enabled getCoordinatesInMultibodyTreeOrder
We are trying to step through a .mot
file and record information at each time point. Looking at how InverseDynamics achieves model positions, we are modifying the Q vector in state.setQ(newVector)
. The issue is understanding which coordinate is associated with each position in the Q vector requires model.getCoordinatesInMultibodyTreeOrder()
. Would it be possible to implement a version of that function call such that even just an org.opensim.modeling.StringVector
is returned?
If not, what is the recommended way to put the model into a specific pose?
You can set positions and velocities using the Coordinate::setValue()
and Coordinate::setSpeedValue()
methods. Please note the third argument to Coordinate::setValue()
. 🦉
How do I get a mutable version of the coordinate of interest? model.getCoordinateSet().get(coordName)
returns an immutable reference correct?
Example:
>> model.getCoordinateSet().get(1).setValue(state, 5)
>> model.getCoordinateSet().get(1).getValue(state)
ans =
1.5708
No need for Coordinate to be non-const as the change of value only changes the state not the coordinate definition. You may want to look into StateTrajectory class for help/usage
Please post additional questions over on the user forum. Thanks!