]> rtime.felk.cvut.cz Git - hubacji1/rrts.git/blob - api/rrtext.h
Merge branch 'feature/dijkstra-path-opt'
[hubacji1/rrts.git] / api / rrtext.h
1 #ifndef RRTEXT_H
2 #define RRTEXT_H
3
4 #include "rrts.h"
5
6 // ext2
7 #include "cute_c2.h"
8
9 /*! \brief Use Dijkstra algorithm to find the shorter path.
10 */
11 class RRTExt3 : public virtual RRTS {
12         private:
13                 std::vector<RRTNode *> orig_path_;
14                 double orig_path_cost_;
15         public:
16                 std::vector<RRTNode *> path();
17
18                 // getter, setter
19                 std::vector<RRTNode *> &orig_path()
20                 {
21                         return this->orig_path_;
22                 };
23                 double &orig_path_cost() { return this->orig_path_cost_; }
24                 void orig_path_cost(double c) { this->orig_path_cost_ = c; }
25 };
26
27 /*! \brief Use cute_c2 for collision detection.
28
29 \see https://github.com/RandyGaul/cute_headers/blob/master/cute_c2.h
30 */
31 class RRTExt2 : public virtual RRTS {
32         private:
33                 c2Poly c2_bc_;
34                 c2x c2x_bc_;
35                 std::vector<c2Poly> c2_obstacles_;
36         public:
37                 void init();
38                 void deinit();
39
40                 // Collide RRT procedures
41                 std::tuple<bool, unsigned int, unsigned int>
42                 collide_steered_from(RRTNode &f);
43
44                 std::tuple<bool, unsigned int, unsigned int>
45                 collide_two_nodes(RRTNode &f, RRTNode &t);
46
47                 // getters, setters
48                 c2Poly &c2_bc() { return this->c2_bc_; }
49                 c2x &c2x_bc() { return this->c2x_bc_; }
50                 std::vector<c2Poly> &c2_obstacles() {
51                         return this->c2_obstacles_;
52                 };
53 };
54
55 /*! \brief Different costs extension.
56
57 Use different cost for bulding tree data structure and searching in the
58 structure.
59 */
60 class RRTExt1 : public virtual RRTS {
61         public:
62                 /*! \brief Reeds and Shepp path length.
63                 */
64                 double cost_build(RRTNode &f, RRTNode &t);
65                 /*! \brief Matej's heuristics.
66                 */
67                 double cost_search(RRTNode &f, RRTNode &t);
68 };
69
70 #endif /* RRTEXT_H */