Passing a parameter to a ROS Timer callback
I'm trying to pass a parameter to a ROS Timer callback using boost bind as I'd have done it for a subscriber callback but it's not working for me.
Here's the relevant part of the code.
MyClass::MyClass()
{
int my_arg = 0;
node.createTimer(ros.Duration(1.0),
boost::bind(&MyClass::callback, this, _1, _2, my_arg),
true); //for oneshot
}
void MyClass::callback(int arg)
{
ROS_ERROR_STREAM("callback: " << arg);
}
But this is not compiling:
/usr/include/boost/bind/bind.hpp:69:37: error: ‘void (MyClass::*)(int)’ is not a class, struct, or union type
Any idea?
add a comment