Hi Matthew,
I've done a lot of experimenting over the last couple of years, using many of the suggestions from this thread (and a few other discussions on the forum) as a starting point. I've recently uploaded a preprint that details all of the modelling choices I made for predictive gait simulations of the emu, using moco. I'll summarize some of my modelling choices here:
I tend to use a cost function that includes the coordinate accelerations as a smoothness criterion ( solver.set_minimize_implicit_multibody_accelerations(true); solver.set_implicit_multibody_accelerations_weight(weight); ). The technical justification for this is to prevent "singular arcs", but I think it's also justifiable from the perspective that very impulsive/jerky locomotion simply hurts, so I think animals do actually select for smooth motions to some extent.
It's really worth it to do a deep dive into the contact model to understand what all the parameters do, although in the end I did just do a comprehensive search for parameters that match data well enough. Static and dynamic friction coefficients are multiplied by the vertical component of the GRF to give the horizontal component of the GRF. The transition velocity determines at what sliding speed you transition between the two components. I gave them both the same value (so there's no speed-based transition), but if you have more data for your simulations you could make a more informed choice. Important to understand is that static & dynamic components depend wholly on the vertical GRF, bit viscous friction does not (viscous friction also has a component that is simply dependent on the sliding speed, as I understand it). A little bit of viscous friction (0.1) seemed to prevent toe dragging in my simulations. Reducing dissipation in the cost function can reduce vertical (and then by extension, also horizontal) impact peaks.
It has been my experience that if you get smooth walking trajectories, you can sequentially increase the speed and you will tend to get smooth running trajectories as well. So part of it is just searching enough until you get a smoother trajectory. Some non-smooth or oscillatory behaviour at higher speeds actually seems to be realistic in real animals (at least in emus, see Figure 4 in the preprint I linked). So I didn't try to get a perfectly smooth GRF trajectory.
Also, it's worth thinking about your cost-function. I tend to minimize the derivative of Tendon force as well (solver.set_minimize_implicit_auxiliary_derivatives(true); solver.set_implicit_auxiliary_derivatives_weight(weight)). This is, again, based on advice from people on this forum, with the idea that it limits singular arcs. You can interpret it as a cost that encourages "smooth contractions", and actually very simple models show that something akin to Force-rate minimization gives much smoother GRFs (link and link). Getting smoother vertical GRFs, via the friction model, can then also result in smoother horizontal GRFs (although everything tends to be more unpredictable at higher speeds).
Nick mentioned in a recent thread that the newest update of Moco now enables you to define sphere forces as an output that you can minimize (using mocoOutputGoal). This means that you could just directly minimize the horizontal components (if you raise them to a power I think you could reduce oscillations). It kind of depends on if you can justify having it in your cost function though. In general, I've found it's easier to morph a smooth trajectory (e.g. at a lower speed) into a trajectory at the speed that I want, than it is to make non-smooth trajectory smooth by adding terms to the cost function. You could also try looking specifically for smooth trajectories with such a mocoOutputGoal, and then once you find it, reoptimize without it in the cost function (but that might be biasing your solution to a specific optimum).
Hope this helps!
Cheers,
Pasha
Contact force oscillations/parameter tuning
- Pasha van Bijlert
- Posts: 219
- Joined: Sun May 10, 2020 3:15 am
- Nicholas Bianco
- Posts: 1003
- Joined: Thu Oct 04, 2012 8:09 pm
Re: Contact force oscillations/parameter tuning
Thanks for the excellent and detailed reply Pasha!
I'm sticky-ing this post, since this will be helpful for many users to read and consider for their simulations.
I'm sticky-ing this post, since this will be helpful for many users to read and consider for their simulations.
- Pasha van Bijlert
- Posts: 219
- Joined: Sun May 10, 2020 3:15 am
Re: Contact force oscillations/parameter tuning
Hi Nick,
Thank you, I appreciate it (and your advice and help on this forum has really helped shape my approach and workflows!).
For completeness I add some more sources that I think are useful for people on this forum:
Ackermann & van den Bogert 2011 (on the effect of different exponents and weighting of muscle muscle activations in the cost function; I think the Moco 2D examples call unweighted activations cubed "effort", which this paper calls "fatigue")
https://doi.org/10.1098/rspb.2022.1189 (A recent paper that gives some empirical evidence that humans don't always minimize only fatigue or effort)
Falisse et al 2019(multi-objective cost function that I was heavily inspired by)
Sherman et al. 2011 (description of the contact model used in OpenSim, amongst other things)
Serrancoli et al. 2019 (this describes the smoothing of the contact model)
Ross's UMocoD project was also very useful to me, as an example of how to implement certain aspects of the Moco code.
Cheers,
Pasha
Thank you, I appreciate it (and your advice and help on this forum has really helped shape my approach and workflows!).
For completeness I add some more sources that I think are useful for people on this forum:
Ackermann & van den Bogert 2011 (on the effect of different exponents and weighting of muscle muscle activations in the cost function; I think the Moco 2D examples call unweighted activations cubed "effort", which this paper calls "fatigue")
https://doi.org/10.1098/rspb.2022.1189 (A recent paper that gives some empirical evidence that humans don't always minimize only fatigue or effort)
Falisse et al 2019(multi-objective cost function that I was heavily inspired by)
Sherman et al. 2011 (description of the contact model used in OpenSim, amongst other things)
Serrancoli et al. 2019 (this describes the smoothing of the contact model)
Ross's UMocoD project was also very useful to me, as an example of how to implement certain aspects of the Moco code.
Cheers,
Pasha