コード例 #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)
コード例 #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'
コード例 #3
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'
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #7
0
ファイル: lcm_relay.py プロジェクト: sjriek/swarming_turtles
def udp_callback(channel, data):
    msg = CommunicationProtocol()
    msg.deserialize(data)
    pub.publish(msg)
コード例 #8
0
def udp_callback(channel, data):
    msg = CommunicationProtocol()
    msg.deserialize(data)
    pub.publish(msg)