Dropping connection due to Datatype mismatch
Hi All,
Kindly help me in finding a fix for this.
I am playing a rosbag which has 5 topics. I want to create a new node and subscribe to one of topic from the rosbag.
I am getting the below error when I try to subscribe to the topic.
[ERROR] [XXXXX]: Client [/A] wants topic /B to have datatype/md5sum [std_msgs/String/], but our version has [visualization_msgs/MarkerArray/]. Dropping connection.
Looks like the data type from bag file is visualization_msgs/MarkerArray/, how would I make modifications in code so that subscription happens without any issue ?
Subscriber Code given below:
#include "ros/ros.h"
#include "std_msgs/String.h"
#include <visualization_msgs/Marker.h>
void chatterCallback(const std_msgs::String::ConstPtr& msg)
{
ROS_INFO("Control has come inside the function");
ROS_INFO("I heard: [%s]", msg->data.c_str());
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "listener");
ros::NodeHandle n;
ros::Subscriber sub = n.subscribe("my_topic", 1000, chatterCallback);
ROS_INFO("Initiated the ROS node and subscriber");
ros::spin();
return 0;
}
Updating the question:
I am trying the same code outside and inside the docker.
Outside the docker: Fixed the error by changing the datatype of the parameter in call back to const visualization_msgs::MarkerArray::ConstPtr& msg
But inside the docker the issue remains the same. The control doesn't come inside the callback function at all.
Waiting 0.2 seconds after advertising topics.../rrrrrr/platform/ros/ros_comm/roscpp/src/libros/publication.cpp:629 Publication::validateHeader() [ERROR] [1535722434.248608746]: Client [/my_c] wants topic /topic to have datatype/md5sum [visualization_msgs/MarkerArray/90da67007c26525f655c1c269094e39f], but our version has [visualization_msgs/MarkerArray/d155b9ce5188fbaf89745847fd5882d7]. Dropping connection.
Thank you, KK
Change the subscription callback signature to accept
visualization_msgs/MarkerArray
?