0

I am trying to pass the subscriber callback function from another class as std::function object.

const std::function<void(const geometry_msgs::Twist&)> cmd_vel_callback;

test_sub = cmd_vel_node_handle.subscribe<geometry_msgs::Twist&>("/"+subscription_topic,100, cmd_vel_callback);

But I am getting this compilation error:


error: no match for call to ‘(std::function<void(const geometry_msgs::Twist_<std::allocator<void> >&)>) (const boost::shared_ptr<const geometry_msgs::Twist_<std::allocator<void> > >&)’

Is it because the callback object can only be of boost::function type and not std::function type?

Reference: node_handle.subscribe

0 Answers0