Parasol Planning Library (PPL)
GroupTask.h
Go to the documentation of this file.
1 #ifndef PMPL_GROUP_TASK_H_
2 #define PMPL_GROUP_TASK_H_
3 
4 #include "MPProblem/MPTask.h"
5 
6 #include "nonstd/status.h"
7 
12 
13 #include <map>
14 #include <memory>
15 #include <string>
16 #include <unordered_map>
17 #include <vector>
18 
19 class Boundary;
20 class Constraint;
21 class MPProblem;
22 class Robot;
23 class RobotGroup;
24 class XMLNode;
25 
26 
44 class GroupTask {
45 
46  public:
47 
50 
52  typedef std::vector<MPTask> TaskSet;
53 
56 
57  typedef TaskSet::iterator iterator;
58  typedef TaskSet::const_iterator const_iterator;
59 
63 
66  explicit GroupTask(RobotGroup* const _robotGroup);
67 
72  explicit GroupTask(MPProblem* const _problem, XMLNode& _node);
73 
74  virtual ~GroupTask();
75 
79  static std::unique_ptr<GroupTask> Factory(MPProblem* const _problem,
80  XMLNode& _node);
81 
85 
87  RobotGroup* GetRobotGroup() const noexcept;
88 
93  void SetRobotGroup(RobotGroup* const _r);
94 
96  const std::string& GetLabel() const noexcept;
97 
99  void SetLabel(const std::string& _label) noexcept;
100 
102  size_t Size() const noexcept;
103 
106  bool Empty() const noexcept;
107 
109  nonstd::status& GetStatus() noexcept;
110  const nonstd::status& GetStatus() const noexcept;
111 
116 
118  size_t GetNumGoals() const noexcept;
119 
122  void AddTask(const MPTask& _t);
123 
128 
129  iterator begin() noexcept;
130  iterator end() noexcept;
131 
133  const_iterator begin() const noexcept;
135  const_iterator end() const noexcept;
136 
140 
147  void GetStartConstraintCenter(GroupCfgType& _center) const noexcept;
148 
152 
157  bool EvaluateStartConstraints(const GroupCfgType& _cfg) const;
158 
163  bool EvaluatePathConstraints(const GroupCfgType& _cfg) const;
164 
169  bool EvaluateGoalConstraints(const GroupCfgType& _cfg) const;
170 
177  bool EvaluateGoalConstraints(const GroupCfgType& _cfg, const size_t _index) const;
178 
183 
185  RobotGroup* GetEndEffectorGroup() const noexcept;
186 
188  RobotGroup* GetManipulatorGroup() const noexcept;
189 
192 
195 
197 
198  private:
199 
202 
203  RobotGroup* m_group{nullptr};
204 
205  std::string m_label;
206  nonstd::status m_status;
207 
208  TaskSet m_individualTasks;
209 
214 
215  // Used in disassembly planning, this group should contain the assembly
216  // along with the manipulator's end effector. Duplicates a little bit of
217  // data, but allows us to most extensibly use group path/cfg output.
218  RobotGroup* m_endEffectorGroup{nullptr};
219 
220  // Used in disassembly planning, this group should contain the group along
221  // with the manipulator. Duplicates a little bit of data, but allows us to
222  // most extensibly use group path/cfg output.
223  RobotGroup* m_manipulatorGroup{nullptr};
224 
226 
227 };
228 
229 #endif
Definition: Boundary.h:30
Definition: Constraint.h:23
Definition: GenericStateGraph.h:67
Definition: GroupCfg.h:39
Definition: GroupTask.h:44
std::vector< MPTask > TaskSet
A set of individual tasks.
Definition: GroupTask.h:52
nonstd::status & GetStatus() noexcept
Get the status object for this task.
Definition: GroupTask.cpp:147
void SetRobotGroup(RobotGroup *const _r)
Definition: GroupTask.cpp:98
static std::unique_ptr< GroupTask > Factory(MPProblem *const _problem, XMLNode &_node)
Definition: GroupTask.cpp:72
void AddTask(const MPTask &_t)
Definition: GroupTask.cpp:173
void SetLabel(const std::string &_label) noexcept
Set the semantic label for this task.
Definition: GroupTask.cpp:119
RobotGroup * GetEndEffectorGroup() const noexcept
Get the optional manipulator robot group associated with this task.
Definition: GroupTask.cpp:216
const std::string & GetLabel() const noexcept
Get the semantic label for this task.
Definition: GroupTask.cpp:112
size_t GetNumGoals() const noexcept
Get the number of goals in the longest (most goals) task.
Definition: GroupTask.cpp:162
iterator begin() noexcept
Definition: GroupTask.cpp:187
RobotGroup * GetManipulatorGroup() const noexcept
Get the optional manipulator robot group associated with this task.
Definition: GroupTask.cpp:223
RobotGroup * GetRobotGroup() const noexcept
Get the robot associated with this task.
Definition: GroupTask.cpp:91
iterator end() noexcept
Definition: GroupTask.cpp:194
void GetStartConstraintCenter(GroupCfgType &_center) const noexcept
Definition: GroupTask.cpp:255
size_t Size() const noexcept
Get the number of individual tasks within this group task.
Definition: GroupTask.cpp:126
bool EvaluatePathConstraints(const GroupCfgType &_cfg) const
Definition: GroupTask.cpp:289
TaskSet::iterator iterator
Definition: GroupTask.h:57
bool Empty() const noexcept
Definition: GroupTask.cpp:133
Robot * GetManipulatorRobot()
Get the robot pointer for the (optional) manipulator for this group task.
Definition: GroupTask.cpp:229
GroupCfg< IndividualRoadmap > GroupCfgType
Definition: GroupTask.h:55
Robot * GetEndEffectorRobot()
Get the robot pointer for the (optional) end effector for the group task.
Definition: GroupTask.cpp:241
bool EvaluateStartConstraints(const GroupCfgType &_cfg) const
Definition: GroupTask.cpp:268
virtual ~GroupTask()
TaskSet::const_iterator const_iterator
Definition: GroupTask.h:58
GroupTask(RobotGroup *const _robotGroup)
Definition: GroupTask.cpp:18
bool EvaluateGoalConstraints(const GroupCfgType &_cfg) const
Definition: GroupTask.cpp:310
GenericStateGraph< Cfg, DefaultWeight< Cfg > > IndividualRoadmap
Definition: GroupTask.h:54
iterator RemoveTask(iterator _iter)
Definition: GroupTask.cpp:180
Definition: MPProblem.h:34
Definition: MPTask.h:46
A group of one or more robots.
Definition: RobotGroup.h:17
Definition: Robot.h:31
Definition: XMLNode.h:27