add_library(rrts STATIC
src/rrts.cc
+ src/rrtext15.cc
src/rrtext14.cc
src/rrtext13.cc
src/rrtext10.cc
12. "steer" -- Use random control input for `steer1`, use R&S for `steer2`.
13. "path optimization" -- Dijkstra algorithm, goal zone for interesting nodes.
14. "sampling" -- uniform sampling in circle between init, goal (rad = edist)
+15. "log" -- log goal cc each iteration.
[cute c2]: https://github.com/RandyGaul/cute_headers/blob/master/cute_c2.h
[K-d tree]: https://en.wikipedia.org/wiki/K-d_tree
namespace rrts {
+class RRTExt15 : public virtual RRTS {
+private:
+ std::vector<double> log_path_cost_;
+public:
+ Json::Value json() const;
+ void json(Json::Value jvi);
+ bool next();
+};
+
/*! \brief Random sampling in the circuit between root and goal.
*
* \see https://stackoverflow.com/questions/5837572/generate-a-random-point-within-a-circle-uniformly/50746409#50746409
--- /dev/null
+#include "rrtext.hh"
+
+namespace rrts {
+
+Json::Value
+RRTExt15::json() const
+{
+ auto jvo = RRTS::json();
+ unsigned int i = 0;
+ for (auto c: this->log_path_cost_) {
+ jvo["log_path_cost"][i++] = c;
+ }
+ return jvo;
+}
+
+void
+RRTExt15::json(Json::Value jvi)
+{
+ RRTS::json(jvi);
+}
+
+bool
+RRTExt15::next()
+{
+ bool c = RRTS::next();
+ if (this->log_path_cost_.size() == 0) {
+ this->log_path_cost_.push_back(this->goal_.cc());
+ } else {
+ double lc = this->log_path_cost_.back();
+ double gc = this->goal_.cc();
+ if (gc > 0.0 && (lc == 0.0 || gc < lc)) {
+ this->log_path_cost_.push_back(gc);
+ } else {
+ this->log_path_cost_.push_back(lc);
+ }
+ }
+ return c;
+}
+
+} // namespace rrts