def setCommand(self,command):
        self.logDataToTopic(1,2,"New command received")
	gnrl=general()
 	gnrl.general=self.convertCommand(command['command'])
        self.mes_outgoing_publisher.publish(gnrl)
        self.logDataToTopic(1,3,"New command published to topic")
        rospy.loginfo("command "+str(self.convertCommand(command['command'])))
        self.ros_msg_command.command = self.convertCommand(command['command'])
        
        if (command.has_key("order")):
            self.logDataToTopic(1,4,"New order received")
            self.msg_command.order.order_id = command['order']['order_id']
            self.msg=command['order'] # added
            self.mes_order_publisher.publish(self.msg)
            self.logDataToTopic(1,5,"New order published to Topic")
            legos = command['order']['bricks']
            self.msg_command.order.bricks = []
            for i in range(len(legos)):
                self.msg_command.order.bricks.append(lego_brick())
                self.msg_command.order.bricks[i].color = legos[i]['color']
                self.msg_command.order.bricks[i].size = legos[i]['size']
                self.msg_command.order.bricks[i].count = legos[i]['count']
           
        else:
            self.logDataToTopic(1,6,"No order received initaialize default")
            self.ros_msg_command.order.order_id = 0
            self.ros_msg_command.order.bricks = []
        return
    def setCommand(self, command):
        self.logDataToTopic(1, 2, "New command received")
        gnrl = general()
        gnrl.general = self.convertCommand(command['command'])
        self.mes_outgoing_publisher.publish(gnrl)
        self.logDataToTopic(1, 3, "New command published to topic")
        rospy.loginfo("command " +
                      str(self.convertCommand(command['command'])))
        self.ros_msg_command.command = self.convertCommand(command['command'])

        if (command.has_key("order")):
            self.logDataToTopic(1, 4, "New order received")
            self.msg_command.order.order_id = command['order']['order_id']
            self.msg = command['order']  # added
            self.mes_order_publisher.publish(self.msg)
            self.logDataToTopic(1, 5, "New order published to Topic")
            legos = command['order']['bricks']
            self.msg_command.order.bricks = []
            for i in range(len(legos)):
                self.msg_command.order.bricks.append(lego_brick())
                self.msg_command.order.bricks[i].color = legos[i]['color']
                self.msg_command.order.bricks[i].size = legos[i]['size']
                self.msg_command.order.bricks[i].count = legos[i]['count']

        else:
            self.logDataToTopic(1, 6, "No order received initaialize default")
            self.ros_msg_command.order.order_id = 0
            self.ros_msg_command.order.bricks = []
        return
Пример #3
0
def out_of_bricks():
    message = general()
    message.general = 2  # time
    pub_time.publish(message)
Пример #4
0
def out_of_bricks():
    message = general()
    message.general = 2			# time
    pub_time.publish(message)