Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove a marker by a specific ID #162

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/rviz_visual_tools/rviz_visual_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ class RvizVisualTools
*/
void resetMarkerCounts();

/**
* \brief Remove a specific marker with the given id.
*/
void removeMarkerWithID(int id);

/**
* \brief Pre-load rviz markers for better efficiency
* \return converted pose * \return true on sucess
Expand Down
15 changes: 15 additions & 0 deletions src/rviz_visual_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,21 @@ bool RvizVisualTools::deleteAllMarkers()
return publishMarker(reset_marker_);
}

void RvizVisualTools::removeMarkerWithID(int id)
{
visualization_msgs::Marker empty_marker;
empty_marker.header.frame_id = base_frame_;
empty_marker.id = id;
empty_marker.header.stamp = ros::Time();
empty_marker.ns = "deleteAllMarkers";
empty_marker.action = 3;
empty_marker.pose.orientation.w = 1;

visualization_msgs::MarkerArray empty_marker_array;
empty_marker_array.markers.push_back(empty_marker);
pub_rviz_markers_.publish(empty_marker_array);
}

void RvizVisualTools::resetMarkerCounts()
{
arrow_marker_.id++;
Expand Down