Esempio n. 1
0
def request(receiver, loc_name):
    msg = CommunicationProtocol()
    msg.sender = name
    msg.receiver = receiver
    msg.request = "request %s"%(loc_name)
    #msg.location = get_own_pose()

    comm_pub.publish(msg)
Esempio n. 2
0
    def execute(self, userdata):
        found = 'tb05'
        foreign_master_uri = make_master_uri(found)

        try:
            msg = CommunicationProtocol()
            msg.sender = self.id
            msg.receiver = found
            msg.request = 'hive'

            connect(self.topic, foreign_master_uri)
            rospy.sleep(0.2)
            self.publisher.publish(msg)
            disconnect(self.topic, foreign_master_uri)

        except:
            print "exception"
            disconnect(self.topic, foreign_master_uri)

        return 'done'
    def execute(self, userdata):
        found = 'tb05'
        foreign_master_uri = make_master_uri(found)

        try:
            msg = CommunicationProtocol()
            msg.sender = self.id
            msg.receiver = found
            msg.request = 'hive'

            connect(self.topic, foreign_master_uri)
            rospy.sleep(0.2)
            self.publisher.publish(msg)
            disconnect(self.topic, foreign_master_uri)

        except:
            print "exception"
            disconnect(self.topic, foreign_master_uri)

        return 'done'
Esempio n. 4
0
def answer(receiver, loc_name, pose):
    msg = CommunicationProtocol()
    msg.sender = name
    msg.receiver = receiver
    msg.request = "answer %s"%(loc_name)
    msg.location = pose
    #thread.start_new_thread(send,(receiver, msg))
    comm_pub.publish(msg)
Esempio n. 5
0
def answer(receiver, loc_name, pose):
    msg = CommunicationProtocol()
    msg.sender = name
    msg.receiver = receiver
    msg.request = "answer %s"%(loc_name)
    msg.location = pose
    msg.location.header.stamp = rospy.Time.now()
    comm_pub.publish(msg)
Esempio n. 6
0
def request(receiver, loc_name):
    msg = CommunicationProtocol()
    msg.sender = name
    msg.receiver = receiver
    msg.request = "request %s"%(loc_name)
    msg.location = turtles[receiver]
    #thread.start_new_thread(send,(receiver, msg))
    #send(receiver, msg)
    comm_pub.publish(msg)
Esempio n. 7
0
def udp_callback(channel, data):
    msg = CommunicationProtocol()
    msg.deserialize(data)
    pub.publish(msg)
Esempio n. 8
0
def udp_callback(channel, data):
    msg = CommunicationProtocol()
    msg.deserialize(data)
    pub.publish(msg)