srr_utils.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_H
30 #define SEGMENT_H
31 
32 #include <memory>
33 #include <vector>
34 #include <algorithm>
35 #include <functional>
36 #include <eigen3/Eigen/Dense>
37 
38 
39 namespace multi_robot_router
40 {
41  class Segment
42  {
43  public:
44  Segment(const uint32_t &_id, const std::vector<Eigen::Vector2d> &_points, const std::vector<uint32_t> &_successors, const std::vector<uint32_t> &_predecessors, const float &_width);
45  uint32_t getSegmentId() const;
46  float width() const;
47  float length() const;
48 
49  const std::vector<Eigen::Vector2d> &getPoints() const;
50  const std::vector<uint32_t> &getPredecessors() const;
51  const std::vector<uint32_t> &getSuccessors() const;
52 
53  const Eigen::Vector2d &getStart() const;
54  const Eigen::Vector2d &getEnd() const;
55  private:
56  uint32_t segmentId_;
57  float width_;
58  float length_;
59  std::vector<Eigen::Vector2d> points_;
60  std::vector<uint32_t> predecessors_;
61  std::vector<uint32_t> successors_;
62  };
63 
64 
65  class Vertex
66  {
67  public:
68  Vertex(const Segment &_seg);
69  const std::vector<std::reference_wrapper<Vertex>> &getPlanningSuccessors() const;
70  const std::vector<std::reference_wrapper<Vertex>> &getPlanningPredecessors() const;
71 
72  void initNeighbours(std::vector<std::unique_ptr<Vertex>> &_sortedVertices, const uint32_t _minSegmentWidth = 0);
73 
74  const Segment &getSegment() const;
75  void updateVertex(const Vertex &_v);
76 
77  int32_t potential = 0; //Endtime (the time a robot is supposed to leave the segment)
78  int32_t collision = 0;
79  int32_t weight = 0;
80  bool crossingPredecessor = false;
81  bool crossingSuccessor = false;
82  bool isWaitSegment = false;
83  Vertex *predecessor_ = NULL;
84  Vertex *successor_ = NULL;
85  private:
86  std::vector<std::reference_wrapper<Vertex>> successors_;
87  std::vector<std::reference_wrapper<Vertex>> predecessors_;
88  const Segment &segment_;
89  };
90 
91 
93  {
94  public:
95  enum class path_direction
96  {
97  none,
98  start_to_end,
99  end_to_start
100  };
101  RouteVertex(const Vertex &_vertex);
102  RouteVertex(const RouteVertex &_vertex);
103  const Segment &getSegment() const;
104 
105  int32_t potential = 0;
106  int32_t collision = 0;
107  bool overlapPredecessor = false;
108  bool overlapSuccessor = false;
111  };
112 }
113 
114 #endif
std::vector< uint32_t > predecessors_
Definition: srr_utils.h:60
uint32_t getSegmentId() const
Definition: srr_utils.cpp:60
Segment(const uint32_t &_id, const std::vector< Eigen::Vector2d > &_points, const std::vector< uint32_t > &_successors, const std::vector< uint32_t > &_predecessors, const float &_width)
Definition: srr_utils.cpp:35
std::vector< Eigen::Vector2d > points_
Definition: srr_utils.h:59
const Segment & segment_
Definition: srr_utils.h:88
std::vector< std::reference_wrapper< Vertex > > successors_
Definition: srr_utils.h:86
std::vector< std::reference_wrapper< Vertex > > predecessors_
Definition: srr_utils.h:87
std::vector< uint32_t > successors_
Definition: srr_utils.h:61
const Eigen::Vector2d & getEnd() const
Definition: srr_utils.cpp:45
const std::vector< Eigen::Vector2d > & getPoints() const
Definition: srr_utils.cpp:50
const std::vector< uint32_t > & getSuccessors() const
Definition: srr_utils.cpp:69
const Eigen::Vector2d & getStart() const
Definition: srr_utils.cpp:64
const std::vector< uint32_t > & getPredecessors() const
Definition: srr_utils.cpp:55


tuw_multi_robot_router
Author(s): Benjamin Binder
autogenerated on Mon Jun 10 2019 15:42:49