Revision history [back]

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

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:

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.ns =base_frame_;   // I think this is not important, so base_frame_ is set to be "dynamic_voronoi"
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" ?

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

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:

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.ns =base_frame_;   // I think this is not important, so base_frame_ is set to be "dynamic_voronoi"
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" ?

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

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()
{
printf("I am in publishvoronoilines() now \n");
boost::recursive_mutex::scoped_lock pvl(config_mutex_);
visualization_msgs::Marker line_list;
global_frame_;
ros::Time();
line_list.ns =base_frame_;   // I think this is not important, so base_frame_ is set to be "dynamic_voronoi"
=base_frame_;
line_list.pose.orientation.w = 1.0;
line_list.type = visualization_msgs::Marker::LINE_LIST;
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;
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" ?