]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/blob - incl/rrtplanner.h
Make `nv` procedure part of RRTBase
[hubacji1/iamcar.git] / incl / rrtplanner.h
1 /*
2 This file is part of I am car.
3
4 I am car is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 I am car is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with I am car. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef RRTPLANNER_H
19 #define RRTPLANNER_H
20
21 #include <vector>
22 #include "rrtbase.h"
23 #include "rrtnode.h"
24
25 #define GOALFIRST 1
26
27 class LaValle1998: public RRTBase {
28         public:
29                 //using RRTBase::RRTBase;
30                 LaValle1998(RRTNode *init, RRTNode *goal);
31
32                 // RRT framework
33                 std::vector<RRTNode *> (*steer)(
34                                 RRTNode *init,
35                                 RRTNode *goal);
36                 bool next();
37 };
38
39 class Kuwata2008: public RRTBase {
40         public:
41                 Kuwata2008(RRTNode *init, RRTNode *goal);
42
43                 // RRT framework
44                 std::vector<RRTNode *> (*steer)(
45                                 RRTNode *init,
46                                 RRTNode *goal);
47                 bool next();
48 };
49
50 class Karaman2011: public RRTBase {
51         protected:
52                 bool connect(
53                                 RRTNode *pn,
54                                 RRTNode *ns,
55                                 std::vector<RRTNode *> nvs);
56                 bool rewire(std::vector<RRTNode *> nvs, RRTNode *ns);
57         public:
58                 Karaman2011(RRTNode *init, RRTNode *goal);
59
60                 // RRT framework
61                 std::vector<RRTNode *> (*steer)(
62                                 RRTNode *init,
63                                 RRTNode *goal);
64                 bool next();
65 };
66
67 class T1: public RRTBase {
68         public:
69                 T1(RRTNode *init, RRTNode *goal);
70
71                 // RRT framework
72                 std::vector<RRTNode *> (*steer)(
73                                 RRTNode *init,
74                                 RRTNode *goal);
75                 bool next();
76 };
77
78 class T2: public Karaman2011 {
79         public:
80                 using Karaman2011::Karaman2011;
81
82                 bool next();
83                 float goal_cost();
84 };
85
86 class T3: public RRTBase {
87         protected:
88                 T2 p_root_;
89                 T2 p_goal_;
90         public:
91                 T3(RRTNode *init, RRTNode *goal);
92                 bool next();
93                 bool link_obstacles(
94                                 std::vector<CircleObstacle> *cobstacles,
95                                 std::vector<SegmentObstacle> *sobstacles);
96                 bool connecttrees(RRTNode *rn, RRTNode *gn);
97                 bool overlaptrees(RRTNode **ron, RRTNode **gon);
98 };
99
100 class Klemm2015: public Karaman2011 {
101         private:
102                 RRTNode *orig_root_ = nullptr;
103                 RRTNode *orig_goal_ = nullptr;
104         protected:
105                 int extendstar1(RRTNode *rs, RRTNode **xn);
106                 int extendstarC(RRTNode *rs);
107                 int connectstar(RRTNode *x);
108                 void swap();
109         public:
110                 Klemm2015(RRTNode *init, RRTNode *goal);
111
112                 // RRT framework
113                 std::vector<RRTNode *> (*steer)(
114                                 RRTNode *init,
115                                 RRTNode *goal);
116                 bool next();
117 };
118
119 #endif