Exemple #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)
Exemple #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'
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #7
0
def udp_callback(channel, data):
    msg = CommunicationProtocol()
    msg.deserialize(data)
    pub.publish(msg)
Exemple #8
0
def udp_callback(channel, data):
    msg = CommunicationProtocol()
    msg.deserialize(data)
    pub.publish(msg)