ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Extending on Geoff's answer:
bw
is implemented slightly different to hz
Information on how these classes work can be found at rostopic.ROSTopicHz-class and rostopic.ROSTopicBandwidth-class
Extended Example:
import rospy, rostopic
TOPIC = '/robot_pose'
rospy.init_node('chosen_node_name')
h = rostopic.ROSTopicHz(-1)
s1 = rospy.Subscriber(TOPIC, rospy.AnyMsg, h.callback_hz, callback_args=TOPIC)
rospy.sleep(1)
h.print_hz([TOPIC])
b = rostopic.ROSTopicBandwidth()
s2 = rospy.Subscriber(TOPIC, rospy.AnyMsg, b.callback)
rospy.sleep(1)
b.print_bw()