9 /*! \brief RRT node basic class.
11 \param c Cumulative cost from RRT data structure root.
12 \param p Pointer to parent RRT node.
13 \param ch The vector of pointers to children RRT nodes.
15 class RRTNode : public BicycleCar {
18 RRTNode *p_ = nullptr;
21 double c() const { return this->c_; }
22 void c(double c) { this->c_ = c; }
24 RRTNode *p() const { return this->p_; }
25 void p(RRTNode *p) { this->p_ = p; }
30 /*! \brief RRT* algorithm basic class.
32 \param icnt RRT algorithm iterations counter.
33 \param goals The vector of goal nodes.
34 \param nodes The vector of all nodes in RRT data structure.
35 \param samples The vector of all samples of RRT algorithm.
39 unsigned int icnt_ = 0;
41 std::vector<RRTNode> goals_;
42 std::vector<RRTNode> nodes_;
43 std::vector<RRTNode> samples_;
44 std::vector<RRTNode> steered_;
48 double cost(RRTNode &f, RRTNode &t);
50 std::default_random_engine gen_;
51 std::normal_distribution<double> ndx_;
52 std::normal_distribution<double> ndy_;
53 std::normal_distribution<double> ndh_;
54 RRTNode *nn(RRTNode &t);
55 std::vector<RRTNode *> nv(RRTNode &t);
56 void steer(RRTNode &f, RRTNode &t);
61 /*! \brief Return path found by RRT*.
63 std::vector<RRTNode *> path();
64 /*! \brief Run next RRT* iteration.
67 /*! \brief Set sampling info.
69 There is normal distribution sampling for `x`, `y`, and
70 `h` parameters of RRT node.
72 \param mx Mean x value.
73 \param dx Standard deviation of x.
74 \param my Mean y value.
75 \param dy Standard deviation of y.
76 \param mh Mean h value.
77 \param dh Standard deviation of h.
86 std::vector<RRTNode> &goals() { return this->goals_; }
87 std::vector<RRTNode> &nodes() { return this->nodes_; }
88 std::vector<RRTNode> &samples() { return this->samples_; }
89 std::vector<RRTNode> &steered() { return this->steered_; }
94 /*! \brief Compute cumulative cost of RRT node.
96 \param t RRT node to compute cumulative cost to.
98 double cc(RRTNode &t);