RRTNode *RRTS::nn(RRTNode &t)
{
RRTNode *nn = &this->nodes().front();
- double cost = this->cost(*nn, t);
+ double cost = this->cost_search(*nn, t);
for (auto &f: this->nodes()) {
- if (this->cost(f, t) < cost) {
+ if (this->cost_search(f, t) < cost) {
nn = &f;
- cost = this->cost(f, t);
+ cost = this->cost_search(f, t);
}
}
return nn;
std::vector<RRTNode *> nv;
double cost = std::min(GAMMA(this->nodes().size()), ETA);
for (auto &f: this->nodes())
- if (this->cost(f, t) < cost)
+ if (this->cost_search(f, t) < cost)
nv.push_back(&f);
return nv;
}
this->nodes().push_back(this->steered().front());
RRTNode *t = &this->nodes().back();
t->p(f);
- t->c(this->cost(*f, *t));
+ t->c(this->cost_build(*f, *t));
this->steered().erase(this->steered().begin());
f = t;
}
{
bool found = false;
for (auto &g: this->goals()) {
- double cost = this->cost(f, g);
+ double cost = this->cost_build(f, g);
double edist = sqrt(
pow(f.x() - g.x(), 2)
+ pow(f.y() - g.y(), 2)
bool conn = false;
RRTNode *t = &this->steered().front();
RRTNode *f = this->nn(this->samples().back());
- double cost = this->cost(*f, *t);
+ double cost = this->cost_search(*f, *t);
for (auto n: this->nv(*t)) {
if (
!std::get<0>(this->collide_two_nodes(*n, *t))
- && this->cost(*n, *t) < cost
+ && this->cost_search(*n, *t) < cost
) {
f = n;
- cost = this->cost(*n, *t);
+ cost = this->cost_search(*n, *t);
}
}
this->nodes().push_back(this->steered().front());
t = &this->nodes().back();
t->p(f);
- t->c(this->cost(*f, *t));
+ t->c(this->cost_build(*f, *t));
conn = true;
return conn;
}
for (auto n: this->nv(*f)) {
if (
!std::get<0>(this->collide_two_nodes(*f, *n))
- && cc(*f) + this->cost(*f, *n) < cc(*n)
- )
+ && cc(*f) + this->cost_search(*f, *n) < cc(*n)
+ ) {
n->p(f);
+ n->c(this->cost_build(*f, *n));
+ }
}
}