% This function is part of the NMSM Pipeline, see file for full license.
%
% This function maximizes the single support time for the specified foot.
%
% (struct, struct, struct, struct) -> (Array of number)
%
function cost = calcMaximizingSingleSupportTimeIntegrand(values, ...
modeledValues, params, costTerm)
for i = 1:length(params.contactSurfaces)
if params.contactSurfaces{i}.isLeftFoot == costTerm.is_left_foot
if i == 1
singleSupportTime = calcSingleSupportTime( ...
modeledValues.groundReactionsLab.forces{i + 1}(:, 2), ...
values.time);
else
singleSupportTime = calcSingleSupportTime( ...
modeledValues.groundReactionsLab.forces{i - 1}(:, 2), ...
values.time);
end
end
end
cost = calcMaximizingCostArrayTerm(singleSupportTime * ...
ones(length(values.time), 1));
end