Ask Your Question

Is it possible with ros statistics mechanism to detect a publisher is not publishing anything in given time

asked 2019-06-05 17:41:02 -0600

drHarri gravatar image


I am using statistics to observe messaging of certain nodes especially regarding the frequency of sending messgaes. What i am not able to detect yet, is a 'signal' indicating that messages are not sent any more.

Is the statics mechanism able to provide such info (no message on topic in given time) ?

Thanks in advance


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-06-05 21:02:15 -0600

Geoff gravatar image

You can somewhat achieve this by setting the window size for statistics gathering. Set the parameters listed on that page appropriately and enable statistics, and when the traffic volume falls to zero it means the window is empty because there was nothing published in the period that the window covers. You might need to set the window min and max sizes to the same value to make it reliable.

However, I do not think this is a good way to know if messages have stopped being published to a topic. A better way is to create a node that subscribes to the topic and just watches for messages not coming in a certain time, without doing anything with the data it might receive.

You also need to keep in mind that there is a difference between messages not being published on a topic, and a node not publishing messages. There may be multiple publishers on the topic, in which case even if one stops publishing it will be hard to detect through subscription-side statistics (which is how the topic statistics tools work). If you want to know if a node has stopped publishing, you will need to use a heartbeat signal.

  • The bond package is a good way to do this.
  • Another is to have all your topics publish regularly to a topic of type std_msgs/Empty called heartbeat or similar under their own namespace (to prevent them all publishing on the same topic) and listen to those signals.
  • The youbot_common packages include a heartbeat_generator node that does this using a boolean, but I think that Empty is more appropriate because you are solely interested in if the message is published, not what it contains.
  • The node_alive package provides not just the heartbeat signal but also a server to gather those signals and watch for dying nodes.
  • There is also the old node_monitoring package but it hasn't been maintained in nearly 8 years so you would need to do some work to get it going again.
edit flag offensive delete link more


Hi and thanks for you very fast answer.

I would rather not use an additional mechanism like a heartbeat if possible. From my point of view that would make the same thing as 'observing' an existing topic.

So what i tried is to do is to set the window parameters. Unfortunatelly that feels mor like guessing the correct values. I tried with setting window_min_size and the window_max_size to 0, 5, 100 no behaviour change at all.

Honestly i am not sure if i understood the configuration parameters correctly.

Do the 4 parameters (statistics_window_min_*) define how ros shall handle its window sizes?

E.g: statistics_window_max_elements=10 + statistics_window_max_elements=100 Does that mean ROS shall use a window for its statistics that includes at least 10 messages over all topics but 100 messages at most? << and min/max size according

Is there a detailed description available which i am just to blind to find?

drHarri gravatar image drHarri  ( 2019-06-06 02:06:08 -0600 )edit

Your Answer

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

Add Answer

Question Tools



Asked: 2019-06-05 17:41:02 -0600

Seen: 96 times

Last updated: Jun 05 '19