Moco Prediction

OpenSim Moco is a software toolkit to solve optimal control problems with musculoskeletal models defined in OpenSim using the direct collocation method.
POST REPLY
User avatar
Matilde Tomasi
Posts: 4
Joined: Thu Jul 07, 2016 1:18 pm

Moco Prediction

Post by Matilde Tomasi » Thu Dec 12, 2019 7:24 am

Hi everyone,

first of all thank you for the great work you did!
I was trying to follow the example "sit-to-stand " with some little variations. In particular, I'd like to use the results from the torque-driven predictive problem (in terms of coordinates and speeds) as initial guesses for the muscle-driven predictive problem.
The file "predictedSolution.sto" obviously does not contain values for muscle controls, but only for the controls of the torque actuators. If I use it as guess file in this form, I get the error "Java.lang.RuntimeException: Iterate and provided problem are not compatible" (which I expected).
I tried to manually modify the .sto file by removing labels for actuators controls or, alternatively, to add labels for muscle controls making sure that the numbers of states and controls matches between the .sto file and the model. It doesn't work either. (error: "java.lang.RuntimeException: Datatype 'double' is not supported.Thrown at STOFileAdapter.cpp:77 in createSTOFileAdapterForReading().").

Wrapping up I'd like to know:
1) what kind of file structure does the "setGuessFile()" accepts, and is there a way to properly obtain it?
2) if it's possible to pass through the "setGuessFile()" just coordinates and speed values and no muscle controls. In this case, would the solver automatically assigns initial guesses for muscle controls?

Thank you very much,
Matilde

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: Moco Prediction

Post by Christopher Dembia » Thu Dec 12, 2019 11:55 am

The way we currently designed the setting of guesses is that we require strict compatibility. The guess must have a column for every variable in the problem. To help with this, we allow you to obtain a guess "template" by calling `solver.createGuess()`. This function also takes some arguments to choose the kind of guess you want, including a random guess. Then you can modify the guess returned by this function, using the variety of methods on MocoTrajectory such as setState() and insertStatesTrajectory().

User avatar
Matilde Tomasi
Posts: 4
Joined: Thu Jul 07, 2016 1:18 pm

Re: Moco Prediction

Post by Matilde Tomasi » Fri Dec 13, 2019 9:07 am

Thank you very much Christopher, I followed your instructions and it worked!

Matilde

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: Moco Prediction

Post by Christopher Dembia » Fri Dec 13, 2019 9:24 am

:)

POST REPLY