segment_expander.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017, <copyright holder> <email>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of the <organization> nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY <copyright holder> <email> ''AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL <copyright holder> <email> BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
29 #ifndef SEGMENT_EXPANDER_H
30 #define SEGMENT_EXPANDER_H
31 
32 #define POT_HIGH 1.0e10
39 #include <algorithm>
40 #include <memory>
41 #include <queue>
42 
43 namespace multi_robot_router
44 {
46 {
47  public:
49  {
50  none,
52  avoidance
53  };
68  bool calculatePotentials(const RouteCoordinatorWrapper *_p, Vertex &_start, Vertex &_end, const uint32_t _maxIterations, const uint32_t _radius);
72  const std::vector<uint32_t> &getRobotCollisions() const;
76  void reset();
80  void setSpeed(const float &_speed);
89 
90  private:
91  template <class T, class S, class C>
92  void clearpq(std::priority_queue<T, S, C> &q)
93  {
94  q = std::priority_queue<T, S, C>();
95  }
96 
98  {
99  bool operator()(const Vertex *_a, const Vertex *_b) const
100  {
101  return _a->weight > _b->weight;
102  }
103  };
104 
105  //assigns the potential to all necessary vertices
106  Vertex *expandVoronoi(Vertex &_start, Vertex &_end, const uint32_t _cycles);
107  //assigns the next Vertex with the given potential
108  void addExpansoionCandidate(Vertex &_current, Vertex &_next, Vertex &_end);
109  //adds teh first expenstion candidate
110  void addStartExpansionCandidate(Vertex &_start, Vertex &_current, Vertex &_next, Vertex &_end);
111  //Resolves start issues when start and goal point is on the same segment
112  void resolveStartCollision(Vertex &_start, Vertex &_end);
113  //checks if a list contains a specific vertex (seg id)
114  bool containsVertex(const Vertex &_v, const std::vector<std::reference_wrapper<Vertex>> &_list) const;
115 
116  std::priority_queue<Vertex *, std::vector<Vertex *>, greaterSegmentWrapper> seg_queue_;
117  uint32_t neutral_cost_ = 1;
118  uint32_t diameter_;
119 
126 
128  std::vector<uint32_t> collisions_robots_;
129  std::vector<std::unique_ptr<Vertex>> startSegments_;
131 };
132 } // namespace multi_robot_router
133 #endif
multi_robot_router::SegmentExpander::resolveStartCollision
void resolveStartCollision(Vertex &_start, Vertex &_end)
Definition: segment_expander.cpp:164
heuristic.h
multi_robot_router::SegmentExpander::containsVertex
bool containsVertex(const Vertex &_v, const std::vector< std::reference_wrapper< Vertex >> &_list) const
Definition: segment_expander.cpp:228
multi_robot_router::AvoidanceResolution
Definition: avoidance_resolution.h:39
multi_robot_router::SegmentExpander::reset
void reset()
resets the session
Definition: segment_expander.cpp:63
multi_robot_router::SegmentExpander::btr_
BacktrackingResolution btr_
Definition: segment_expander.h:124
multi_robot_router::SegmentExpander::CollisionResolverType::backtracking
@ backtracking
multi_robot_router::SegmentExpander::greaterSegmentWrapper::operator()
bool operator()(const Vertex *_a, const Vertex *_b) const
Definition: segment_expander.h:99
multi_robot_router::SegmentExpander::startSegments_
std::vector< std::unique_ptr< Vertex > > startSegments_
Definition: segment_expander.h:129
multi_robot_router::SegmentExpander::seg_queue_
std::priority_queue< Vertex *, std::vector< Vertex * >, greaterSegmentWrapper > seg_queue_
Definition: segment_expander.h:116
multi_robot_router::PotentialCalculator
Definition: potential_calculator.h:36
multi_robot_router::SegmentExpander::CollisionResolverType
CollisionResolverType
Definition: segment_expander.h:48
empty_resolution.h
multi_robot_router::SegmentExpander::expandVoronoi
Vertex * expandVoronoi(Vertex &_start, Vertex &_end, const uint32_t _cycles)
Definition: segment_expander.cpp:244
multi_robot_router::SegmentExpander::diameter_
uint32_t diameter_
Definition: segment_expander.h:118
multi_robot_router::SegmentExpander::clearpq
void clearpq(std::priority_queue< T, S, C > &q)
Definition: segment_expander.h:92
multi_robot_router::Heuristic
Definition: heuristic.h:36
multi_robot_router::SegmentExpander::CollisionResolverType::avoidance
@ avoidance
multi_robot_router::SegmentExpander::collisions_robots_
std::vector< uint32_t > collisions_robots_
Definition: segment_expander.h:128
backtracking_resolution.h
route_coordinator.h
multi_robot_router::SegmentExpander::er_
EmptyResolution er_
Definition: segment_expander.h:125
multi_robot_router::SegmentExpander::neutral_cost_
uint32_t neutral_cost_
Definition: segment_expander.h:117
multi_robot_router::SegmentExpander::calculatePotentials
bool calculatePotentials(const RouteCoordinatorWrapper *_p, Vertex &_start, Vertex &_end, const uint32_t _maxIterations, const uint32_t _radius)
assigns all Vertices in the Search graph with a potential according to the distance to the start
Definition: segment_expander.cpp:144
q
std::queue< Index > q
multi_robot_router::SegmentExpander::SegmentExpander
SegmentExpander(const CollisionResolverType _cRes)
constructor
Definition: segment_expander.cpp:36
multi_robot_router::SegmentExpander::getRobotCollisions
const std::vector< uint32_t > & getRobotCollisions() const
returns the found robotCollisions while planning
Definition: segment_expander.cpp:298
multi_robot_router::SegmentExpander::addStartExpansionCandidate
void addStartExpansionCandidate(Vertex &_start, Vertex &_current, Vertex &_next, Vertex &_end)
Definition: segment_expander.cpp:69
multi_robot_router::SegmentExpander::avr_
AvoidanceResolution avr_
Definition: segment_expander.h:123
multi_robot_router::SegmentExpander::hx_
Heuristic hx_
Definition: segment_expander.h:120
multi_robot_router::SegmentExpander
Definition: segment_expander.h:45
multi_robot_router::SegmentExpander::greaterSegmentWrapper
Definition: segment_expander.h:97
multi_robot_router::SegmentExpander::pCalc_
PotentialCalculator pCalc_
Definition: segment_expander.h:121
multi_robot_router::SegmentExpander::collision_resolution_
CollisionResolution * collision_resolution_
Definition: segment_expander.h:122
multi_robot_router::SegmentExpander::route_querry_
const RouteCoordinatorWrapper * route_querry_
Definition: segment_expander.h:127
multi_robot_router::SegmentExpander::setCollisionResolver
void setCollisionResolver(const CollisionResolverType cRes)
sets the desired collision resolver
Definition: segment_expander.cpp:41
multi_robot_router::SegmentExpander::setSpeed
void setSpeed(const float &_speed)
Sets the multiplier to reduce a robots speed (pCalc...)
Definition: segment_expander.cpp:239
multi_robot_router::EmptyResolution
Definition: empty_resolution.h:38
multi_robot_router::SegmentExpander::addExpansoionCandidate
void addExpansoionCandidate(Vertex &_current, Vertex &_next, Vertex &_end)
Definition: segment_expander.cpp:95
multi_robot_router::Vertex
Definition: srr_utils.h:65
multi_robot_router::SegmentExpander::getCollisionResolver
CollisionResolverType getCollisionResolver() const
gets the currently used collision resolver
Definition: segment_expander.cpp:58
avoidance_resolution.h
multi_robot_router::BacktrackingResolution
Definition: backtracking_resolution.h:38
multi_robot_router::Vertex::weight
int32_t weight
Definition: srr_utils.h:79
multi_robot_router::SegmentExpander::CollisionResolverType::none
@ none
multi_robot_router::CollisionResolution
Definition: collision_resolution.h:41
collision_resolution.h
multi_robot_router
Definition: avoidance_resolution.h:37
multi_robot_router::RouteCoordinatorWrapper
Definition: route_coordinator.h:122
multi_robot_router::SegmentExpander::crType_
CollisionResolverType crType_
Definition: segment_expander.h:130


tuw_multi_robot_router
Author(s): Benjamin Binder
autogenerated on Wed Mar 2 2022 01:10:16