SOLA
Loading...
Searching...
No Matches
task_management.h
1// Copyright 2023 The SOLA authors
2//
3// This file is part of DAISI.
4//
5// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU
6// General Public License as published by the Free Software Foundation; version 2.
7//
8// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
9// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
10// Public License for more details.
11//
12// You should have received a copy of the GNU General Public License along with DAISI. If not, see
13// <https://www.gnu.org/licenses/>.
14//
15// SPDX-License-Identifier: GPL-2.0-only
16
17#ifndef DAISI_CPPS_LOGICAL_TASK_MANAGEMENT_TASK_MANAGEMENT_H_
18#define DAISI_CPPS_LOGICAL_TASK_MANAGEMENT_TASK_MANAGEMENT_H_
19
20#include <algorithm>
21#include <functional>
22#include <memory>
23#include <optional>
24#include <utility>
25
26#include "cpps/amr/amr_description.h"
27#include "cpps/amr/amr_topology.h"
28#include "material_flow/model/task.h"
29#include "metrics_composition.h"
30#include "task_management_helper.h"
31#include "utils/structure_helpers.h"
32
33namespace daisi::cpps::logical {
34
36public:
37 explicit TaskManagement(AmrDescription amr_description, Topology topology,
38 const daisi::util::Pose &pose)
39 : amr_description_(std::move(amr_description)),
40 topology_(std::move(topology)),
41 current_pose_(pose) {}
42
43 virtual ~TaskManagement() = default;
44
46 virtual bool hasTasks() const = 0;
47
50
52 virtual bool setNextTask() = 0;
53
55 virtual bool canAddTask(const daisi::material_flow::Task &task) = 0;
56
59 virtual bool addTask(const daisi::material_flow::Task &task) = 0;
60
61 void addNotifyTaskAssignmentCallback(std::function<void(void)> callback) {
62 task_assignment_callbacks_.push_back(std::move(callback));
63 }
64
65 void clearNotifyTaskAssignmentCallback() { task_assignment_callbacks_.clear(); }
66
67protected:
68 std::vector<std::function<void(void)>> task_assignment_callbacks_;
69
70 AmrDescription amr_description_;
71 Topology topology_;
72 daisi::util::Pose current_pose_;
73};
74
75} // namespace daisi::cpps::logical
76
77#endif
Definition amr_description.h:27
Definition amr_topology.h:26
Definition task_management.h:35
virtual daisi::material_flow::Task getCurrentTask() const =0
get the current task
virtual bool addTask(const daisi::material_flow::Task &task)=0
insert a task into the management's queue.
virtual bool canAddTask(const daisi::material_flow::Task &task)=0
check wether a new task can be added to the management's queue
virtual bool hasTasks() const =0
check wether the task management has a current task assigned
virtual bool setNextTask()=0
replace the current task with the first task stored in the management's queue
Definition task.h:34
Modified Round Robin Algorithm that centrally assigns tasks of incoming material flows to the corresp...
Definition algorithm_config.h:22
Definition structure_helpers.h:64