Reputation: 81
This is my subscriber declaration followed by the callback function
message_filters::Subscriber<geometry_msgs::Point32>
point_sub(*nh, "tracked_point", 1);
point_sub.registerCallback(&visualservoing3D::pointCallback);
The callback declaration is
void
visualservoing3D::pointCallback(const geometry_msgs::Point32ConstPtr& msg)
{
//Some functions
}
But the following error pops up. I know its something to do with my subscriber.
/usr/include/boost/function/function_template.hpp:225:
error: no match for call to
‘(boost::_mfi::mf1<void,
visualservoing3D, const
boost::shared_ptr<const
geometry_msgs::Point32_<std::allocator<void>
> >&>) (const boost::shared_ptr<const geometry_msgs::Point32_<std::allocator<void>
>&)’
Thanks,
Nagsaver
Upvotes: 1
Views: 1826
Reputation: 393934
point_sub.registerCallback(&visualservoing3D::pointCallback);
You need to bind the non-static member function to an object instance:
#include <boost/bind.hpp>
point_sub.registerCallback(boost::bind(&visualservoing3D::pointCallback, p_vs, _1));
Where p_vs
is a (shared) pointer to a visualservoing3D
object. If you need/wish to bind to a reference, use boost::ref(vs)
Upvotes: 1