+/*
+ * SPDX-FileCopyrightText: 2021 Jiri Vlasak <jiri.vlasak.2@cvut.cz>
+ *
+ * SPDX-License-Identifier: GPL-3.0-only
+ */
+
#include "rrtext.hh"
#include "reeds_shepp.h"
double
RRTExt10::cost_search(RRTNode const& f, RRTNode const& t) const
{
- return f.edist(t) + std::abs(t.h() - f.h());
+ double cost = f.edist(t);
+ double heur = std::min(std::abs(t.h() - f.h()),
+ 2 * M_PI - std::abs(t.h() - f.h()));
+ heur *= this->bc_.mtr();
+ cost = std::max(cost, heur);
+ return cost + f.cusp() * 0.1;
}
} // namespace rrts