Why is my Callback function not called?
Hello,
so I have the following code:
These are my callback functions:
void callbackVel( const cu_msgs::CAN_VCUStateEstimation::ConstPtr& msg ) {
ROS_INFO("HELLO");
speed0 = msg->velocity[0] < 0.1;
}
void callbackPose( const geometry_msgs::PointStamped::ConstPtr& msg) {
Vector3f tmp = vehiclePose;
vehiclePose = Vector3f(
msg->point.x,
msg->point.y,
msg->point.z
);
//increase driven distance
odometer += (vehiclePose - tmp).norm();
}
And these are the subscriber definitions:
ros::Subscriber subVel = nh.subscribe< cu_msgs::CAN_VCUStateEstimation >("/mailman/state_estimation", 1, callbackVel);
ros::Subscriber subPose = nh.subscribe< geometry_msgs::PointStamped >("slam/best_guess/position", 1, callbackPose);
ros::Rate r(10);
while (ros::ok()) {
//do stuff
ros::spinOnce();
r.sleep();
}
The callback function "callbackPose" is called regularly as it should, but the callback function callbackVel is never called. Even though when I listen to "rostopic echo /mailman/state_estimation" I get the message at a frequency of about 100Hz. What could be the reason for that?
Can you post the code from the publishing node?