Ask Your Question

Revision history [back]

Take a look at the roscpp::NodeHandle docs for the subscribe method. None of those look like they will work with a function that takes a void* argument. All seem to require a function or method that takes a ros message either by value or shared_ptr.

Note that your callback function should take some type of ROS message, not a void*. Changing CS::bvmHandler to something like CS::bvmHandler(std_msgs::Bool::Ptr flag) would probably compile, since it gives the compiler enough hints about which subscribe template to pick and instantiate.

Take a look at the roscpp::NodeHandle docs for the subscribe method. None of those look like they will work with a function that takes a void* argument. All seem to require a function or method that takes a ros message either by value or shared_ptr.

Note that your callback function should take some type of ROS message, not a void*. Changing CS::bvmHandler to something like CS::bvmHandler(std_msgs::Bool::Ptr flag) would probably compile, compile (once you fix up the function body logic for the new flag type), since it gives the compiler enough hints about which subscribe template to pick and instantiate.

click to hide/show revision 3
Added link from tfoote

Take a look at the roscpp::NodeHandle docs for the subscribe method. These valid signatures are also included on the wiki. None of those look like they will work with a function that takes a void* argument. All seem to require a function or method that takes a ros message either by value or shared_ptr.

Note that your callback function should take some type of ROS message, not a void*. Changing CS::bvmHandler to something like CS::bvmHandler(std_msgs::Bool::Ptr flag) would probably compile (once you fix up the function body logic for the new flag type), since it gives the compiler enough hints about which subscribe template to pick and instantiate.