parameters: (topic, window_size=-1)
docstring: Periodically print the publishing delay of a topic to console until
      shutdown
      :param topic: topic name, ``str``
      :param window_size: number of messages to average over, -1 for infinite, ``int``
docstring_summary: Periodically print the publishing delay of a topic to console until
      shutdown
      :param topic: topic name, ``str``
      :param window_size: number of messages to average over, -1 for infinite, ``int``
docstring_tokens: Periodically print the publishing delay of a topic to console until shutdown : param topic : topic name str : param window_size : number of messages to average over - 1 for infinite int
function: def _rostopic_delay(topic, window_size=-1):
      """
      Periodically print the publishing delay of a topic to console until
      shutdown
      :param topic: topic name, ``str``
      :param window_size: number of messages to average over, -1 for infinite, ``int``
      """
      # pause hz until topic is published
      msg_class, real_topic, _ = get_topic_class(topic, blocking=True)
      if issubclass(msg_class, google.protobuf.message.Message):
          print("Protobuf message has no header, not support sub-command 'delay'")
          return
      if rospy.is_shutdown():
          return
      rospy.init_node(NAME, anonymous=True)
      rt = ROSTopicDelay(window_size)
      sub = rospy.Subscriber(real_topic, msg_class, rt.callback_delay)
      print("subscribed to [%s]" % real_topic)
  
      if rospy.get_param('use_sim_time', False):
          print("WARNING: may be using simulated time",file=sys.stderr)
  
      while not rospy.is_shutdown():
          _sleep(1.0)
          rt.print_delay()
function_tokens: def _rostopic_delay ( topic , window_size = - 1 ) : # pause hz until topic is published msg_class , real_topic , _ = get_topic_class ( topic , blocking = True ) if issubclass ( msg_class , google . protobuf . message . Message ) : print ( "Protobuf message has no header, not support sub-command 'delay'" ) return if rospy . is_shutdown ( ) : return rospy . init_node ( NAME , anonymous = True ) rt = ROSTopicDelay ( window_size ) sub = rospy . Subscriber ( real_topic , msg_class , rt . callback_delay ) print ( "subscribed to [%s]" % real_topic ) if rospy . get_param ( 'use_sim_time' , False ) : print ( "WARNING: may be using simulated time" , file = sys . stderr ) while not rospy . is_shutdown ( ) : _sleep ( 1.0 ) rt . print_delay ( )