I am running forward dynamics simulations from Matlab, and then with the same controls, trying to run the Forward Dynamics tool from the GUI (or in Matlab, both have the issue), mostly for previewing purposes and to save the motion file if needed. However, running the forward tool doesn't work. Specifically, the model just disappears halfway through running - it doesn't "fail" but does not complete. Are there differences between these integration methods (using manager vs. forward tool) that would cause this? Here are the codes that I am running. This one runs no problem:
Code: Select all
import org.opensim.modeling.*;
osimModel=Model('MoBL_SLW_PrescribeTrunk.osim');
controlsfile = 'bestControls_SLW.sto';
model=osimModel.clone();
pc = PrescribedController(controlsfile);
model.addController(pc);
model.setUseVisualizer(true);
initState = model.initSystem();
initState.setTime(0);
model.equilibrateMuscles(initState);
manager = Manager(model);
manager.initialize(initState);
state = manager.integrate(1.35);
Code: Select all
import org.opensim.modeling.*
osimModel=Model('MoBL_SLW_PrescribeTrunk.osim');
model=osimModel.clone();
model.setUseVisualizer(true);
model.initSystem();
tool = ForwardTool();
tool.setControlsFileName('bestControls_SLW.sto');
tool.setModel(model);
tool.setStartTime(0);
tool.setFinalTime(1.35);
tool.setSolveForEquilibrium(true);
tool.setName('visualizeBest');
tool.run();
Thank you in advance!
Shelby