src/tools/benchmark_tool/benchmark_tool/time_estimator/time_estimator_topic.py
def output_topic_callback(self, msg):
        """
        Compute the time since the last message on the input topic and publish it.

        Callback function triggered by the reception of a message from the output topic.

        @param msg: The topic message
        @type  msg: The type can vary depending on the listened topic
        @return: None
        """
        with self.callback_lock:
            if self._time_received_input != 0:
                # Get actual time from ROS
                time_now = self.node.get_clock().now().nanoseconds

                # Compute the amount of time elapsed from receiving the last
                # message in the input topic
                measure = time_now - self._time_received_input

                # Transform from nanoseconds to milliseconds
                measure = measure / (1000 * 1000)

                publish_msg = Int64()
                publish_msg.data = int(measure)

                # Publish the measurement
                self._publisher.publish(publish_msg)

                self._time_received_input = 0

        Compute the time since the last message on the input topic and publish it.

        Callback function triggered by the reception of a message from the output topic.

        @param msg: The topic message
        @type  msg: The type can vary depending on the listened topic
        @return: None
        
Compute the time since the last message on the input topic and publish it.
Callback function triggered by the reception of a message from the output topic.
Compute the time since the last message on the input topic and publish it . Callback function triggered by the reception of a message from the output topic .
def output_topic_callback(self, msg):
        with self.callback_lock:
            if self._time_received_input != 0:
                time_now = self.node.get_clock().now().nanoseconds
                measure = time_now - self._time_received_input
                measure = measure / (1000 * 1000)
                publish_msg = Int64()
                publish_msg.data = int(measure)
                self._publisher.publish(publish_msg)
                self._time_received_input = 0
def output_topic_callback ( self , msg ) : with self . callback_lock : if self . _time_received_input != 0 : time_now = self . node . get_clock ( ) . now ( ) . nanoseconds measure = time_now - self . _time_received_input measure = measure / ( 1000 * 1000 ) publish_msg = Int64 ( ) publish_msg . data = int ( measure ) self . _publisher . publish ( publish_msg ) self . _time_received_input = 0
Compute the time since the last message on the input topic and publish it.
Compute the time since the last message on the input topic and publish it .
"""
        Compute the time since the last message on the input topic and publish it.

        Callback function triggered by the reception of a message from the output topic.

        @param msg: The topic message
        @type  msg: The type can vary depending on the listened topic
        @return: None
        """ # Get actual time from ROS # Compute the amount of time elapsed from receiving the last # message in the input topic # Transform from nanoseconds to milliseconds # Publish the measurement
None
self
msg
The topic message
The topic message