"Stride" and "Gait Cycle" are the same thing to me, a full periodic cycle from one gait event to the next instance of that same event, for example right heel-strike to the next right heel-strike.

Over a full cycle you typically want all the states and controls to be periodic, except the pelvis anterior-posterior position which is constrained (if desired) by an average speed goal. I do that with something like this:

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 too
for i = 1:model.getNumControls()
currentControlName = string(problem.createRep().createControlInfoNames().get(i-1));
periodicityGoal.addControlPair(MocoPeriodicityGoalPair(currentControlName));
end
% Average speed goal
speedGoal = MocoAverageSpeedGoal('speed');
speedGoal.set_desired_average_speed(1.45); % The number here is the average speed in m/s
problem.addGoal(speedGoal);
```

Ross