bool collide_two_nodes(RRTNode &f, RRTNode &t);
double cost(RRTNode &f, RRTNode &t);
double cost_build(RRTNode &f, RRTNode &t);
+ double cost_search(RRTNode &f, RRTNode &t);
void sample();
std::default_random_engine gen_;
std::normal_distribution<double> ndx_;
return rsss.distance(q0, q1);
}
+double RRTS::cost_search(RRTNode &f, RRTNode &t)
+{
+ double cost = 0;
+ cost = sqrt(pow(t.y() - f.y(), 2) + pow(t.x() - f.x(), 2));
+ double heur = std::min(
+ std::abs(t.h() - f.h()),
+ 2 * M_PI - std::abs(t.h() - f.h())
+ );
+ heur *= f.mtr();
+ cost = std::max(cost, heur);
+ return cost;
+}
+
void RRTS::sample()
{
double x = this->ndx_(this->gen_);