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_;
47 double cost(RRTNode &f, RRTNode &t);
49 std::default_random_engine gen_;
50 std::normal_distribution<double> ndx_;
51 std::normal_distribution<double> ndy_;
52 std::normal_distribution<double> ndh_;
53 RRTNode &nn(RRTNode &t);
54 std::vector<std::reference_wrapper<RRTNode>> nv(RRTNode &t);
55 bool steer(RRTNode &f, RRTNode &t);
60 /*! \brief Return path found by RRT*.
62 std::vector<std::reference_wrapper<RRTNode>> path();
63 /*! \brief Run next RRT* iteration.
68 std::vector<RRTNode> &goals() { return this->goals_; }
69 std::vector<RRTNode> &nodes() { return this->nodes_; }
70 std::vector<RRTNode> &samples() { return this->samples_; }