opensim-org / opensim-core

SimTK OpenSim C++ libraries and command-line applications, and Java/Python wrapping.
https://opensim.stanford.edu
Apache License 2.0
783 stars 316 forks source link

[Moco] Streamline post-hoc analyses for models with `PositionMotion` #3646

Closed nickbianco closed 1 month ago

nickbianco commented 9 months ago

In MocoInverse, after a problem solves, we automatically add back to the MocoTrajectory the kinematics prescribed to the model via the PositionMotion in the model. This works well when solving problems directly from MocoInverse, but if you instead export a MocoInverse problem to a MocoStudy (e.g., to add another cost function), then the kinematics will not be included in the final MocoTrajectory returned to the user.

This means the user needs to add the kinematics back to the trajectory themselves in order to run an analysis, and doing so is unintuitive: example forum post.

We should automate this, or at least provide a convenience function on MocoTrajectory for adding in kinematics from a model's PositionMotion.

Try adding a method to MocoStudy that looks for PositionMotion in the model to add back.