: root_(new RRTNode())
, goal_(new RRTNode())
, gen_(std::random_device{}())
+ , ndx_(HMAX - HMIN, (HMAX - HMIN) / 4)
+ , ndy_(VMAX - VMIN, (VMAX - VMIN) / 4)
+ , ndh_(0, M_PI * 2 / 4)
{
this->nodes_.reserve(NOFNODES);
this->nodes_.push_back(this->root_);
: root_(init)
, goal_(goal)
, gen_(std::random_device{}())
+ , ndx_(HMIN + (HMAX - HMIN) / 2, (HMAX - HMIN) / 4)
+ , ndy_(VMIN + (VMAX - VMIN) / 2, (VMAX - VMIN) / 4)
+ , ndh_(0, M_PI * 2 / 4)
{
this->nodes_.reserve(NOFNODES);
this->nodes_.push_back(init);
h += this->samplingInfo_.h0;
return new RRTNode(x, y, h);
} else {
- return sa1();
+ float x = this->ndx_(this->gen_);
+ float y = this->ndy_(this->gen_);
+ float h = this->ndh_(this->gen_);
+ return new RRTNode(x, y, h);
}
}
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;
#include "rrtnode.h"
-#define HMIN 0 // horizontal
-#define HMAX 26 // horizontal
-#define VMIN -5.3 // vertical
-#define VMAX 5.5 // vertical
+#define HMIN -20 // horizontal
+#define HMAX 20 // horizontal
+#define VMIN -5 // vertical
+#define VMAX 30 // vertical
// OpenGL window size
#define SCREEN_WIDTH 1000