From: Jiri Vlasak Date: Wed, 6 Mar 2019 13:08:36 +0000 (+0100) Subject: Add random engine to RRTBase X-Git-Tag: v0.6.0~15^2~9 X-Git-Url: https://rtime.felk.cvut.cz/gitweb/hubacji1/iamcar.git/commitdiff_plain/0d7eb699ac32578f97a5659a89f1d3b9a525ef24 Add random engine to RRTBase --- diff --git a/base/rrtbase.cc b/base/rrtbase.cc index 2331037..d074418 100644 --- a/base/rrtbase.cc +++ b/base/rrtbase.cc @@ -85,7 +85,8 @@ RRTBase::~RRTBase() RRTBase::RRTBase(): root_(new RRTNode()), - goal_(new RRTNode()) + goal_(new RRTNode()), + gen_(std::random_device{}()) { this->nodes_.reserve(NOFNODES); this->nodes_.push_back(this->root_); @@ -95,7 +96,8 @@ RRTBase::RRTBase(): RRTBase::RRTBase(RRTNode *init, RRTNode *goal): root_(init), - goal_(goal) + goal_(goal), + gen_(std::random_device{}()) { this->nodes_.reserve(NOFNODES); this->nodes_.push_back(init); diff --git a/incl/rrtbase.h b/incl/rrtbase.h index 347fbb9..98b4cee 100644 --- a/incl/rrtbase.h +++ b/incl/rrtbase.h @@ -21,6 +21,7 @@ along with I am car. If not, see . #include #include #include +#include #include #include "obstacle.h" #include "rrtnode.h" @@ -76,6 +77,8 @@ class RRTBase { std::vector slog_; // seconds of trajectories std::vector> tlog_; // trajectories std::vector slot_cusp_; // cusp nodes in slot + + std::default_random_engine gen_; public: const float GOAL_FOUND_DISTANCE = 0.2; const float GOAL_FOUND_ANGLE = M_PI / 32;