Skip to main content

setupGroundContact.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% This function first calculates the midfoot superior location and then
% transfers the ground reaction moments from the electrical center to the
% midfoot superior location.
%
% (struct) -> (struct)
% Transfers the ground reaction moments to the midfoot superior location


function inputs = setupGroundContact(inputs)
for i = 1:length(inputs.contactSurfaces)
midfootSuperiorLocation = pointKinematics(inputs.experimentalTime, ...
inputs.experimentalJointAngles, inputs.experimentalJointVelocities, ...
inputs.contactSurfaces{i}.midfootSuperiorPointOnBody, ...
inputs.contactSurfaces{i}.midfootSuperiorBody, inputs.mexModel, ...
inputs.coordinateNames);
midfootSuperiorLocation(:, 2) = 0;
inputs.contactSurfaces{i}.experimentalGroundReactionMoments = ...
transferMoments(inputs.contactSurfaces{i}.electricalCenter, ...
midfootSuperiorLocation, ...
inputs.contactSurfaces{i}.experimentalGroundReactionMoments, ...
inputs.contactSurfaces{i}.experimentalGroundReactionForces);
end
end