Async spinner with callback that is class member
Hi guys,
I want to use an ros::AsyncSpinner
with a callback that is a class member. Can somebody provide me an example?
The problems I run into is that either, the subscriber does not take a ros::CallbackQueue
or that ros::SubscriberOptions
that I initialize do not take my tracked object when using
ros::SubscriberOptions s;
s.create<std_msgs::Float64>("topic_name", 1, &MyClass::callbackFunction, this, callbackQueue);
The error I get with this is
cannot convert '(MyClass*)this' (type 'MyClass*') to type 'const VoidConstPtr& {aka const boost::shared_ptr<const void>&}'
It seems to me that the create
function of ros::SubscriberOptions
is not made for use of class members as Callbacks. But how does it work? It is easy to use a class member as callback function but how do I add my CallbackQueue
to use an AsyncSpinner
? Any of both questions would lead to solving this issue, I suppose. Thank you for your support!