Delete all rviz markers
Hi,
On the tutorial (http://wiki.ros.org/rviz/Tutorials/Markers%3A%20Basic%20Shapes) and docs for the visualisation markers, there's supposed to be an option for action "DELETEALL" which would remove all markers. I've tried this and it has not deleted any markers. Is this function actually in effect? Is there anything else I need to specify apart from marker.action?
Thanks, Jess
Asked by jess on 2015-03-18 16:04:19 UTC
Answers
I ended up using rviz_visual_tools::RvizVisualTools and calling deleteAllMarkers() - did the trick for me.
Asked by jess on 2015-03-18 22:25:24 UTC
Comments
I m using ROS Noetic in Ubuntu 20.04. Please see following code which creates 2 lines in each message and publishes over ROS network. When one message is received the previous message's lines are deleted. Includes are
int main( int argc, char** argv )
{
ros::init(argc, argv, "points_and_lines");
ros::NodeHandle n;
ros::Publisher marker_pub = n.advertise<visualization_msgs::Marker>("visualization_marker", 10);
ros::Rate r(1);
int count = 0;
visualization_msgs::Marker markerD;
// Set the frame ID and timestamp. See the TF tutorials for information on these.
markerD.header.frame_id = "map";
markerD.action = visualization_msgs::Marker::DELETEALL;
geometry_msgs::Point p;
while (ros::ok())
{
visualization_msgs::Marker line_list;
line_list.header.frame_id = "map";
line_list.ns = "points_and_lines";
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.1;
line_list.header.stamp = ros::Time::now();
// Line list is red
line_list.color.r = 1.0;
line_list.color.a = 1.0;
marker_pub.publish(markerD);
line_list.id = count;
//Create end points of 1st line
p.x = count;
p.y = 0;
p.z = 0;
line_list.points.push_back(p);
p.z += 1.0;
line_list.points.push_back(p);
//Create end points of 2nd line
p.x = count;
p.y = 2;
p.z = 2;
line_list.points.push_back(p);
p.z += 1.0;
line_list.points.push_back(p);
count++;
marker_pub.publish(line_list);
r.sleep();
}
}
Asked by SurajJadhav on 2021-03-26 00:38:03 UTC
Comments
According to http://wiki.ros.org/rviz/Tutorials/Markers%3A%20Basic%20Shapes#CA-512e76650e0ce24c239dfa0d48df1fa159210d66_58 that was added in Indigo. Are you using Indigo?
Asked by William on 2015-03-18 16:27:43 UTC
Yes, definitely on indigo
Asked by jess on 2015-03-18 17:25:06 UTC
I think I have an idea of what the problem might be, can you open a ticket on rviz: https://github.com/ros-visualization/rviz.git
Asked by William on 2015-03-18 19:24:58 UTC
Just did. Thanks for looking into this.
Asked by jess on 2015-03-18 19:59:45 UTC
Does this work now? Can someone give a brief code example?
Asked by atp on 2015-10-19 11:03:12 UTC