Ask Your Question

clearing all markers / view in RVIZ remotely

asked 2013-01-28 22:53:00 -0500

Markus Achtelik gravatar image


I'm drawing a lot of markers in rviz to visualize the outcome of an algorithm. As I'm often interrupting/killing it, it's infeasible to keep track of what has been drawn in order to delete it later. Is there any possibility to send something like "wipe" or "clear" to rviz to clear all markers? Currently, I'm sending a message with many markers with action=DELETE but that seems a bit brute force. Is there any better option?

Thanks a lot!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-01-29 04:25:29 -0500

joq gravatar image

If you are setting markers fairly frequently, perhaps you could set an appropriate lifetime in the Marker message.

Then, rviz would erase them after you kill your node.

edit flag offensive delete link more


Thanks, that could be a workaround. I Just have to think about something when I get a coffee and the algorithm finished in the meantime... ;) It seems there is no other solution (yet)?

Markus Achtelik gravatar image Markus Achtelik  ( 2013-01-30 04:26:40 -0500 )edit

The usual solution is to re-use the marker.ns and values of the obsolete markers, which automatically deletes them as a side-effect.

joq gravatar image joq  ( 2013-01-30 04:31:40 -0500 )edit

answered 2021-04-06 23:19:16 -0500

I recommend to use DELETE_ALL, is simpler and no brute force is required. Here is a snippet:

from visualization_msgs.msg import Marker, MarkerArray
marker_array_msg = MarkerArray()
marker = Marker() = 0
marker.ns = self.marker_ns
marker.action = Marker.DELETEALL
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-01-28 22:53:00 -0500

Seen: 6,039 times

Last updated: Apr 06