MATLAB ForwardTool() with new initial conditions
Posted: Fri Jun 06, 2014 11:11 pm
I am currently using the OpenSim-MATLAB interface to run an optimization routine. Some of the parameters that I am optimizing are the initial conditions of each body. Currently, I am writing a handle to the coordinate set and changing the position and velocity by the following example commands:
After I change the initial conditions for each body, I run the forward tool by the following commands:
But whenever I view the new motion files, the initial conditions are set to the default pose (as described in the .xml file that contains the entire model).
Any ideas on how to create a handle to the initial conditions such that the forward tool does not revert to the default initial pose?
I am also optimizing the mass distribution of each segment, but that does not seem to give me any problems.
Regards!
Sam
Code: Select all
system = osimModel.initSystem() ;
Pelvis_tx = osimModel.updCoordinateSet().get('Pelvis_tx') ;
Pelvis_tx.setValue(system, pelvis_position_new) ;
Pelvis_tx.setSpeedValue(system, pelvis_velocity_new)
Code: Select all
tool = ForwardTool() ;
tool.setModel(osimModel) ;
tool.setStartTime(0) ;
tool.setFinalTime(5) ;
tool.setName('test_opt2') ;
tool.run() ;
But whenever I view the new motion files, the initial conditions are set to the default pose (as described in the .xml file that contains the entire model).
Any ideas on how to create a handle to the initial conditions such that the forward tool does not revert to the default initial pose?
I am also optimizing the mass distribution of each segment, but that does not seem to give me any problems.
Regards!
Sam