About TugOfWar_createModel example problem
Posted: Mon Jun 15, 2015 1:51 am
Hi,
I'm trying to compile TugOfWar_createModel Examples in the depelopers guide.
I wrote the code I attached below(Prescribe Muscle Controls from functions in 'Performing a simulation part three').
It can be built in VS,
but the error (PrescribedController does not have muscle1 in its list of actuators to control.) appears.
Does anyone know why the error appears??
It would be great if someone could help me to solve this issue.
Best regards,
Shoko Horibata
I'm trying to compile TugOfWar_createModel Examples in the depelopers guide.
I wrote the code I attached below(Prescribe Muscle Controls from functions in 'Performing a simulation part three').
It can be built in VS,
but the error (PrescribedController does not have muscle1 in its list of actuators to control.) appears.
Does anyone know why the error appears??
Code: Select all
// Create a prescribed controller that simply applies control as function of time
PrescribedController *muscleController = new PrescribedController();
muscleController->setActuators(osimModel.updActuators());
// Define linear function for the control values for the two muslces
Array<double> slopeAndIntercept1(0.0, 2); // array of 2 doubles
Array<double> slopeAndIntercept2(0.0, 2);
// muscle1 control has slope of -1 starting 1 at t = 0
slopeAndIntercept1[0] = -1.0/(finalTime-initialTime); slopeAndIntercept1[1] = 1.0;
// muscle2 control has slope of 1 starting 0.05 at t = 0
slopeAndIntercept2[0] = 1.0/(finalTime-initialTime); slopeAndIntercept2[1] = 0.05;
// Set the indiviudal musle control functions for the prescribed muscle controller
muscleController->prescribeControlForActuator("muscle1", new LinearFunction(slopeAndIntercept1));
muscleController->prescribeControlForActuator("muscle2", new LinearFunction(slopeAndIntercept2));
// Add the muscle controller to the model
osimModel.addController(muscleController);
It would be great if someone could help me to solve this issue.
Best regards,
Shoko Horibata