1 #ifndef PPL_GROUP_LOCAL_PLAN_H_
2 #define PPL_GROUP_LOCAL_PLAN_H_
11 #include "containers/sequential/graph/graph_util.h"
17 template <
typename GraphType>
class GroupCfg;
23 template <
typename GraphType>
33 typedef typename GraphType::CfgType
CfgType;
41 typedef stapl::edge_descriptor_impl<size_t>
ED;
59 const std::string& _lpLabel =
"",
68 const std::string& _lpLabel =
"",
90 void Clear() noexcept;
102 const std::
string&
GetLPLabel() const noexcept;
106 void SetLPLabel(const std::
string _label) noexcept;
123 std::
string m_lpLabel;
127 std::vector<
size_t> m_formation;
138 template <typename GraphType>
143 m_lpLabel(_lpLabel) {}
145 template <
typename GraphType>
150 m_lpLabel(_lpLabel) {}
154 template <
typename GraphType>
161 <<
"same robot group.";
166 for(
size_t i = 0; i < this->GetNumRobots(); ++i)
170 template <
typename GraphType>
174 m_formation = _indices;
178 template <
typename GraphType>
186 template <
typename GraphType>
193 m_cfgIntermediates.clear();
198 template <
typename GraphType>
202 return m_cfgIntermediates;
206 template <
typename GraphType>
210 return m_cfgIntermediates;
214 template <
typename GraphType>
218 m_cfgIntermediates = _cfgs;
222 template <
typename GraphType>
230 template <
typename GraphType>
233 SetLPLabel(
const std::string _label) noexcept {
239 template <
typename GraphType>
243 if(!this->m_groupMap)
253 template<
typename GraphType>
268 std::vector< std::vector<CfgType> > edgeIntermediates;
270 size_t numIntermediates = 0;
271 const std::vector<size_t>& formation = _groupLP.
GetFormation();
272 for(
size_t i = 0; i < numRobots; ++i) {
274 if(std::find(formation.begin(), formation.end(), i) ==
278 edgeIntermediates.push_back({_groupLP.GetRobotStartCfg(i)});
281 edgeIntermediates.push_back(_groupLP.
GetEdge(i)->GetIntermediates());
282 numIntermediates = edgeIntermediates.back().size();
286 if(numIntermediates == 0)
290 for(std::vector<CfgType>& intermediateVec : edgeIntermediates)
291 if(intermediateVec.size() == 1)
292 intermediateVec.resize(numIntermediates, intermediateVec[0]);
298 for(
size_t i = 0; i < numIntermediates; ++i) {
299 for(
size_t robot = 0; i < numRobots; ++i) {
300 _os << edgeIntermediates[robot][i] <<
" ";
std::ostream & operator<<(std::ostream &_os, const GroupLocalPlan< GraphType > &_groupLP)
Definition: GroupLocalPlan.h:255
#define WHERE
Macro for retrieving info about file, function, and line number.
Definition: RuntimeUtils.h:32
Definition: CompositeEdge.h:23
virtual size_t GetNumRobots() const noexcept
Get the number of robots given in this group local plan.
Definition: CompositeEdge.h:525
GraphType::EdgeType IndividualEdge
Definition: CompositeEdge.h:31
std::vector< CompositeStateType > CompositePath
Definition: CompositeEdge.h:38
double m_weight
The edge weight.
Definition: CompositeEdge.h:215
virtual double Weight() const noexcept
Get the weight of the plan.
Definition: CompositeEdge.h:583
virtual IndividualEdge * GetEdge(Robot *const _robot)
Definition: CompositeEdge.h:470
Definition: CompositeGraph.h:27
virtual RobotGroup * GetGroup()
Get the robot group.
Definition: CompositeGraph.h:190
Definition: GroupCfg.h:39
Definition: GroupLocalPlan.h:24
std::vector< size_t > Formation
Definition: GroupLocalPlan.h:47
GroupCfgPath & GetIntermediates() noexcept
Get the group configuration intermediates.
Definition: GroupLocalPlan.h:201
GroupCfg< GraphType > GroupCfgType
Definition: GroupLocalPlan.h:37
stapl::edge_descriptor_impl< size_t > ED
Definition: GroupLocalPlan.h:41
GroupLocalPlan(GroupRoadmapType *const &_g=nullptr, const std::string &_lpLabel="", const double _w=0.0, const GroupCfgPath &_path=GroupCfgPath())
Definition: GroupLocalPlan.h:140
BaseType::CompositePath CompositePath
Definition: GroupLocalPlan.h:40
double EdgeWeight
Definition: GroupLocalPlan.h:35
GroupRoadmap< GroupCfgType, GroupLocalPlan > GroupRoadmapType
Definition: GroupLocalPlan.h:38
void SetLPLabel(const std::string _label) noexcept
Definition: GroupLocalPlan.h:233
const Formation & GetFormation() const noexcept
Definition: GroupLocalPlan.h:181
CompositeEdge< GraphType > BaseType
Definition: GroupLocalPlan.h:31
void SetFormation(const Formation &_indices)
Definition: GroupLocalPlan.h:173
virtual ~GroupLocalPlan()=default
void SetGroupRoadmap(GroupRoadmapType *const &_g)
Definition: GroupLocalPlan.h:157
std::vector< GroupCfgType > GroupCfgPath
Definition: GroupLocalPlan.h:39
BaseType::GroupGraphType GroupGraphType
Definition: GroupLocalPlan.h:32
GraphType::EdgeType IndividualEdge
Definition: GroupLocalPlan.h:34
virtual GroupLocalPlan operator+(const GroupLocalPlan &_other) const
Definition: GroupLocalPlan.h:242
GraphType::CfgType CfgType
Definition: GroupLocalPlan.h:33
const std::string & GetLPLabel() const noexcept
Get the string label of this current local plan.
Definition: GroupLocalPlan.h:225
void SetIntermediates(const GroupCfgPath &_cfgs)
Set the group configuration intermediates.
Definition: GroupLocalPlan.h:217
void Clear() noexcept
Reset the states of this object.
Definition: GroupLocalPlan.h:189
Definition: GroupRoadmap.h:25
A group of one or more robots.
Definition: RobotGroup.h:17
Definition: PMPLExceptions.h:62