当前位置: 首页>>代码示例>>C++>>正文


C++ ScalarActuator::getActuation方法代码示例

本文整理汇总了C++中ScalarActuator::getActuation方法的典型用法代码示例。如果您正苦于以下问题:C++ ScalarActuator::getActuation方法的具体用法?C++ ScalarActuator::getActuation怎么用?C++ ScalarActuator::getActuation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ScalarActuator的用法示例。


在下文中一共展示了ScalarActuator::getActuation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: tempAccel

/**
 * Get an optimal force.
 */
void StaticOptimizationTarget::
getActuation(SimTK::State& s, const SimTK::Vector &parameters, SimTK::Vector &forces)
{
    //return(_optimalForce[aIndex]);
    const ForceSet& fs = _model->getForceSet();
    SimTK::Vector tempAccel(getNumConstraints());
    computeAcceleration(s, parameters, tempAccel);
    for(int i=0,j=0;i<fs.getSize();i++) {
        ScalarActuator* act = dynamic_cast<ScalarActuator*>(&fs.get(i));
        if( act )forces(j++) = act->getActuation(s);
    }
}
开发者ID:chrisdembia,项目名称:opensim-core,代码行数:15,代码来源:StaticOptimizationTarget.cpp

示例2: 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->getActuation(s);

        // Append to output vector.
        if (getSumForcesTogether())
            TotalF(0) += std::pow(Ftmp, getExponent());
        else
            TotalF(i) = std::pow(Ftmp, getExponent());
    }
    return TotalF;
}
开发者ID:antoinefalisse,项目名称:opensim-core,代码行数:24,代码来源:ActuatorForceProbe.cpp

示例3: 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->getActuation(getCMCActSubsys()->getCompleteState()) - _f[j];
        j++;
    }


}
开发者ID:fcanderson,项目名称:opensim-core,代码行数:46,代码来源:VectorFunctionForActuators.cpp

示例4: return

/**
* Record the actuation quantities.
*/
int Actuation::
record(const SimTK::State& s)
{
    if (_model == NULL) return(-1);

    // MAKE SURE ALL ACTUATION QUANTITIES ARE VALID
    _model->getMultibodySystem().realize(s, SimTK::Stage::Dynamics);

    // TIME NORMALIZATION
    double tReal = s.getTime();

    // FORCE
    const Set<Actuator>& fSet = _model->getActuators();
    for (int i = 0, iact = 0; i<fSet.getSize(); i++) {
        ScalarActuator* act = dynamic_cast<ScalarActuator*>(&fSet[i]);
        if (!fSet.get(i).get_isDisabled())
            _fsp[iact++] = act->getActuation(s);
    }
    _forceStore->append(tReal, _na, _fsp);

    // SPEED
    for (int i = 0, iact = 0; i<fSet.getSize(); i++) {
        ScalarActuator* act = dynamic_cast<ScalarActuator*>(&fSet[i]);
        if (!fSet.get(i).get_isDisabled())
            _fsp[iact++] = act->getSpeed(s);
    }
    _speedStore->append(tReal, _na, _fsp);

    // POWER
    for (int i = 0, iact = 0; i<fSet.getSize(); i++) {
        if (!fSet.get(i).get_isDisabled())
            _fsp[iact++] = fSet.get(i).getPower(s);
    }
    _powerStore->append(tReal, _na, _fsp);


    return(0);
}
开发者ID:bit20090138,项目名称:opensim-core,代码行数:41,代码来源:Actuation.cpp


注:本文中的ScalarActuator::getActuation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。