MocoOrientationTrackingGoal

OpenSim Moco is a software toolkit to solve optimal control problems with musculoskeletal models defined in OpenSim using the direct collocation method.
User avatar
Karthick Ganesan
Posts: 118
Joined: Thu Oct 10, 2013 12:11 am

Re: MocoOrientationTrackingGoal

Post by Karthick Ganesan » Wed Sep 23, 2020 8:05 am

I was doing tracking simulation with Ross Miller's 2D Model with implicit multibody dynamics. One issue was in setting the initial guess . By default, the implicit derivatives were not there in the initial guess. So, to get a compatible initial guess I used createGuess(). However I could not find a way to include the tracked states into the initial guess. So I inserted the states trajectory from the previous solution with explicit dynamics as suggested by Ross.
With this approach the solver could not converge within 2000 iterations. I also tried starting from the createGuess() and only setting the tendon forces to be of low value. This also didn't converge within 2000 iterations. Ross Miller also mentioned that he could not get good results with implicit multibody dynamics. I am also wondering why is it so, since implicit dynamics is supposed to have better convergence.

User avatar
Nicholas Bianco
Posts: 963
Joined: Thu Oct 04, 2012 8:09 pm

Re: MocoOrientationTrackingGoal

Post by Nicholas Bianco » Wed Sep 23, 2020 11:18 am

Thanks for the details, Karthick.

Were you minimizing accelerations? If so, what weight were you using? These settings can significantly impact convergence.

MocoTrajectory has the methods 'generateAccelerationsFromSpeeds' and 'generateAccelerationsFromValues'. You can use these to fill in accelerations in an initial guess created from explicit dynamics problem.

User avatar
Karthick Ganesan
Posts: 118
Joined: Thu Oct 10, 2013 12:11 am

Re: MocoOrientationTrackingGoal

Post by Karthick Ganesan » Sat Sep 26, 2020 6:54 am

Yes. I was minimizing accelerations with a weight of 0.001.
Regarding setting the initial guess, ideally I would want to use the tracked states as the initial guess not the solution from explicit dynamics. However, it seems for creating a compatible initial guess I have to use createGuess(). If I do so I am not sure how to insert the tracked states into the created guess without using a previous solution from explicit dynamics

User avatar
Nicholas Bianco
Posts: 963
Joined: Thu Oct 04, 2012 8:09 pm

Re: MocoOrientationTrackingGoal

Post by Nicholas Bianco » Mon Sep 28, 2020 12:14 pm

I would try increasing the accelerations weight. I usually see improved convergence when I increase the weight, you just want to make sure it's not dominating the cost function.

You can use those MocoTrajectory methods on the guess with the tracked states too. When using the 'apply_tracked_states_to_guess' MocoTrack property, a default guess is created internally (from the bounds) and then the tracked states are applied. So you can use 'getGuess' on the solver to get the guess with the tracked states applied, and then generate the accelerations with the MocoTrajectory methods. You can then reapply the guess with the accelerations to the solver.

Let me know if that makes sense.

POST REPLY