* \see https://github.com/AndrewWalker/Dubins-Curves
*/
class RRTExt19 : public virtual RRTS {
+private:
+ void steer(RRTNode const &f, RRTNode const &t);
};
/*! \brief Finish when more than 1000 iterations.
namespace rrts {
+/*! \brief Planner for F1/10.
+ *
+ * TODO: change RRTExt2 to cost grid
+ *
+ * \ingroup planners
+ */
+class P40 : public RRTExt2, public RRTExt8, public RRTExt10, public RRTExt14,
+ public RRTExt15, public RRTExt19, public RRTExt17,
+ public RRTExt13 {
+public:
+ Json::Value json() const
+ {
+ auto jvo = RRTExt13::json();
+ auto json15 = RRTExt15::json();
+ jvo["log_path_cost"] = json15["log_path_cost"];
+ return jvo;
+ }
+ void json(Json::Value jvi)
+ {
+ RRTExt2::json(jvi);
+ }
+ void reset()
+ {
+ RRTExt8::reset();
+ RRTExt14::reset();
+ RRTExt13::reset();
+ }
+};
+
/*! \brief Planner with optimization and reset.
*
* \ingroup planners
--- /dev/null
+/*
+ * SPDX-FileCopyrightText: 2022 Jiri Vlasak
+ *
+ * SPDX-License-Identifier: GPL-3.0-only
+ */
+
+#include "rrtext.hh"
+#include "dubins.h"
+
+namespace rrts {
+
+static int
+cb_steer(double q[3], double t, void *w)
+{
+ std::vector<RRTNode>* st = (std::vector<RRTNode>*) w;
+ st->push_back(RRTNode());
+ st->back().x(q[0]);
+ st->back().y(q[1]);
+ st->back().h(q[2]);
+ st->back().sp(1.0);
+ return 0;
+}
+
+void
+RRTExt19::steer(RRTNode const &f, RRTNode const &t)
+{
+ this->steered_.clear();
+ double q0[] = {f.x(), f.y(), f.h()};
+ double q1[] = {t.x(), t.y(), t.h()};
+ DubinsPath path;
+ int r = dubins_shortest_path(&path, q0, q1, this->bc_.mtr());
+ if (r != 0) {
+ return;
+ }
+ dubins_path_sample_many(&path, this->eta_, cb_steer, &this->steered_);
+ if (this->steered_.size() > 0) {
+ this->steered_.front().sp(0.0);
+ }
+}
+
+} /* namespace rrts */