I'm using OpenSim libraries in MATLAB to perform an inverse dynamic analysis. I'm using the inverseDynamicsSolver class. I realized I have an issue with appliedBodyForces when I'm performing the analysis. When I introduce the external forces to the appliedBodyForces spatial vector, I find out they are applied to the origin of the local reference of each body, instead of being applied to the COM of each body.
I would like to know if there is any way to introduce external forces to the COM and not to the origin of the local axes when performing the inverse dynamic analysis. I attach a little piece of code to illustrate what I'm doing:
Code: Select all
% Initializing variables
idSolver = InverseDynamicsSolver(osimModel);
appliedBodyForces = VectorOfSpatialVec(13,BodyForce_0);
appliedMobilityForces = Vector(10,0.0);
Force_5 = Vec3(0.0);
Moment_5 = Vec3(0.0);
bodies = osimModel.getBodySet();
for i=1:n % Loop for each time frame
% Introducing external forces to body 5 (applied to the origin of local reference...)
% FPL is a matrix of external forces and moments
Force_5.set(0,FPL1(i,1));
Force_5.set(1,FPL1(i,2));
Force_5.set(2,FPL1(i,3));
Moment_5.set(0,FPL1(i,4));
Moment_5.set(1,FPL1(i,5));
Moment_5.set(2,FPL1(i,6));
BodyForce_5.set(0,Moment_5);
BodyForce_5.set(1,Force_5);
appliedBodyForces.set(5,BodyForce_5);
% Performing the inverse dynamics analysis
jointTorques = idSolver.solve(osimState,xdot2,appliedMobilityForces,appliedBodyForces);
end