getAngularVelocity & getAngularVelocityBodyLocal; return identical values

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Nicos Haralabidis
Posts: 197
Joined: Tue Aug 16, 2016 1:46 am

getAngularVelocity & getAngularVelocityBodyLocal; return identical values

Post by Nicos Haralabidis » Tue Oct 08, 2019 7:26 am

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

Tags:

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: getAngularVelocity & getAngularVelocityBodyLocal; return identical values

Post by Dimitar Stanev » Tue Oct 08, 2019 1:52 pm

The two functions have the same implementation. Maybe for backward compatibility reasons.

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

User avatar
Nicos Haralabidis
Posts: 197
Joined: Tue Aug 16, 2016 1:46 am

Re: getAngularVelocity & getAngularVelocityBodyLocal; return identical values

Post by Nicos Haralabidis » Mon Oct 14, 2019 2:02 pm

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

POST REPLY