Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 1404

How to publish voronoi line as visualization_msgs::Marker topic in Rviz

$
0
0
Hi, all. I want to add a ros wrapper for this [dynamic_voroni](http://www2.informatik.uni-freiburg.de/~lau/dynamicvoronoi/) package. I have successfully saved(using iostream) the voronoi lines superposing on maps in a ros node. One of example is ![here](/upfiles/14157158904502647.jpg) which is same to the results of Lau's codes. However, when I try to publish this voronoi lines as visualization_msgs::Marker in Rviz, althougth messages can be displayed by "rostopic echo" command, nothing is displayed in Rviz. The publish function is showed as follows: void Dynamicvoronoi_ros::publishvoronoilines() { printf("I am in publishvoronoilines() now \n"); boost::recursive_mutex::scoped_lock pvl(config_mutex_); visualization_msgs::Marker line_list; line_list.header.frame_id = global_frame_; // global_frame_="map" line_list.header.stamp = ros::Time::now(); line_list.ns =base_frame_; // I think this is not important, so base_frame_ is set to be "dynamic_voronoi" line_list.action = visualization_msgs::Marker::ADD; line_list.pose.orientation.w = 1.0; line_list.type = visualization_msgs::Marker::LINE_LIST; line_list.scale.x = 0.015; line_list.color.g = 1.0; line_list.color.a = 1.0; line_list.id = 0; geometry_msgs::Point p; int pointcount=0; for(int y=ptr_dvoronoi_->getSizeY()-1; y>=0; y--) for(int x=0; x<(int)ptr_dvoronoi_->getSizeX(); x++) { if(ptr_dvoronoi_->isVoronoi(x,y)) { p.x=x; p.y=y; line_list.points.push_back(p); line_list.points.push_back(p); // Duplicate points. If the number of point is an odd number, an error is displayed in Rviz. I don't know why. pointcount++; } } // printf("voronoi line has %d points\n", pointcount); voronoi_line_pub_.publish(line_list); } I think this is because of the lack of tf transformation. But I don't know where to add the transformation between map and voronoi lines. Is it enough that the frame_id of header in visualization_msgs::Marker is set to be "map" ?

Viewing all articles
Browse latest Browse all 1404

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>