def setCommand(self,command): self.ros_msg_command.command = self.convertCommand(command['command']) if (command.has_key("order")): self.ros_msg_command.order.order_id = command['order']['order_id'] legos = command['order']['bricks'] self.ros_msg_command.order.bricks = [] for i in range(len(legos)): self.ros_msg_command.order.bricks.append(lego_brick()) self.ros_msg_command.order.bricks[i].color = self.convertColor(legos[i]['color']) self.ros_msg_command.order.bricks[i].size = legos[i]['size'] self.ros_msg_command.order.bricks[i].count = legos[i]['count'] else: self.ros_msg_command.order.order_id = 0 self.ros_msg_command.order.bricks = [] return
def fillDummyData(self): self.ros_msg_command.command = self.ros_msg_command.COMMAND_SORTBRICKS self.ros_msg_command.order.order_id = 1 self.ros_msg_command.order.bricks.append(lego_brick(color=lego_brick.COLOR_RED, size=4, count=2)) self.ros_msg_command.order.bricks.append(lego_brick(color=lego_brick.COLOR_BLUE, size=6, count=5))