Divide total cost by displacement?

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
Jiacheng Weng
Posts: 26
Joined: Wed Jan 15, 2020 1:05 pm

Divide total cost by displacement?

Post by Jiacheng Weng » Mon Feb 15, 2021 7:49 pm

Hi Moco users and dev teams,

I am currently developing a study with multiple goals for walking. I want to have all the goals divided by the CoM displacement so that the duration of a step can be optimized rather than being hard constrained.

The MocoControlGoal has the setDivideByDisplacement method which allows division by CoM displacement. However, many other goals (e.g. MocoOrientationTrackingGoal, MocoSumSquaredStateGoal, and set_minimize_implicit_multibody_accelerations) don't have this option. Is there any way to have the total cost (sum of cost from all goals) divided by the CoM displacement?

Any suggestions about how to achieve this would be really appreciated.

Thanks,
Jiacheng

User avatar
Jiacheng Weng
Posts: 26
Joined: Wed Jan 15, 2020 1:05 pm

Re: Divide total cost by displacement?

Post by Jiacheng Weng » Fri Feb 19, 2021 7:55 pm

Just for the update. I ended up reimplementing all the goals for my application using MocoCustionGoal plugin and added the option to divideByDisplacement.

Cheers,
Jiacheng

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

Re: Divide total cost by displacement?

Post by Nicholas Bianco » Mon Feb 22, 2021 2:14 pm

Hi Jiacheng,

Dividing by the COM displacement is mostly relevant for goals that minimize control effort (or related goals), so as to normalize the cost function by the distance traveled by the model. Otherwise, if running a predictive simulation and not normalizing by COM displacement, the problem would minimize effort such that the model would not move at all.

It's probably worth including for MocoSumSquaredStateGoal, as that is often used to minimize muscle activations. set_minimize_implicit_multibody_accelerations should really be used for numerical conditioning (i.e., improving convergence) when using implicit dynamics; it's not really designed to be used like a typical MocoGoal.

It seems like you have this working for your plugin though. Let me know if you have other questions.

-Nick

User avatar
Jiacheng Weng
Posts: 26
Joined: Wed Jan 15, 2020 1:05 pm

Re: Divide total cost by displacement?

Post by Jiacheng Weng » Mon Mar 01, 2021 5:48 pm

Hi Nick,
nbianco wrote:
Mon Feb 22, 2021 2:14 pm
It's probably worth including for MocoSumSquaredStateGoal, as that is often used to minimize muscle activations.
It seems like you have this working for your plugin though. Let me know if you have other questions.
For what you said here, what is the difference in minimizing muscle activation vs control goal? Based on what I know, control goal minimizes the muscle excitation which is before the first order activation dynamics. However, muscle activation is after the first order activation dynamics which has some "delay" comparing to the excitation signal. Which one is more appropriate to use in predictive control?

In many papers, muscle activation is used in the objective. However, from what I tried with the walking2D example, using the control goal instead of activation goal usually yields more realistic walking motion with standing as initial guess.

Thanks,
Jiacheng

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

Re: Divide total cost by displacement?

Post by Nicholas Bianco » Wed Mar 03, 2021 12:58 pm

Which one is more appropriate to use in predictive control?
I wouldn't say excitation or activations are necessarily better for predictive simulation. It depends on your model, other cost terms, and other factors in your simulation. You should choose a cost function that produces realistic motion and validate against experimental data whenever possible.

-Nick

POST REPLY