Пример #1
0
 def to_attrs(cls, dict_repr):
     attrs = super().to_attrs(dict_repr)
     tasks = list()
     for task_id, task_dict in attrs.get("tasks").items():
         tasks.append(
             Task.from_payload(task_dict,
                               constraints=TaskConstraints,
                               request=TransportationRequest))
     attrs.update(tasks=tasks)
     return attrs
Пример #2
0
    def receive_msg_cb(self, msg_content):
        msg = self.convert_zyre_msg_to_dict(msg_content)
        if msg is None:
            return
        msg_type = msg['header']['type']
        payload = msg['payload']

        if msg_type == 'TASK':
            task = Task.from_payload(payload)
            if self.robot_id in task.assigned_robots:
                self.logger.debug("Received task %s", task.task_id)
                self.task = task
Пример #3
0
 def task_cb(self, msg):
     payload = msg['payload']
     task = Task.from_payload(payload)
     if self.robot_id in task.assigned_robots:
         self.logger.debug("Received task %s", task.task_id)
         task.update_status(TaskStatusConst.DISPATCHED)