]> rtime.felk.cvut.cz Git - hubacji1/iamcar2.git/blobdiff - rrts/incl/rrts.hh
Change naming and access convention
[hubacji1/iamcar2.git] / rrts / incl / rrts.hh
index d1b881dc58a51d2426e72f0e073252cc9993652f..6e6574b2fe6350d822e54fcaddb3cf2da5bc3d95 100644 (file)
@@ -35,7 +35,7 @@ class RRTNode : public virtual Pose, public virtual CarMove {
 private:
        double _c = 0.0;
        double _cc = 0.0;
-       RRTNode* _p;
+       RRTNode* _p = nullptr;
        unsigned int _cusp = 0;
        int _segment_type = 0;  // 0 ~ straight, 1 ~ left, -1 right
 public:
@@ -82,7 +82,7 @@ public:
 
 /*! RRT* algorithm basic class. */
 class RRTS {
-private:
+protected:
        BicycleCar _bc;
        RRTGoal _goal;
        unsigned int _icnt = 0;
@@ -97,15 +97,13 @@ private:
        double _cost = 0.0;
        double _eta = 0.5;
        double _time = 0.0;
-       double _last_path_cost = 0.0;
        std::vector<RRTNode> _last_path;
 protected:
-       void recompute_cc(RRTNode* g);
+       double min_gamma_eta(void) const;
+       bool should_continue(void) const;
+       void recompute_cc_for_predecessors_and(RRTNode* g);
        void recompute_path_cc();
-       double min_gamma_eta() const;
-       bool should_continue() const;
        void join_steered(RRTNode* f);
-       RRTNode& nn();
        bool connect();
        void rewire();
        bool goal_drivable_from(RRTNode const& f);
@@ -116,6 +114,7 @@ protected:
        virtual void find_nn(RRTNode const& t);
        virtual void find_nv(RRTNode const& t);
        virtual void compute_path();
+protected:
        virtual void steer(RRTNode const& f, RRTNode const& t) = 0;
        virtual bool collide_steered() = 0;
        virtual RRTNode sample() = 0;
@@ -123,14 +122,11 @@ protected:
 public:
        RRTS();
 
-       /*! Get bicycle car used in the planner. */
-       BicycleCar& bc(void) const;
-
        /*! Set pose of the bicycle car used in the planner. */
-       void bc(double x, double y, double h);
+       void set_bc_pose_to(Pose const& p);
 
        /*! Get goal. */
-       RRTGoal& goal(void) const;
+       RRTGoal const& goal(void) const;
 
        /*! Set goal. */
        void goal(double x, double y, double b, double e);
@@ -147,6 +143,9 @@ public:
        /*! Set maximum number of iterations before reset. */
        void icnt_max(unsigned int i);
 
+       /*! Start elapsed time counter. */
+       void tstart(void);
+
        /*! Return elapsed time. */
        double scnt() const;
 
@@ -162,9 +161,6 @@ public:
        /*! Get cost of the last path. */
        double last_path_cost(void) const;
 
-       /*! Get cost of the last path. */
-       void last_path_cost(double c);
-
        /*! Get eta, the RRT* constant used in near vertices and steering. */
        double eta() const;