9 /*! \brief Different costs extension.
11 Use different cost for bulding tree data structure and searching in the
12 structure. This one is complementary to `rrtext1.cc`.
14 class RRTExt5 : public virtual RRTS {
16 /*! \brief Reeds and Shepp path length.
18 double cost_build(RRTNode &f, RRTNode &t);
19 /*! \brief Euclidean distance.
21 double cost_search(RRTNode &f, RRTNode &t);
24 /*! \brief Use grid data structure to store RRT nodes.
26 This approach speeds up the search process for the nearest neighbor and
27 the near vertices procedures.
29 class RRTExt4 : public virtual RRTS {
33 bool changed_ = false;
34 std::vector<RRTNode *> nodes_;
36 void nn(RRTNode *t, RRTNode *nn, RRTS *p);
37 void store_node(RRTNode *n);
42 return this->changed_;
44 std::vector<RRTNode *> &nodes()
51 Cell grid_[100][100]; // [0, 0] is bottom left
52 unsigned int x_min_ = 0;
53 unsigned int x_max_ = 0;
54 unsigned int y_min_ = 0;
55 unsigned int y_max_ = 0;
57 unsigned int xi(RRTNode n);
58 unsigned int yi(RRTNode n);
61 void store_node(RRTNode n);
62 RRTNode *nn(RRTNode &t);
63 std::vector<RRTNode *> nv(RRTNode &t);
66 /*! \brief Use Dijkstra algorithm to find the shorter path.
68 class RRTExt3 : public virtual RRTS {
70 std::vector<RRTNode *> orig_path_;
71 double orig_path_cost_;
73 std::vector<RRTNode *> path();
76 std::vector<RRTNode *> &orig_path()
78 return this->orig_path_;
80 double &orig_path_cost() { return this->orig_path_cost_; }
81 void orig_path_cost(double c) { this->orig_path_cost_ = c; }
84 /*! \brief Use cute_c2 for collision detection.
86 \see https://github.com/RandyGaul/cute_headers/blob/master/cute_c2.h
88 class RRTExt2 : public virtual RRTS {
92 std::vector<c2Poly> c2_obstacles_;
97 // Collide RRT procedures
98 std::tuple<bool, unsigned int, unsigned int>
99 collide_steered_from(RRTNode &f);
101 std::tuple<bool, unsigned int, unsigned int>
102 collide_two_nodes(RRTNode &f, RRTNode &t);
105 c2Poly &c2_bc() { return this->c2_bc_; }
106 c2x &c2x_bc() { return this->c2x_bc_; }
107 std::vector<c2Poly> &c2_obstacles() {
108 return this->c2_obstacles_;
112 /*! \brief Different costs extension.
114 Use different cost for bulding tree data structure and searching in the
117 class RRTExt1 : public virtual RRTS {
119 /*! \brief Reeds and Shepp path length.
121 double cost_build(RRTNode &f, RRTNode &t);
122 /*! \brief Matej's heuristics.
124 double cost_search(RRTNode &f, RRTNode &t);
127 #endif /* RRTEXT_H */