本文整理汇总了C++中ScalarActuator::getForce方法的典型用法代码示例。如果您正苦于以下问题:C++ ScalarActuator::getForce方法的具体用法?C++ ScalarActuator::getForce怎么用?C++ ScalarActuator::getForce使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScalarActuator
的用法示例。
在下文中一共展示了ScalarActuator::getForce方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeProbeInputs
/**
* Compute the Force.
*/
SimTK::Vector ActuatorForceProbe::computeProbeInputs(const State& s) const
{
int nA = getActuatorNames().size();
SimTK::Vector TotalF(getNumProbeInputs());
TotalF = 0;
// Loop through each actuator in the list of actuator_names.
for (int i = 0; i<nA; ++i)
{
// Get the Actuator force.
ScalarActuator* act = dynamic_cast<ScalarActuator*>(&_model->getActuators()[_actuatorIndex[i]]);
const double Ftmp = act->getForce(s);
// Append to output vector.
if (getSumForcesTogether())
TotalF(0) += std::pow(Ftmp, getExponent());
else
TotalF(i) = std::pow(Ftmp, getExponent());
}
return TotalF;
}
示例2: manager
/**
* Evaluate the vector function.
*
* @param s SimTK::State.
* @param aF Array of actuator force differences.
*/
void VectorFunctionForActuators::
evaluate( const SimTK::State& s, double *aX, double *rF)
{
int i;
int N = getNX();
CMC& controller= dynamic_cast<CMC&>(_model->updControllerSet().get("CMC" ));
controller.updControlSet().setControlValues(_tf, aX);
// create a Manager that will integrate just the actuator subsystem and use only the
// CMC controller
Manager manager(*_model, *_integrator);
manager.setInitialTime(_ti);
manager.setFinalTime(_tf);
manager.setSystem( _CMCActuatorSystem );
// tell the mangager to not call the analayses or write to storage
// while the CMCSubsystem is being integrated.
manager.setPerformAnalyses(false);
manager.setWriteToStorage(false);
SimTK::State& actSysState = _CMCActuatorSystem->updDefaultState();
getCMCActSubsys()->updZ(actSysState) = _model->getMultibodySystem()
.getDefaultSubsystem().getZ(s);
actSysState.setTime(_ti);
// Integration
manager.integrate(actSysState, 0.000001);
const Set<Actuator>& forceSet = controller.getActuatorSet();
// Vector function values
int j = 0;
for(i=0;i<N;i++) {
ScalarActuator* act = dynamic_cast<ScalarActuator*>(&forceSet[i]);
rF[j] = act->getForce(getCMCActSubsys()->getCompleteState()) - _f[j];
j++;
}
}