Page 1 of 1
Final Time Error
Posted: Sat Oct 14, 2023 9:01 am
by nvanden
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 (9.43 KiB) Viewed 685 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
Re: Final Time Error
Posted: Mon Oct 16, 2023 11:25 am
by rosshm
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
Re: Final Time Error
Posted: Tue Oct 17, 2023 11:32 am
by nbianco
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
Re: Final Time Error
Posted: Tue Oct 17, 2023 12:58 pm
by nvanden
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
Re: Final Time Error
Posted: Wed Oct 18, 2023 12:23 pm
by nbianco
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