Prescribing Control files for individual Actuators in Matlab
Posted: Sun Mar 02, 2014 7:40 pm
I would like to assign two .xml control files, one to each muscle in the tug-of-war model for a forward dynamic simulation. I am using Matlab and currently I can add one controller for both muscles but then Matlab crashes when the forward simulation runs.
myPrescribedControllerMuscleA = PrescribedController();
PrescribedController('competitor1_controls.sto',1);
myPrescribedControllerMuscleA.setName('CaseyBmuscle');
myPrescribedControllerMuscleA.setActuators(model.updActuators());
model.addController(myPrescribedControllerMuscleA);
model.disownAllComponents();
model.print('tug_of_war_muscles_controller4.osim');
and the printed osim file look like this:
<ControllerSet name="Controllers">
<objects>
<PrescribedController name="CaseyBmuscle">
<!--The list of model actuators that this controller will control.The keyword ALL indicates the controller will controll all the acuators in the model-->
<actuator_list>muscle1 muscle2</actuator_list>
</PrescribedController>
</objects>
<groups />
</ControllerSet>
When I remove the underlined line above matlab doesn't crash when the simulation runs but the printed osim file doesn't seem to fully assign the controller, see below
<!--Controllers in the model.-->
<ControllerSet name="Controllers">
<objects>
<PrescribedController name="CaseyBmuscle">
<!--All properties of this object have their default values.-->
</PrescribedController>
</objects>
<groups />
</ControllerSet>
Does any one have advice on how I could do this successfully and run the forward tool without crashing Matlab?
Thanks in advance!
myPrescribedControllerMuscleA = PrescribedController();
PrescribedController('competitor1_controls.sto',1);
myPrescribedControllerMuscleA.setName('CaseyBmuscle');
myPrescribedControllerMuscleA.setActuators(model.updActuators());
model.addController(myPrescribedControllerMuscleA);
model.disownAllComponents();
model.print('tug_of_war_muscles_controller4.osim');
and the printed osim file look like this:
<ControllerSet name="Controllers">
<objects>
<PrescribedController name="CaseyBmuscle">
<!--The list of model actuators that this controller will control.The keyword ALL indicates the controller will controll all the acuators in the model-->
<actuator_list>muscle1 muscle2</actuator_list>
</PrescribedController>
</objects>
<groups />
</ControllerSet>
When I remove the underlined line above matlab doesn't crash when the simulation runs but the printed osim file doesn't seem to fully assign the controller, see below
<!--Controllers in the model.-->
<ControllerSet name="Controllers">
<objects>
<PrescribedController name="CaseyBmuscle">
<!--All properties of this object have their default values.-->
</PrescribedController>
</objects>
<groups />
</ControllerSet>
Does any one have advice on how I could do this successfully and run the forward tool without crashing Matlab?
Thanks in advance!