本文整理汇总了C++中PrescribedController::clone方法的典型用法代码示例。如果您正苦于以下问题:C++ PrescribedController::clone方法的具体用法?C++ PrescribedController::clone怎么用?C++ PrescribedController::clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PrescribedController
的用法示例。
在下文中一共展示了PrescribedController::clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
actLevels.append(1.0);
Array<double> reflexGains;
reflexGains.append(0.0);
reflexGains.append(0.5);
reflexGains.append(1.0);
reflexGains.append(2.0);
reflexGains.append(5.0);
reflexGains.append(10.0);
//reflexGains.append(100.0);
//reflexGains.append(1000.0);
ControllerSet inputControllerSet(osimModel,ctrlFile);
cout << "Found " << inputControllerSet.getSize() << " controllers." << endl;
for (int i = 0; i < inputControllerSet.getSize(); i++)
{
DelayedPathReflexController* reflex = dynamic_cast<DelayedPathReflexController*>(&inputControllerSet.get(i));
if (reflex) {
for (int i = 0; i<reflex->getActuatorSet().getSize(); i++)
{
OpenSim::ActivationFiberLengthMuscle* muscle = dynamic_cast<OpenSim::ActivationFiberLengthMuscle*> (&reflex->updActuators().get(i));
if (muscle)
{
muscle->setDefaultActivation(0.0);
}
}
reflex->set_isDisabled(true);
osimModel.addController(reflex->clone());
}
}
for (int i = 0; i < inputControllerSet.getSize(); i++)
{
PrescribedController* prescribed = dynamic_cast<PrescribedController*>(&inputControllerSet.get(i));
if (prescribed) {
prescribed->set_isDisabled(true);
osimModel.addController(prescribed->clone());
}
}
ControllerSet& controllers = osimModel.updControllerSet();
cout << "Model has " << controllers.getSize() << " controllers." << endl;
int numControllers, numParameters;
numControllers = controllers.getSize();
//optLog << "numControllers = " << numControllers << endl;
State& osimState = osimModel.initSystem();
/* Read desired kinematics*/
Storage k_desired = Storage(kinematicsFile);
Storage *q_desired, *u_desired;
osimModel.getSimbodyEngine().formCompleteStorages(osimState, k_desired, q_desired, u_desired);
cout << "Joint velocities estimated." << endl;
if (q_desired->isInDegrees())
{
cout << "Converting coordinates from degrees to radians." << endl;
osimModel.getSimbodyEngine().convertDegreesToRadians(*q_desired);
}