[/rviz] wants topic /visualization_markers to have datatype/md5sum
I am trying to publish and visualize MarkerArray
.
I am calling publish_marker_array
function from inside my main
function -
void publish_marker_array(ros::NodeHandle &nh, vector<pair<size_t, size_t> >&frontiers, costmap_2d::Costmap2D* &global_costmap_) {
cout << "INSIDE THE PUBLISH_MARKERS FUNCTION! " << endl;
size_t sz = frontiers.size();
visualization_msgs::MarkerArray frontier_marker_array;
for(int i =0 ;i < sz ; i++){
visualization_msgs::Marker marker;
marker.header.frame_id = "map";
marker.header.stamp = ros::Time();
cout << "namespace: " << nh.getNamespace() << endl;
marker.ns = nh.getNamespace();
marker.id = 1;
marker.type = visualization_msgs::Marker::SPHERE;
marker.action = visualization_msgs::Marker::ADD;
marker.pose.position.x = 2000;
marker.pose.position.y = 2000;
marker.pose.position.z = 1;
marker.pose.orientation.x = 0.0;
marker.pose.orientation.y = 0.0;
marker.pose.orientation.z = 0.0;
marker.pose.orientation.w = 1.0;
marker.lifetime = ros::Duration(1.0);
marker.scale.x = 1;
marker.scale.y = 1;
marker.scale.z = 1.0;
marker.color.a = 1.0; // Don't forget to set the alpha!
marker.color.r = 1.0;
marker.color.g = 0.0;
marker.color.b = 0.0;
frontier_marker_array.markers.push_back(marker);
}
ros::Time start = ros::Time::now();
ros::Duration del(20.0);
ros::Time end = start + del ;
cout << "Loop starts at: " << ros::Time::now().toSec() << endl;
while(ros::Time::now() < start + del) {
ros::Publisher vis_pub = nh.advertise<visualization_msgs::MarkerArray>( "visualization_markers", 10 );
//marker.id = ++id;
vis_pub.publish(frontier_marker_array);
//ros::Duration(0.5).sleep();
//cout << "Current time: " << ros::Time::now().toSec() << endl;
}
cout << "Loop ends at: " << ros::Time::now().toSec() << endl;
}
On running the node
, I am getting the following error-
[ERROR] [1621076826.279428345, 756.115000000]: Client [/rviz] wants topic /explore_node/visualization_markers to have datatype/md5sum [visualization_msgs/Marker/4048c9de2a16f4ae8e0538085ebf1b97], but our version has [visualization_msgs/MarkerArray/d155b9ce5188fbaf89745847fd5882d7]. Dropping connection.
What could be the possible reasons for the above mentioned error?
Asked by skpro19 on 2021-05-15 06:14:48 UTC
Comments
Probably the definition of visualization_msgs/MarkerArray has changed in the meantime in your workspace. Have you upgraded or changed ROS distro recently? The easiest way can be to clean up a workspace and build it again.
Asked by abrzozowski on 2021-05-15 12:03:56 UTC
I didn't upgrade or change my ROS distro. However, I had uninstalled and then re-installed ROS-melodic on my PC recently.
Having said that, I did run
catkin clean
inside my~/catkin_ws/
directory. I then re-built my entire catkin worksapce usingcatkin build
.I am still getting the same error.
Asked by skpro19 on 2021-05-16 04:57:07 UTC
Do you by any chance have a copy of visualization_msgs in your workspace? If you have delete it and use the one from your ros distro.
Asked by arjo129 on 2021-05-16 08:00:49 UTC
@arjo129 thanks. That solved the problem.
Asked by skpro19 on 2021-05-17 11:24:05 UTC