]> rtime.felk.cvut.cz Git - hubacji1/rrts.git/blobdiff - api/rrtext.h
Add reset method, remove debug print
[hubacji1/rrts.git] / api / rrtext.h
index 5768778cb2e1a0dbf3d637db7812a1a58b39723e..4e1f825cbef208dfc7488f04e7f6fc7ba4831db5 100644 (file)
 // ext9
 #define GRID_MAX_HI 60
 
+/*! Use Dijkstra-based path optimization, goal zone for interesting nodes. */
+class RRTExt13 : public virtual RRTS {
+        private:
+        public:
+                void reset();
+                std::vector<RRTNode *> orig_path_;
+                double orig_path_cost_ = 9999;
+                std::vector<RRTNode *> first_optimized_path_;
+                double first_optimized_path_cost_ = 9999;
+                void first_path_optimization();
+                void second_path_optimization();
+                void compute_path();
+                Json::Value json();
+                void json(Json::Value jvi);
+
+                // getter, setter
+                std::vector<RRTNode *> &orig_path()
+                {
+                        return this->orig_path_;
+                };
+                double &orig_path_cost() { return this->orig_path_cost_; }
+                void orig_path_cost(double c) { this->orig_path_cost_ = c; }
+                std::vector<RRTNode *> &first_optimized_path()
+                {
+                        return this->first_optimized_path_;
+                };
+                double &first_optimized_path_cost() {
+                        return this->first_optimized_path_cost_;
+                }
+                void first_optimized_path_cost(double c) {
+                        this->first_optimized_path_cost_ = c;
+                }
+};
+
 /*! \brief Different `steer` procedures.
 
 Use sampling in control input for `steer1`. Use R&S steering for `steer2`.
@@ -23,6 +57,9 @@ Use sampling in control input for `steer1`. Use R&S steering for `steer2`.
 class RRTExt12 : public virtual RRTS {
         protected:
                 void steer1(RRTNode &f, RRTNode &t);
+                bool connect();
+        public:
+                bool next();
 };
 
 /*! \brief Goal Zone.
@@ -123,8 +160,21 @@ class RRTExt8 : public virtual RRTS {
                 void delete_kd_nodes(KdNode *n);
                 void store_node(RRTNode *n, KdNode *&r, int l);
                 void nn(RRTNode *&n, RRTNode &t, KdNode *r, int l, double &d);
+                void nv(
+                        std::vector<RRTNode*>& n,
+                        RRTNode &t,
+                        KdNode *r,
+                        int l,
+                        double const& d
+                );
         public:
+                void delete_kd_nodes()
+                {
+                    this->delete_kd_nodes(this->kdroot_);
+                    this->kdroot_ = nullptr;
+                }
                 void init();
+                void reset();
                 void deinit();
                 void store_node(RRTNode n);
                 RRTNode *nn(RRTNode &t);
@@ -238,14 +288,15 @@ class RRTExt4 : public virtual RRTS {
 */
 class RRTExt3 : public virtual RRTS {
         private:
+        public:
+                void reset();
                 std::vector<RRTNode *> orig_path_;
                 double orig_path_cost_ = 9999;
                 std::vector<RRTNode *> first_optimized_path_;
                 double first_optimized_path_cost_ = 9999;
-        public:
-                std::vector<RRTNode *> first_path_optimization();
-                std::vector<RRTNode *> second_path_optimization();
-                std::vector<RRTNode *> path();
+                void first_path_optimization();
+                void second_path_optimization();
+                void compute_path();
                 Json::Value json();
                 void json(Json::Value jvi);
 
@@ -284,6 +335,8 @@ class RRTExt2 : public virtual RRTS {
                 // Collide RRT procedures
                 std::tuple<bool, unsigned int, unsigned int>
                 collide_steered_from(RRTNode &f);
+                std::tuple<bool, unsigned int, unsigned int>
+                collide_tmp_steered_from(RRTNode &f);
 
                 std::tuple<bool, unsigned int, unsigned int>
                 collide_two_nodes(RRTNode &f, RRTNode &t);