getAngularVelocity & getAngularVelocityBodyLocal; return identical values
Posted: 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
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