MocoTrack doesn't work with a specific mesh interval

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Mohammadreza Rezaie
Posts: 377
Joined: Fri Nov 24, 2017 12:48 am

MocoTrack doesn't work with a specific mesh interval

Post by Mohammadreza Rezaie » Tue Jul 02, 2024 4:47 pm

Hi, my simple marker tracking simulation in OpenSim Moco works and converges successfully if I set the total number of meshes to 20, 25, 35, and 40. But I'm getting this error in case of 30 (or the mesh interval of 0.01):

CasADi - 2024-07-03 03:05:50 WARNING("nlp:nlp_jac_g failed: NaN detected for output jac_g_x, at nonzero index 67 (row 67, col 0).") [D:\a\opensim-core\opensim-core\dependencies\casadi\casadi\core\oracle_function.cpp:377]
Error evaluating Jacobian of equality constraints at user provided starting point.
No scaling factors for equality constraints computed!

Any idea why this is happening?
Thank you.

Tags:

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

Re: MocoTrack doesn't work with a specific mesh interval

Post by Nicholas Bianco » Fri Jul 05, 2024 9:49 am

Hi Mohammadreza,

Have you tried using the solution using 25 mesh intervals as the initial guess for the problem using 30? Usually this type of error has to do with the initial guess.

-Nick

User avatar
Mohammadreza Rezaie
Posts: 377
Joined: Fri Nov 24, 2017 12:48 am

Re: MocoTrack doesn't work with a specific mesh interval

Post by Mohammadreza Rezaie » Fri Jul 05, 2024 1:39 pm

Hi Nick, thanks for your response. I will try this. Do you mean the problem is the initial guesses? Actually, I didn't specify any initial guess; everything was default. If I adjust the time range to be 0.005s greater or lower, the 0.01 mesh interval works without any issue. Here is a test case:
test.zip
(271.05 KiB) Downloaded 2 times
Thanks for your help,
-Mohammadreza

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

Re: MocoTrack doesn't work with a specific mesh interval

Post by Nicholas Bianco » Fri Jul 05, 2024 2:07 pm

Moco always uses an initial guess. If you don't specify one, it will create a guess using the midpoint between the variable bounds. Possibly this default guess is a problem when using 30 mesh intervals for your problem.

When using different mesh intervals, the problem is discretized differently, meaning reference data in tracking goals will be sampled at different points in the trajectory. It could be that using 30 mesh intervals leads to a sample point in the reference data that is problematic.

User avatar
Mohammadreza Rezaie
Posts: 377
Joined: Fri Nov 24, 2017 12:48 am

Re: MocoTrack doesn't work with a specific mesh interval

Post by Mohammadreza Rezaie » Fri Jul 05, 2024 2:14 pm

I appreciate your help. -Mohammadreza

POST REPLY