Skip to main content

calcBodyVelocity.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% This function calculates the velocity of the specified point on the
% specified body with respect to the ground.
%
% (struct, Array of number, Array of string, struct) -> (Array of string)
%


function bodyVelocity = calcBodyVelocity(values, pointOnBody, ...
bodyName, params)

import org.opensim.modeling.Model
osimModel = Model(params.model);
osimModel.finalizeConnections();
bodyIndex = osimModel.getBodySet.getIndex(bodyName);
[~, bodyVelocity] = pointKinematics(values.time, values.statePositions, ...
values.stateVelocities, pointOnBody, bodyIndex, ...
params.mexModel, params.coordinateNames);
end