Choosing Moco weights and constraints

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
Madison Wissman
Posts: 4
Joined: Wed Aug 23, 2023 12:04 pm

Choosing Moco weights and constraints

Post by Madison Wissman » Tue Sep 24, 2024 8:54 am

Hi all,

I am working on simulating walking with MocoTrack and have a couple of questions. First, I am hoping to look at the effect of unilateral muscle weakness on kinematics but have only had success getting Moco to solve with a symmetry constraint. Otherwise, I exceed maximum iterations or will get a solution that is unrealistic (ie. model lifting off the ground). Are there other constraints I could add in place of this that would encourage a realistic solution? The current symmetry constraint matches coordinate values and muscle activations.

Also, when choosing weights for joint tracking, is there a specific process people use to do this? I have done trial and error until I get motion that looks similar to what I expect, but for MocoTrack when there is an element of prediction is there a way to determine weights that balances tracking experimental kinematics with the ability to alter those to fit the input parameters?

Thanks so much for your insight.

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

Re: Choosing Moco weights and constraints

Post by Nicholas Bianco » Tue Sep 24, 2024 10:19 am

Hi Madison,

I think a few more details about your simulation would be helpful (e.g., I assume you are using a foot-ground contact model, but not sure). In general, symmetry constraints are a great option for constraining the beginning and ends of the trajectory. Otherwise, the initial states are free to take any value they want, which can lead to the "floating" model problem you're alluding (in this case, you probably have high initial pelvis speeds). An alternative I've used before is to constrain initial joint values and speeds using bounds based on reference kinematic data.

For joint tracking, one approach that I like (that I stole from Ross Miller) is to normalize tracking weights based on the variability in joint kinematics across multiple trials. For example, if the ankle joint angle variability across ~5 walking trials is low, then increase the tracking weight since this joint ankle measurement is more reliability. For joints with high variability, use a lower weight. To automate this, just divide the tracking weight be the joint variance.

Best,
Nick

User avatar
Madison Wissman
Posts: 4
Joined: Wed Aug 23, 2023 12:04 pm

Re: Choosing Moco weights and constraints

Post by Madison Wissman » Wed Sep 25, 2024 12:24 pm

Thanks Nick! This is helpful.

Yes, I am using a foot-ground contact model. I already have constraints on the initial position of the trunk and pelvis based on the reference kinematics, would you recommend setting more initial joint speeds and values to compensate for losing the symmetry? Or is there a way to isolate the symmetry goal to just the beginning or end of the trajectory?

Best,
Madison

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

Re: Choosing Moco weights and constraints

Post by Nicholas Bianco » Wed Sep 25, 2024 5:02 pm

Hi Madison,
would you recommend setting more initial joint speeds and values to compensate for losing the symmetry? Or is there a way to isolate the symmetry goal to just the beginning or end of the trajectory?
I would recommend the former, since the latter relies on MocoPeriodicityGoal which inherently ties the beginning and end of the trajectory together.

Best,
Nick

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

Re: Choosing Moco weights and constraints

Post by Ross Miller » Thu Sep 26, 2024 6:11 am

I stole it from numerous Rick Neptune papers!

It would be nice if the weights could be time-varying, e.g. heavy/light weight during portions of the gait cycle when variance is low/high. Nick, is this possible (either now, or potentially)?

Ross

POST REPLY