How to publish voronoi line as visualization_msgs::Marker topic in Rviz [closed]
Hi, all. I want to add a ros wrapper for this dynamic_voroni package. I have successfully saved(using iostream) the voronoi lines superposing on maps in a ros node. One of example is
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:
EDIT: The code and the map is updated.
void Dynamicvoronoi_ros::publishvoronoilines()
{
visualization_msgs::Marker line_list;
line_list.header.frame_id = global_frame_;
line_list.header.stamp = ros::Time();
line_list.ns =base_frame_;
line_list.action = visualization_msgs::Marker::ADD;
line_list.pose.orientation.w = 1.0;
line_list.type = visualization_msgs::Marker::SPHERE_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;
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);
}
}
}
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" ?