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
Periodicity constraint for GRFs and ground contact moments
- Kayla Pariser
- Posts: 17
- Joined: Mon Jul 30, 2018 10:35 am
- Ross Miller
- Posts: 374
- Joined: Tue Sep 22, 2009 2:02 pm
Re: Periodicity constraint for GRFs and ground contact moments
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.
Ross
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
- Kayla Pariser
- Posts: 17
- Joined: Mon Jul 30, 2018 10:35 am
Re: Periodicity constraint for GRFs and ground contact moments
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.
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.
- Ross Miller
- Posts: 374
- Joined: Tue Sep 22, 2009 2:02 pm
Re: Periodicity constraint for GRFs and ground contact moments
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
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
- Nicholas Bianco
- Posts: 1028
- Joined: Thu Oct 04, 2012 8:09 pm
Re: Periodicity constraint for GRFs and ground contact moments
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
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