Page 1 of 1

getAngularVelocity & getAngularVelocityBodyLocal; return identical values

Posted: Tue Oct 08, 2019 7:26 am
by nicos1993
Hi all,

I am trying to create a simulated accelerometer signal using the advice provided in the following post: https://simtk.org/plugins/phpBB/viewtop ... rt=0&view=

I noticed however that getAngularVelocity & getAngularVelocityBodyLocal returned the same outputs even when I was anticipating differences, has anybody noticed this before? I believe the angular velocity they are both returning is wrt the ground.

Below is a snippet of my code in the 3.3 Matlab API:

osimModel = Model([pathModel,'model_3DOF.osim']);
osimState = osimModel.initSystem();

states = [0.2 0 -0.2 5 4 2];
for i = 0:nStates-1
osimModel.setStateVariable(osimState,stateNames.get(i),states(i+1));
end

osimModel.computeStateVariableDerivatives(osimState);

modelControls = osimModel.updControls(osimState);
actuatorControls = Vector(1,0.0);

cont = [1; 0; 0];
for i = 0:nActuators-1
actuatorControls.set(0,cont(i+1));
osimModel.updActuators().get(i).addInControls(actuatorControls,modelControls);
end

% Set the control (excitation) values
osimModel.setControls(osimState,modelControls);

osimModel.computeStateVariableDerivatives(osimState);

simbodyEngine = osimModel.getSimbodyEngine();
hand = osimModel.getBodySet().get('hand_r');

hand_w_velG = Vec3(0);
simbodyEngine.getAngularVelocity(osimState,hand,hand_w_velG);

hand_w_velL = Vec3(0);
simbodyEngine.getAngularVelocityBodyLocal(osimState,hand,hand_w_velL);

Kind regards,

Nicos Haralabidis

Re: getAngularVelocity & getAngularVelocityBodyLocal; return identical values

Posted: Tue Oct 08, 2019 1:52 pm
by mitkof6
The two functions have the same implementation. Maybe for backward compatibility reasons.

https://github.com/opensim-org/opensim- ... e.cpp#L318

Re: getAngularVelocity & getAngularVelocityBodyLocal; return identical values

Posted: Mon Oct 14, 2019 2:02 pm
by nicos1993
Hi Dimitar,

Thanks for confirming this! I was looking for this type of documentation but I didn't manage to stumble upon!

Kind regards,

Nicos Haralabidis