I want to look at the effect of activating different pairs of muscles on the movement of the limbs. I am having a problem with automating this, however. I can get the simulation to run and save a .mot file, but I can't get it to set the activations and actually work (they stay at the default instead of the desired setting here of 0.5). I'm sure this is a straightforward problem with either syntax or order. Any help to straighten this out would be greatly appreciated. The code is below:
import os
import org.opensim.utils as utils
import org.opensim
modelFile = "C:/Users/John/Desktop/Scripting/rat_model.osim"
loadModel(modelFile);
model = getCurrentModel();
myBodySet = model.getBodySet();
myMuscles = model.getMuscles();
nMuscles = myMuscles.getSize();
myState = model.initSystem()
myMuscles.get(0).setActivation(myState,.5)
myMuscles.get(1).setActivation(myState,.5)
tool = modeling.ForwardTool()
tool.setModel(model);
tool.setStartTime(0);
tool.setFinalTime(.1);
tool.setSolveForEquilibrium(1);
tool.setName('Rat');
tool.run();
Question about scripting in the GUI
- John Olthoff
- Posts: 14
- Joined: Sun Sep 06, 2015 6:56 pm
Re: Question about scripting in the GUI
I answered my own question, well, at least I got around the problem by creating a controller.
But for future reference: are the default_activation variable and setActivation() method not accessible/available from the gui scripting?
Thanks!
But for future reference: are the default_activation variable and setActivation() method not accessible/available from the gui scripting?
Thanks!