]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/blobdiff - incl/rrtbase.h
Use normal distribution in sampling
[hubacji1/iamcar.git] / incl / rrtbase.h
index 1f1b6f479334ff7491baace6a7cb3bc44ac27b59..f83be79cfaa4751a91145969a047bdf1906d1fe1 100644 (file)
@@ -21,6 +21,7 @@ along with I am car. If not, see <http://www.gnu.org/licenses/>.
 #include <chrono>
 #include <cmath>
 #include <pthread.h>
+#include <queue>
 #include <random>
 #include <vector>
 #include "obstacle.h"
@@ -63,6 +64,7 @@ class RRTBase {
 
                 std::vector<RRTNode *> nodes_;
                 std::vector<RRTNode *> dnodes_;
+                std::queue<RRTNode *> firsts_;
                 PolygonObstacle frame_;
                 std::vector<RRTNode *> samples_;
                 std::vector<CircleObstacle> *cobstacles_;
@@ -78,8 +80,11 @@ class RRTBase {
                 std::vector<float> slog_; // seconds of trajectories
                 std::vector<std::vector<RRTNode *>> tlog_; // trajectories
                 std::vector<RRTNode *> slot_cusp_; // cusp nodes in slot
-
+        protected:
                 std::default_random_engine gen_;
+                std::normal_distribution<float> ndx_;
+                std::normal_distribution<float> ndy_;
+                std::normal_distribution<float> ndh_;
         public:
                 const float GOAL_FOUND_DISTANCE = 0.2;
                 const float GOAL_FOUND_ANGLE = M_PI / 32;
@@ -94,6 +99,7 @@ class RRTBase {
                 std::vector<RRTNode *> &goals();
                 std::vector<RRTNode *> &nodes();
                 std::vector<RRTNode *> &dnodes();
+                std::queue<RRTNode *> &firsts();
                 PolygonObstacle &frame();
                 std::vector<RRTNode *> &samples();
                 std::vector<RRTNode *> iy_[IYSIZE];