本文整理汇总了C++中ScalarActuator::setOverrideForce方法的典型用法代码示例。如果您正苦于以下问题:C++ ScalarActuator::setOverrideForce方法的具体用法?C++ ScalarActuator::setOverrideForce怎么用?C++ ScalarActuator::setOverrideForce使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScalarActuator
的用法示例。
在下文中一共展示了ScalarActuator::setOverrideForce方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/**
* Compute all constraints given x.
*/
void ActuatorForceTargetFast::
computeConstraintVector(SimTK::State& s, const Vector &x,Vector &c) const
{
CMC_TaskSet& taskSet = _controller->updTaskSet();
const Set<Actuator>& fSet = _controller->getActuatorSet();
int nf = fSet.getSize();
// Now override the actuator forces with computed active force
// (from static optimization) but also include the passive force
// contribution of muscles when applying forces to the model
for(int i=0;i<nf;i++) {
ScalarActuator* act = dynamic_cast<ScalarActuator*>(&fSet[i]);
act->overrideForce(s,true);
act->setOverrideForce(s, x[i]);
}
_controller->getModel().getMultibodySystem().realize(s, SimTK::Stage::Acceleration );
taskSet.computeAccelerations(s);
Array<double> &w = taskSet.getWeights();
Array<double> &aDes = taskSet.getDesiredAccelerations();
Array<double> &a = taskSet.getAccelerations();
// CONSTRAINTS
for(int i=0; i<getNumConstraints(); i++)
c[i]=w[i]*(aDes[i]-a[i]);
// reset the actuator control
for(int i=0;i<fSet.getSize();i++) {
ScalarActuator* act = dynamic_cast<ScalarActuator*>(&fSet[i]);
act->overrideForce(s,false);
}
_controller->getModel().getMultibodySystem().realizeModel(s);
}