opensim-org / opensim-moco

Solve optimal control problems for musculoskeletal models using OpenSim and direct collocation.
https://opensim.stanford.edu/moco
Apache License 2.0
57 stars 16 forks source link

Add regularization on all trajectory variables #261

Open chrisdembia opened 5 years ago

chrisdembia commented 5 years ago

Ton mentioned that he adds a small-weighted regularization term on all his trajectory variables to help the solver. We should look into this.

antoinefalisse commented 5 years ago

We do the same, to avoid singular arcs.

chrisdembia commented 5 years ago

Ah that's good to know. Thanks for sharing. Are there any details about how you do this that might be helpful? What weight do you use? Do you minimize even constant parameters?

antoinefalisse commented 5 years ago

I'm not sure I do it in the most proper way but I usually add all remaining controls (e.g., time derivatives of muscle activation and tendon force when using implicit activation and contractions dynamics) in the cost function with a low weight (about 0.001). See this example for the muscle redundancy solver. There are some explanations about singular arcs in Betts (see section 4.1.3 for instance). I am not sure what should be done for the constant parameters but I don't minimize them. We also noticed that adding controls in the cost function limits the spiky results that we sometimes observe.

nickbianco commented 5 years ago

We also noticed that adding controls in the cost function limits the spiky results that we sometimes observe.

We see this when we solve a tracking problem that tracks results from an effort minimization problem. The effort minimization controls are smooth, but the tracking solution controls are spiky since the tracking term is the only cost term. Add a low weighted effort term helps remove the spikyness.