*/
void set_sample_uniform_circle();
protected:
+ std::vector<RRTNode> tmp_steered_;
bool finishit = false;
double path_cost_before_opt_ = 9999;
virtual RRTNode *nn(RRTNode &t);
virtual std::vector<RRTNode *> nv(RRTNode &t);
void steer(RRTNode &f, RRTNode &t);
+ void tmp_steer(RRTNode &f, RRTNode &t);
virtual void steer1(RRTNode &f, RRTNode &t);
virtual void steer2(RRTNode &f, RRTNode &t);
/*! \brief Join steered nodes to RRT data structure
\param f RRT node to join steered nodes to.
*/
void join_steered(RRTNode *f);
+ void join_tmp_steered(RRTNode *f);
virtual bool goal_found(RRTNode &f);
// RRT* procedures
bool connect();
return (T(0) < val) - (val < T(0));
}
+double edist(RRTNode const& n1, RRTNode const& n2)
+{
+ auto dx = n2.x() - n1.x();
+ auto dy = n2.y() - n1.y();
+ return sqrt(dx*dx + dy*dy);
+}
+double edist(RRTNode const* n1, RRTNode const* n2)
+{
+ return edist(*n1, *n2);
+}
+
RRTNode::RRTNode()
{
}
ReedsSheppStateSpace rsss(this->bc.mtr());
rsss.sample(q0, q1, 0.2, cb_rs_steer, &this->steered());
}
+void RRTS::tmp_steer(RRTNode &f, RRTNode &t)
+{
+ this->tmp_steered_.clear();
+ double q0[] = {f.x(), f.y(), f.h()};
+ double q1[] = {t.x(), t.y(), t.h()};
+ ReedsSheppStateSpace rsss(this->bc.mtr());
+ rsss.sample(q0, q1, 0.2, cb_rs_steer, &this->tmp_steered_);
+}
void RRTS::steer1(RRTNode &f, RRTNode &t)
{
f = t;
}
}
+void RRTS::join_tmp_steered(RRTNode *f)
+{
+ while (this->tmp_steered_.size() > 0) {
+ this->store_node(this->tmp_steered_.front());
+ RRTNode *t = &this->nodes().back();
+ t->p(f);
+ t->c(this->cost_build(*f, *t));
+ this->tmp_steered_.erase(this->tmp_steered_.begin());
+ f = t;
+ }
+}
bool RRTS::goal_found(RRTNode &f)
{
cost = this->cost_search(*n, *t);
}
}
+ // steer from f->t and then continue with the steered.
+ this->tmp_steer(*f, *t);
+ if (this->tmp_steered_.size() > 0) {
+ auto col = this->collide_tmp_steered_from(*f);
+ if (std::get<0>(col))
+ return false;
+ this->join_tmp_steered(f);
+ f = &this->nodes().back();
+ }
+ if (edist(f, t) > 0.2)
+ return false;
+ // cont.
this->store_node(this->steered().front());
t = &this->nodes().back();
t->p(f);