Ask Your Question
0

roscpp clear topics node

asked 2020-04-23 09:24:22 -0500

wilson1994 gravatar image

Hi,

I'm using image_transport to publish images, and depending on the format, it will publish it to different topics.

So to give a simplified example:

  • if format == grayscale, then I want to publish my images on /image/grayscale
  • if format == color, then I want to publish my images on /image/color

That works, but if I want to change format on the fly (eg from grayscale to color), I want to "unadvertise" the topic /image/grayscale" so it doesnt show up in the rostopic list anymore.

Is this in any way possible? I tried first deleting my image_transport object and nodehandle object, then creating new objects and advertise the new topic, but the old topic remains in the list of available topics.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-04-24 01:52:05 -0500

wilson1994 gravatar image

I found an answer to my question:

you have to destroy (or call shutdown on) your image_transport::Publisher objects to unadvertise that specific topic.

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

Stats

Asked: 2020-04-23 09:24:22 -0500

Seen: 109 times

Last updated: Apr 23 '20