ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Get topic rate from my node

asked 2016-03-07 05:51:55 -0600

Rikki gravatar image

updated 2016-03-07 05:52:45 -0600

Hi all! I have a node subscribed to a topic. In principle, the topic rate is constant but unknown from the node. Does exist a method to get the rate of this topic from my node program? Something similar to use "$rostopic hz" from console but from the code program.

Thanks in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-03-07 08:31:33 -0600

alee gravatar image

rostopic has an API as documented on the wiki page ( ). However, it does give a warning that "This library is for internal-use only as the code API may change, though it does provide examples of how to implement dynamic subscription and publication behaviors in ROS." so your mileage may vary.

edit flag offensive delete link more


Thank you very much, this is that I'm looking for (ROSTopicHz class). However, your reflexion is very interesting and maybe I should implement directly an initial callback to estimate the topic rate and after that replace it for the original, better than use this class directly. Thanks alee!

Rikki gravatar image Rikki  ( 2016-03-07 10:33:23 -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

1 follower


Asked: 2016-03-07 05:51:55 -0600

Seen: 2,250 times

Last updated: Mar 07 '16