ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Get topic rate from my node

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

Rikki gravatar image

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

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
1

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

alee gravatar image

rostopic has an API as documented on the wiki page ( http://wiki.ros.org/rostopic ). 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

Comments

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 -0500 )edit

Question Tools

1 follower

Stats

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

Seen: 2,615 times

Last updated: Mar 07 '16