Page 1 of 1

Calculate COM acceleration

Posted: Mon Mar 24, 2014 9:50 am
by maaafsch
Dear Opensim users,

I would like to use the position, velocity and acceleration of my model as input for a controller. Inside my controller class, I’m able to calculate the position and velocity of the whole body COM. (s = state)

--- SimTK::Vec3 com_position =getModel().calcMassCenterPosition(s);
--- SimTK::Vec3 com_velocity =getModel().calcMassCenterVelocity(s);

However, I’m not able to calculate the acceleration of the whole body COM.

--- SimTK::Vec3 com_acc =getModel().calcMassCenterAcceleration(s);

I tried to compute the state derivatives first, but this doesn't solve the problem.

--- getModel().computeStateVariableDerivatives(s);
--- SimTK::Vec3 com_acc =getModel().calcMassCenterAcceleration(s);

Can somebody help me with this problem?

Regards,
Maarten

Re: Calculate COM acceleration

Posted: Mon Mar 24, 2014 10:21 am
by sherm
Hi, Maarten. Since controllers generate forces, and forces generate accelerations, accessing the acceleration in a controller isn't a well-defined concept. One could imagine wrapping the whole system in some self-consistent iteration that tries to get the controller output consistent with the acceleration it uses and generates. Or, you might logically be working with a delayed signal, so that your controller looks at an earlier acceleration to affect its current output. Another alternative is that you may have in mind a feed-forward style controller in which the controller has an embedded plant model; that can work but you would probably need a separate model for use by the controller.

Can you say more about what you are trying to accomplish?

Regards,
Sherm