odeint 需要一个
operator()( const state_type &x , state_type &dxdt , double dt )
在您的情况下,MotionGenerator没有此运算符,但您可以绑定方法motionScheme
#include <functional>
namespace pl = std::placeholders;
// ...
// not tested
void MotionGeneration::execute()
{
state_type init_conf = { 0, -1.5708, 0, 0, 0, -1.5708, 0, -1.5708, 0, 0.5};
boost::numeric::odeint::integrate(
std::bind(&MotionGenerator::motionScheme, *this , pl::_1 , pl::_2 , pl::_3 ) , init_conf, 0.0, 1.0, 0.05, plot);
}
```
但是,重命名你的方法很容易motionScheme
to operator()
,然后简单地通过*this
集成。
编辑:您还可以使用std::ref
避免复制 MotionGenerator 实例:
void MotionGeneration::execute()
{
state_type init_conf = { 0, -1.5708, 0, 0, 0, -1.5708, 0, -1.5708, 0, 0.5};
boost::numeric::odeint::integrate(
std::bind(&MotionGenerator::motionScheme, std::ref(*this) , pl::_1 , pl::_2 , pl::_3 ) , init_conf, 0.0, 1.0, 0.05, plot);
}