Page 1 of 1
Periodicity constraint for GRFs and ground contact moments
Posted: Thu Feb 29, 2024 1:55 pm
by kpariser
Hi,
One more quick question today! Thank you for your help!
I ran a 3D muscle-driven walking tracking simulation for one full gait cycle where I track muscle activations (note: I ignore activation dynamics for all muscles), experimental ground reaction forces, and experimental states and set a periodicity constraint for all states and controls. Overall, the simulation did a pretty good job tracking muscle activations and states (except for the arms, subtalar, and toes - but these states had small weights). However, the ground reaction forces and moments in some of the directions were highly non-periodic which does not seem realistic. Is there a way to set a periodicity constraint for ground reaction forces and moments with Moco?
Thank you,
Kayla
Re: Periodicity constraint for GRFs and ground contact moments
Posted: Thu Feb 29, 2024 2:03 pm
by rosshm
Hi Kayla,
If the model's GRF are from the usual foot-ground contact elements, the states being periodic should also result in periodic GRF.
Did you set all the generalized speeds (e.g. joint angular velocities) to be periodic too?
Below is the code I use to get states and controls that are periodic over a stride, which also results in periodic GRF.
Code: Select all
% All states are periodic except pelvis anterior-posterior translation
for i = 1:model.getNumStateVariables()
currentStateName = string(model.getStateVariableNames().getitem(i-1));
if (~contains(currentStateName,'pelvis_tx/value'))
periodicityGoal.addStatePair(MocoPeriodicityGoalPair(currentStateName));
end
end
% All controls are periodic
for i = 1:model.getNumControls()
currentControlName = string(problem.createRep().createControlInfoNames().get(i-1));
periodicityGoal.addControlPair(MocoPeriodicityGoalPair(currentControlName));
end
Ross
Re: Periodicity constraint for GRFs and ground contact moments
Posted: Thu Feb 29, 2024 2:50 pm
by kpariser
Hi Ross,
Thank you! I actually used that code to set up my periodicity constraints since I had found it in a previous forum post. Thank you for being so willing to share your code to help all of us in the community out!
Looking back at my data, I found an error with how I translated the output GR moment to be about a new point to compare about the equivalent point that our reference GR moments were calculated about. Looking back at the direct Moco output it was periodic. Guess I was too quick to post on this one.
Thank you for the clarification! It does make sense that periodicity in states and controls should result in periodic GRFs and GR moments.
Re: Periodicity constraint for GRFs and ground contact moments
Posted: Fri Mar 01, 2024 3:22 am
by rosshm
Glad the codes are helpful!
I don't normally track the GR moments, just the forces. My rationale is if the tracking of the GRF and of the kinematics are both good, and if the model itself is good, then the CoP should look good too (a gauge of validity). But if you want to make sure the model's CoP is good then tracking the moments directly should do that.
Ross
Re: Periodicity constraint for GRFs and ground contact moments
Posted: Fri Mar 08, 2024 11:03 am
by nbianco
Hi Kayla,
The new Moco features in the OpenSim 4.5 release enable constraining the GRFs to be periodic. There's new Outputs for SmoothSphereHalfSpaceForce that you can use with MocoOutputPeriodicityGoal.
That being said, I would still recommend Ross suggestion to just constrain the states to be periodic, since the contact forces are directly a function of the model's kinematic state.
Best,
Nick