return cost;
}
-double RRTS::cost_build(RRTNode &f, RRTNode &t)
-{
- double q0[] = {f.x(), f.y(), f.h()};
- double q1[] = {t.x(), t.y(), t.h()};
- ReedsSheppStateSpace rsss(f.mtr());
- 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_);