Duration Problem

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
Burak Kula
Posts: 31
Joined: Wed Dec 04, 2019 3:34 pm

Duration Problem

Post by Burak Kula » Sat Dec 05, 2020 3:06 am

Hello Everyone,
I have a question about the duration of visualizer's output.

In my MATLAB script I make tracking and than prediction as everyone does. At the beginning of the tracking part I designate my reference data's time duration (like in example2DWalking.cpp, starting: 0.00, ending: 0.47 etc.). Then when I designate the time bounds, I use below code which is only state bound about the time.

"problem.setTimeBounds(0, [0.4 0.6]);"

As a result of this tracking and prediction study, usually I obtain a visual output with duration of 0.6 second. When I change this numeric values, it effects my output but duration is still same.

How can I obtain much longer visual output, like 2 or 3 cycles of gait ??? and Why the change of numeric values effect my output?

User avatar
Ross Miller
Posts: 371
Joined: Tue Sep 22, 2009 2:02 pm

Re: Duration Problem

Post by Ross Miller » Sat Dec 05, 2020 5:34 am

Hi Burak,

On your first question, by setting the bounds on the movement duration (T) to [0.4,0.6], that tells Moco to optimize T over that range to minimize the cost function, so it sounds to me like the optimizer is converging on the upper bound of T = 0.6.

On your second question, it sounds like you are simulating a movement duration of one step and want the visualizer to animate several steps? The visualizer won't figure that out on its own, it will just animate whatever data are in the MocoTrajectory input to it. To animate several steps from a solution with one step, I think you would have to manually mirror and append that step into a new trajectory then animate that (or run an optimization where T is the duration of several steps, but that could be a long/hard optimization problem).

Ross

User avatar
Burak Kula
Posts: 31
Joined: Wed Dec 04, 2019 3:34 pm

Re: Duration Problem

Post by Burak Kula » Thu Dec 10, 2020 1:54 am

Hello Ross,
Thank you for your reply.

When I run the script like this, it makes iterations.
problem.setTimeBounds(0, [0.4, 06]);

But when I run the script like this, it did not make iterations.
problem.setTimeBounds(0, [0, 0.47]);

How can I determine this time range ?

Best Regards,
Burak KULA.

User avatar
Ross Miller
Posts: 371
Joined: Tue Sep 22, 2009 2:02 pm

Re: Duration Problem

Post by Ross Miller » Thu Dec 10, 2020 9:28 am

Not sure without seeing the error text but my guess is the bound on the final value for T includes a movement duration of zero and Moco doesn't like that. With this code:

Code: Select all

problem.setTimeBounds(0, [0, 0.47]);
you are telling Moco that you want the movement to start at time=0 and end at a time=[0,0.47] with the end-time chosen in that range by the optimizer.

You probably want to set the bounds on T to cover reasonable/realistic movement durations, so the lower bound on the final value should be non-zero.

Ross

User avatar
Aaron Fox
Posts: 271
Joined: Sun Aug 06, 2017 10:54 pm

Re: Duration Problem

Post by Aaron Fox » Thu Dec 10, 2020 3:29 pm

Hi Burak,

I'd echo Ross' point but also note that I've come into errors when altering the end time ranges with respect to any initial guess being used. I recall getting an error if my initial guess had time values outside of the specified range (i.e. if the initial guess went from 0 - 0.5 and I specified an end time range of 0 - 0.4, I think it caused an error).

Aaron

POST REPLY