Final Time Error

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
Nicholas Vandenberg
Posts: 71
Joined: Wed Jan 20, 2021 12:47 pm

Final Time Error

Post by Nicholas Vandenberg » Sat Oct 14, 2023 9:01 am

Hi all,

I've been running into an odd error. I have a perturbation code set up that applies changes to my model's abductor max iso force and loops through MocoTracking problems for each condition. I've been able to get this running on two other models but with this particular one I'm getting this error:
Time_Error.png
Time_Error.png (9.43 KiB) Viewed 573 times
Which doesn't make a ton of sense, so I'm wondering if there's something else I may be missing? I don't know if anyone's seen something like this before or not but I'd appreciate whatever you can think of.

Best,
Nick

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

Re: Final Time Error

Post by Ross Miller » Mon Oct 16, 2023 11:25 am

I've never seen this one before but from the reference to "resampling" I'm guessing it's something related to the initial guess.

My guess would be it's re-sampling the initial guess and somehow getting a final time in the guess of 1.799999999999... or something, when the problem is specifying a final time of 1.800000... . Not sure how to fix that but maybe it's at least helpful in identifying the problem.

I've not had much luck running Moco in loops and have resorted to brute-forcing such things (run it once, converges, come back later, manually change the parameter, run it again). It is not the fastest way of generating the data but it works at least.

Ross

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

Re: Final Time Error

Post by Nicholas Bianco » Tue Oct 17, 2023 11:32 am

Hi Nick,

I bet Ross is right, but if you post a few more details about your workflow I can try to help and debug further.

-Nick

User avatar
Nicholas Vandenberg
Posts: 71
Joined: Wed Jan 20, 2021 12:47 pm

Re: Final Time Error

Post by Nicholas Vandenberg » Tue Oct 17, 2023 12:58 pm

Thanks for the replies! I'd kinda wondered if the 'exactness' of the final time definition would be a culprit or not.

As far as the workflow, I have a MocoTrack problem over an amputated limb gait cycle (HS -> HS). I start with a simple torque-driven tracking problem (state and marker tracking, contact tracking), then I use that as an initial guess (pull the states specifically to populate an otherwise bounded guess) for a muscle-driven problem that becomes my 'baseline solution' of the experimental data. The baseline then gets used as the initial guess for my perturbation code which loops through an array to solve the same tracking problem, but scaling the max isometric force of a specific group of muscles by the array value. -- Let me know if more detail is needed

I've been able to do this workflow for 3 or 4 models previously so it may likely be what Ross suggested, which could be an easy check by using a different IK trial as an input or a different time window from this trial?

Thanks,
Nick

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

Re: Final Time Error

Post by Nicholas Bianco » Wed Oct 18, 2023 12:23 pm

Hi Nick,

That all seems reasonable to me. I would take a look at the file containing the initial guess that triggers the error and see if the final time does exceed the problem's final time (i.e., before rounding).

I recently added a method to MocoTrajectory called 'trimToIndices' , which you could use to drop the last couple of rows in your resampled trajectory that exceed the problem's final time. You could use that to prevent the error from reoccuring.

Best,
Nick

POST REPLY