From 713615c1e20fe90612481e1444a7f7005e4aa131 Mon Sep 17 00:00:00 2001 From: Jiri Vlasak Date: Mon, 24 Jun 2019 17:03:28 +0200 Subject: [PATCH] FIX 85aee31 --- base/rrtbase.cc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/base/rrtbase.cc b/base/rrtbase.cc index 516504e..97e4a5f 100644 --- a/base/rrtbase.cc +++ b/base/rrtbase.cc @@ -95,28 +95,36 @@ RRTBase::RRTBase() : 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_); this->add_iy(this->root_); this->add_ixy(this->root_); + float hcenter = (this->HMAX - this->HMIN) / 2 + this->HMIN; + float hrange = (this->HMAX - this->HMIN) / 2; + float vcenter = (this->VMAX - this->VMIN) / 2 + this->VMIN; + float vrange = (this->VMAX - this->VMIN) / 2; + this->ndx_ = std::normal_distribution(hcenter, hrange); + this->ndy_ = std::normal_distribution(vcenter, vrange); + this->ndh_ = std::normal_distribution(0, 2 * M_PI); } RRTBase::RRTBase(RRTNode *init, RRTNode *goal) : 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); this->add_iy(init); this->add_ixy(init); + float hcenter = (this->HMAX - this->HMIN) / 2 + this->HMIN; + float hrange = (this->HMAX - this->HMIN) / 2; + float vcenter = (this->VMAX - this->VMIN) / 2 + this->VMIN; + float vrange = (this->VMAX - this->VMIN) / 2; + this->ndx_ = std::normal_distribution(hcenter, hrange); + this->ndy_ = std::normal_distribution(vcenter, vrange); + this->ndh_ = std::normal_distribution(0, 2 * M_PI); } // getter -- 2.39.2