Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Taking a quick look at your method definitions and the subscriber template parameters I'd say you have different signatures. e.g. I see 2 issues with void callbackVel( const cu_msgs::CAN_VCUStateEstimation::ConstPtr& msg ) and nh.subscribe< cu_msgs::CAN_VCUStateEstimation >:

  1. The ::ConstPtr modifier creates a different type in C++ and hence a different method.
  2. the msg is a reference (& msg) in the method signature but it's setup as 'by value' in the subscriber template parameter.

C++ allows functions to be overloaded on the basis of const-ness of parameters only if the const parameter is a reference or a pointer.

Modify one (method sig) or the other (template param), for example here I removed the ConstPtr and Reference from the type in the method declaration:

void callbackVel( const cu_msgs::CAN_VCUStateEstimation msg ) {
speed0 = msg->velocity[0] < 0.1;
    ros::Subscriber subVel = nh.subscribe< cu_msgs::CAN_VCUStateEstimation >("/mailman/state_estimation", 1, callbackVel);