Exemplo n.º 1
0
    def parse_acoustic_im(self, tokens):
        """
        This method parses an incoming instant message and publish its content on a dedicated topic
        :param tokens: list of message fields
        """
        msg = AcousticModemPayload()
        msg.header.stamp = rospy.Time.now()

        msg.address = int(tokens[2])
        msg.duration = int(tokens[5])
        msg.rssi = float(tokens[6])
        msg.integrity = float(tokens[7])
        msg.relative_velocity = float(tokens[8])
        msg.payload = ','.join(tokens[9:])

        rospy.loginfo('%s: Received IM from node %s, payload: %s, info: %s' %(self.name, msg.address, repr(msg.payload), repr(msg.info)))
        self.received_cnt += 1
        self.pub_im_in.publish(msg)
Exemplo n.º 2
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.header.stamp = rospy.Time.now()

        msg.address = int(tokens[2])
        msg.bitrate = int(tokens[4])
        msg.rssi = float(tokens[5])
        msg.integrity = float(tokens[6])
        msg.propagation_time = int(tokens[7])
        self.propagation_time = int(tokens[7])
        # print 'Distance', self.propagation_time * 1500 * 10**-6
        msg.relative_velocity = float(tokens[8])

        msg.payload = ','.join(tokens[9:])

        rospy.loginfo('%s: Received burst message from node %s, payload: %s, info: %s' % (self.name, msg.address, repr(msg.payload), repr(msg.info)))
        self.received_cnt += 1
        self.pub_burst_in.publish(msg)