@@ -39,6 +39,73 @@ class TaskPlanner
3939{
4040public:
4141
42+ // / The TaskAssignmentStrategy class contains the various profiles and
43+ // / their associated weights for cost calculation.
44+ class TaskAssignmentStrategy
45+ {
46+ public:
47+
48+ // / Predefined profiles that initialize the strategy with
49+ // / pre-defined weights and options.
50+ enum class Profile : uint32_t
51+ {
52+ // / Standard RMF assignment strategy with fastest-first approach
53+ DefaultFastest = 0 ,
54+
55+ // / Prioritize battery level, strongly penalize low SOC with a quadratic term.
56+ // / Still account for task efficiency (fastest-first), but ignore busyness.
57+ BatteryAware,
58+
59+ // / To be overwritten from fleet_config.yaml
60+ Unset
61+ };
62+
63+ // / Options for computing the busyness penalty.
64+ enum class BusyMode : uint8_t
65+ {
66+ // / Mode where busyness penalty is 0 if idle, else 1
67+ Binary = 0 ,
68+
69+ // / Mode where busyness penalty is based on task count
70+ Count
71+ };
72+
73+ // / Constructor
74+ TaskAssignmentStrategy ();
75+
76+ // / Make a strategy initialized from a predefined profile
77+ static TaskAssignmentStrategy make (Profile profile);
78+
79+ // / Set the finish-time polynomial weights
80+ TaskAssignmentStrategy& finish_time_weights (std::vector<double > values);
81+
82+ // / Get the finish-time polynomial weights
83+ const std::vector<double >& finish_time_weights () const ;
84+
85+ // / Set the battery penalty polynomial weights
86+ TaskAssignmentStrategy& battery_penalty_weights (std::vector<double > values);
87+
88+ // / Get the battery penalty polynomial weights
89+ const std::vector<double >& battery_penalty_weights () const ;
90+
91+ // / Set the busy penalty polynomial weights
92+ TaskAssignmentStrategy& busy_penalty_weights (std::vector<double > values);
93+
94+ // / Get the busy penalty polynomial weights
95+ const std::vector<double >& busy_penalty_weights () const ;
96+
97+ // / Set the busyness penalty mode
98+ TaskAssignmentStrategy& busy_mode (BusyMode mode);
99+
100+ // / Get the busyness penalty mode
101+ BusyMode busy_mode () const ;
102+
103+ class Implementation ;
104+
105+ private:
106+ rmf_utils::impl_ptr<Implementation> _pimpl;
107+ };
108+
42109 // / The Configuration class contains planning parameters that are immutable
43110 // / for each TaskPlanner instance and should not change in between plans.
44111 class Configuration
@@ -128,6 +195,14 @@ class TaskPlanner
128195 // / Get the request factory that will generate a finishing task
129196 ConstRequestFactoryPtr finishing_request () const ;
130197
198+ // / Set the task assignment strategy (profile & custom weights)
199+ // / used by the planner
200+ Options& task_assignment_strategy (TaskAssignmentStrategy strategy);
201+
202+ // / Get the task assignment strategy (profile & custom weights)
203+ // / used by the planner
204+ const TaskAssignmentStrategy& task_assignment_strategy () const ;
205+
131206 class Implementation ;
132207 private:
133208 rmf_utils::impl_ptr<Implementation> _pimpl;
0 commit comments