how to use more than one marker types
I want to visualize 3 seperate markers to be visualized in rviz until same line group donot appear again. I found that by doing line_list.points.clear() and line_list.colors.clear() i can make given line visualize until another line donot appears so that at one time only one marker of that name exist. But i want to display more than one marker and line like that so that whenever the same name of marker arrives the previous marker is vanished. I tried below program but donot works:
void
cloud_cb (const sensor_msgs::PointCloud2ConstPtr& input)
{
pcl::PointCloud<pcl::PointXYZRGB> output;
pcl::fromROSMsg(*input,output);
visualization_msgs::Marker marker, line_list, text_view_facing;
marker.header.frame_id = line_list.header.frame_id = text_view_facing.header.frame_id = "/camera_link";
marker.header.stamp = line_list.header.stamp = text_view_facing.header.stamp =ros::Time();
marker.ns = line_list.ns = text_view_facing.ns ="lines";
marker.action = line_list.action = text_view_facing.action = visualization_msgs::Marker::ADD;
marker.pose.orientation.w = line_list.pose.orientation.w = text_view_facing.pose.orientation.w = 1;
marker.id = 0;
line_list.id = 1;
text_view_facing.id = 2;
marker.type = visualization_msgs::Marker::POINTS;
line_list.type = visualization_msgs::Marker::LINE_LIST;
text_view_facing.type = visualization_msgs::Marker::TEXT_VIEW_FACING;
text_view_facing.color.b = 1; text_view_facing.color.a = 1.0; text_view_facing.color.g = 1.0; text_view_facing.color.r = 1.0;
line_list.color.r = 0; line_list.color.g = 0; line_list.color. b = 1; line_list.color.a = 1;
text_view_facing.scale.z = 0.015; line_list.scale.x = 0.001;
marker.header.stamp = ros::Time::now();
marker.lifetime = ros::Duration(0.01);
marker.scale.x = 0.002;
marker.scale.y = 0.002;
marker.scale.z = 0.002;
marker.color.a = 1.0;
marker.color.r = 0.0;
marker.color.g = 1.0;
marker.color.b = 0.0;
string obj1 = "first_segmented_image";
vector<line_list> line;
line.resize(2);
bigarray size_arr, arr0;
for(int p0=0;p0<bound.size() && ros::ok();p0++) {
p[0] = output.at(bound[p0].x,bound[p0].y);
if(!isnan(p[0].x) && !isnan(p[0].y) && !isnan(p[0].z)) {
P.x = p[0].x; P.y = p[0].y; P.z = p[0].z;
pc.r = 1; pc.g = 1; pc.b = 1; pc.a = 1;
marker.points.clear(); marker.colors.clear();
marker.points.push_back(P);
marker.colors.push_back(pc);
marker_pub.publish(marker);
}
for(int p1=0;p1<bound.size() && ros::ok();p1++) {
p[1] = output.at(bound[p1].x,bound[p1].y);
/*if(!isnan(p[0].x) && !isnan(p[0].y) && !isnan(p[0].z)) {
P.x = p[0].x; P.y = p[0].y; P.z = p[0].z;
pc.r = 1; pc.g = 1; pc.b = 1; pc.a = 1; marker.points.clear(); marker.colors.clear();
marker.points.push_back(P);
marker.colors.push_back(pc);
marker_pub.publish(marker);
}*/
if(!isnan(p[1].x) && !isnan(p[1].y) && !isnan(p[1].z)) {
line[0].points.clear(); line[0].colors.clear();
line[0].scale.x = 0.00075; line[0].colors.push_back(pc);
P.x = p[0].x; P.y = p[0].y; P.z = p[0].z; line[0].points.push_back(P);
P.x = p[1].x; P.y = p ...