bool RRTS::next()
{
bool next = true;
+ this->icnt_++;
+ this->sample();
+ this->steer(
+ *this->nn(this->samples().back()),
+ this->samples().back()
+ );
+ this->connect();
+ this->rewire();
+ for (auto &n: this->goals()) {
+ double cost = this->cost(this->nodes().back(), n);
+ if (cost < ETA) {
+ next = false;
+ if (
+ n.p() == nullptr
+ || this->nodes().back().c() + cost < n.c()
+ ) {
+ n.p(&this->nodes().back());
+ n.c(this->nodes().back().c() + cost);
+ }
+ }
+ }
+ if (this->icnt_ > 999)
+ next = false;
return next;
}