I was wondering if it is possible to realize the system to a new stage, using MatLab API?
In C++ i use this:
Code: Select all
model.getMultibodySystem().realize(state, Stage::Acceleration);
Thanks
Sina
Code: Select all
model.getMultibodySystem().realize(state, Stage::Acceleration);
Code: Select all
model.computeStateVariableDerivatives(s)
Code: Select all
osimModel = Model('tug_of_war_muscles.osim');
% SET DEFAULT ACTIVATION OF MUSCLES
actuatorSet = osimModel.getActuators();
for muscleIndx= 0:actuatorSet.getSize()-1
theMuscle =ActivationFiberLengthMuscle.safeDownCast(actuatorSet.get(muscleIndx) );
theMuscle.set_default_activation(0.5);
end
% SET CONTROLLER FOR MUSCLES
muscleController = PrescribedController();
muscleController.setActuators(osimModel.updActuators());
for muscleIndx= 0:actuatorSet.getSize()-1
muscleController.prescribeControlForActuator(muscleIndx, Constant(0.5));
end
osimModel.addController(muscleController);
% CALCULATE DERIVATIVES
States = osimModel.initSystem();
Derivatives=osimModel.computeStateVariableDerivatives(States );