Page 1 of 2

Foot slips in MocoTrack solution

Posted: Tue Feb 02, 2021 12:48 pm
by pouya.amiri
Hi everyone,
I am trying to do a tracking simulation using mocotrack.
For the tracking reference, I am using the joint angles that I obtained from OpenSim invers kinematics solution; the motion capture data belongs to a unilateral transtibial amputee. As the musculuskeletal model, I am also using a unilateral transtibial model with reduced muscle numbers.

As the starter, I am removing all the muscles from the model and solving a torque-driven state tracking problem (next step I will add the muscles and an actuator at the prosthetic ankle). For tracking, I use a global weighting of 5 for the states and 0.001 for control effort term. I am simulating a whole gait cycle. The tracking works fine, but there are some deviations from the inverse kinematics results, most notably is that both feet slip when they are at stance phase.
My understanding is that MocoTrack does not use a contact model and uses the measured GRF. So, the contact model should not matter for this.
My question is that how can I resolve the slipping problem and achieve acceptable tracking? Is this related to the weighting of the terms? The examples given in MocoTrack documenation show very close tracking, so I am trying to achieve similar performance.

Thanks,
Pouya

Re: Foot slips in MocoTrack solution

Posted: Thu Feb 04, 2021 8:32 am
by rosshm
Hi Pouya,

MocoTrack as far as I know does not apply measured GRF data to the model. The model generates its own GRF, e.g. from contact elements defined in the model. You can optionally specify a GRF datafile and have the model try to track those data using MocoContactTrackingGoal.

Ross

Re: Foot slips in MocoTrack solution

Posted: Thu Feb 04, 2021 10:06 am
by pouya.amiri
Thanks Ross for the response.

I am a bit confused. MocoTrack asks for a GRF xml file as one of its inputs. But in the Moco Traking documentation is clearly explained that the tracking happens for the states/markers (but nothing is said about the GRF). Why does it ask for the GRF then? The other thing is that if you save the model which is the output of ModelProcessor (and is used for mocoTracking) and open it in OpenSim GUI, you will see that the GRF are applied under "Other Forces", which I guess are external forces applied to the system.

The other question is that can you give me any insight as of why the foot slips in the tracking? Previously I used the exact same model and motion data with Residual Reduction Algorithm/CMC and the slip happens there, too (of course it's way worse in RRA).

Thanks,
Pouya

Re: Foot slips in MocoTrack solution

Posted: Thu Feb 04, 2021 1:39 pm
by pouya.amiri
Update:
Instead of tracking the states from the inverse kinematics solution, I solved a marker tracking problem, and this works very well.

But I am still not sure how contact modelling works in MocoTrack. Hope someone can share some insights.

Pouya

Re: Foot slips in MocoTrack solution

Posted: Fri Feb 05, 2021 1:26 pm
by nbianco
Hi Pouya,

MocoTrack does not ask for or handle ground reaction forces in any way currently. If you apply external loads to the model (e.g., via ModOpAddExternalLoads()), then the loads will be applied during the simulation as they would in any OpenSim simulation. If you instead apply compliant foot-ground contact elements to the model (see SmoothSphereHalfSpaceForce), then the model will generate its own contact loads as Ross described.

The current version of exampleMocoTrack uses the former approach, where external loads are applied the model while tracking coordinates. This example was created before compliant contact was available in Moco, and is currently outdated as this approach is not ideal. You see the foot slip on the ground because the GRFs are applied at a fixed point, and there is no contact element applying friction to prevent the foot from sliding around.

If you're interested in tracking problems, I suggest trying to use compliant contact. You should check out the examples we included in our recent publication for Moco: https://journals.plos.org/ploscompbiol/ ... bi.1008493. The code for these examples can be found here: https://github.com/stanfordnmbl/mocopaper. I'm hoping to move these examples into proper Moco examples soon, and update MocoTrack to support compliant contact force tracking via MocoContactTrackingGoal.

-Nick

Re: Foot slips in MocoTrack solution

Posted: Thu Feb 25, 2021 8:49 am
by pouya.amiri
Thanks Nick.

I have difficulty getting SmoothSphereHalfSpaceForce() to work in MATLAB. I define a SmoothSphereHalfSpaceForce object, but I am not sure what method to use to add contact geometry to it. I tried to use for example setContactSphereBody() method, but it is not available. I can only set the parameters of the contact such as stiffness, etc.

I'd appreciate it if you can tell me how I can do this.

Thanks,
Pouya

Re: Foot slips in MocoTrack solution

Posted: Thu Feb 25, 2021 1:59 pm
by rosshm
I'm not sure how to do it via Matlab scripting but attached is an example of how I've done it via XML in the .osim file itself. Note that both the forces themselves (I put them under <ForceSet>) and the contact geometries (under <ContactGeometrySet>) have to be defined for each contact element.

Ross

Re: Foot slips in MocoTrack solution

Posted: Tue Mar 02, 2021 12:09 pm
by pouya.amiri
Thanks a lot Ross for sharing your model. It's a huge help.

I have a more general question: how do you decide about your contact model in general? Could you please point to a good reference that provides details about this? i.e. how the number, location, radius of contact spheres are selected and how this affects the model performance. Most research articles only briefly mention their contact model selection, but there is not much details regarding the reason of their choice.
Thanks,
Pouya

Re: Foot slips in MocoTrack solution

Posted: Thu Mar 04, 2021 2:59 pm
by nbianco
Hi Pouya,

Antoine Falisse, the creator of the SmoothSphereHalfSpaceForce component, has performed calibrations to optimize the position and shape of his foot-ground contact models (see "Algorithmic differentiation improves the computational efficiency of OpenSim-based trajectory optimization of human movement"). However, anecdotally, he has told me that he can still get good GRF tracking without calibration, and I've also found this to be true in my simulations.

Of course it depends on your model and problem, but Ross's model should give you a reasonable starting point.

-Nick

Re: Foot slips in MocoTrack solution

Posted: Thu Mar 04, 2021 3:24 pm
by rosshm
The values I used for contact parameters were from Brian Umberger's 2-D example that comes with Moco, which I think were also referenced from Antoine's simulations. Like Nick, in my experience simulation results at least for tracking problems are not terribly sensitive to the form of the contact model or to the parameter vales as long as they are reasonable, e.g. deform by ~ 1 cm under bodyweight and not a huge amount of damping.

The size and locations of the contact elements in my model above are arbitrary. At a minimum for walking I think you'd want elements on the heel, met heads, and distal toes, but with too few elements I sometimes find the joint moments don't look right even if the tracking of kinematic and GRF data is good, so I like to use more than that minimal set so that the CoP can move smoothly along the foot.

Ross