For a simulation, I\'m using boost::numeric::odeint but I\'m having a problem. I\'m using the integrate function inside a method of one of my classes and I\'m having the error o
odeint needs an
operator()( const state_type &x , state_type &dxdt , double dt )
In your case, MotionGenerator does not have this operator, but you can bind the method 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);
}
```
But,it would be easy to rename your method motionScheme
to operator()
, and simply pass *this
to integrate.
Edit: You can also use std::ref
to avoid copies of your instance of 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);
}