From 2f8da47555935e9c03c3d1fc1e2c86ab11d11c05 Mon Sep 17 00:00:00 2001 From: Jiri Vlasak Date: Mon, 3 May 2021 14:51:02 +0200 Subject: [PATCH] Log path based on iterations --- api/rrts.h | 1 + src/rrts.cc | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/api/rrts.h b/api/rrts.h index 2ce7e94..c5aabde 100644 --- a/api/rrts.h +++ b/api/rrts.h @@ -143,6 +143,7 @@ class RRTS { std::vector samples_; std::vector steered_; double log_path_time_ = 0.1; + unsigned int log_path_iter_ = 20; std::vector log_path_cost_; /*! \brief Update and return elapsed time. diff --git a/src/rrts.cc b/src/rrts.cc index 7a8083d..5a69bae 100644 --- a/src/rrts.cc +++ b/src/rrts.cc @@ -45,7 +45,7 @@ double RRTS::elapsed() void RRTS::log_path_cost() { this->log_path_cost_.push_back(cc(this->goals().front())); - this->log_path_time_ += 0.1; + this->log_path_iter_ += 20; } bool RRTS::should_stop() @@ -63,8 +63,8 @@ bool RRTS::should_stop() bool RRTS::should_finish() { // decide finish conditions (maybe comment some lines) - //if (this->icnt_ > 999) return true; - if (this->scnt_ > 2) return true; + if (this->icnt_ > 1000) return true; + //if (this->scnt_ > 2) return true; if (this->finishit) return true; //if (this->gf()) return true; // but continue by default @@ -484,7 +484,7 @@ bool RRTS::next() if (this->icnt_ == 0) this->tstart_ = std::chrono::high_resolution_clock::now(); bool next = true; - if (this->scnt_ > this->log_path_time_) + if (this->icnt_ > this->log_path_iter_) this->log_path_cost(); if (this->should_stop()) return false; -- 2.39.2