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


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

本文整理汇总了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;
}
开发者ID:sunlixin723,项目名称:opensim-core,代码行数:24,代码来源:ActuatorForceProbe.cpp

示例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++;
	}


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


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