Know whether a topic is publishing

asked 2020-03-21 09:08:17 -0500

mingcheng gravatar image

Hi, Is there a way to achieve that, when a topic is publishing, a variable shows 1, when the topic stops publishing, the same variable become 0. And turns back to 1 when the topic is publishing again. Thank you in advance for any help, mingcheng

edit retag flag offensive close merge delete


Pedantic, but: "topics" do not publish. Publishers publish messages.

Could you please clarify what you're actually trying to achieve?

gvdhoorn gravatar image gvdhoorn  ( 2020-03-21 09:28:12 -0500 )edit

There are lots of packages publishing warn messages for timed out messages from topics. If the message has a timestamp it should be easy to check if the momentary message is actually new or still the old/last one and flag.

And here is a link to a thread about the issue and a possible python solution to it link text hope this helps.

Dragonslayer gravatar image Dragonslayer  ( 2020-03-21 10:45:20 -0500 )edit

By the way, often watchdogs for the publishers are implemented to check if the publishers are still up and running. In most cases this should be a good indication on published messages as well, if we are talking about a working system´s "status".

Dragonslayer gravatar image Dragonslayer  ( 2020-03-21 10:49:58 -0500 )edit