% This function is part of the NMSM Pipeline, see file for full license.
%
% This function maximizes the trailing limb for the specified foot.
%
% (struct, struct, struct, struct) -> (Array of number)
%
function cost = calcMaximizingTrailingLimbAngleIntegrand(values, ...
modeledValues, params, costTerm)
for i = 1:length(params.contactSurfaces)
if params.contactSurfaces{i}.isLeftFoot == costTerm.is_left_foot
normalForce = ...
modeledValues.groundReactionsLab.forces{i}(:, 2) - 20;
end
end
trailingLimbAngle = calcTrailingLimb(costTerm, values, ...
normalForce, params);
cost = calcMaximizingCostArrayTerm(trailingLimbAngle * ...
ones(length(values.time), 1));
end