Example #1
0
    def parse_acoustic_bm(self, tokens):
        """
        This method parse an incoming burst message and publish its content on a dedicated topic
        :param tokens: list of message fields
        """
        msg = AcousticModemPayload()
        msg.address = int(tokens[2])
        msg.payload = ','.join(tokens[9:])

        duration = int(tokens[7])  # in microseconds
        rel_speed = float(tokens[8])  # in meters per second
        info = {'duration': duration, 'relative_speed': rel_speed}
        msg.info = [KeyValue(key, value) for key, value in info.items()]

        rospy.loginfo(
            '%s: Received IM from node %s, payload: %s, info: %s' %
            (self.name, msg.address, repr(msg.payload), repr(msg.info)))
        self.pub_burst_in.publish(msg)
    def parse_acoustic_bm(self, tokens):
        """
        This method parse an incoming burst message and publish its content on a dedicated topic
        :param tokens: list of message fields
        """
        msg = AcousticModemPayload()
        msg.address = int(tokens[2])
        msg.payload = ','.join(tokens[9:])

        duration = int(tokens[7])  # in microseconds
        rel_speed = float(tokens[8])  # in meters per second
        info = {
            'duration': duration,
            'relative_speed': rel_speed
        }
        msg.info = [KeyValue(key, value) for key, value in info.items()]

        rospy.loginfo('%s: Received IM from node %s, payload: %s, info: %s' %(self.name, msg.address, repr(msg.payload), repr(msg.info)))
        self.pub_burst_in.publish(msg)