]> rtime.felk.cvut.cz Git - hubacji1/rrts.git/commitdiff
Compute path only at the end of each iteration
authorJiri Vlasak <jiri.vlasak.2@cvut.cz>
Tue, 24 Aug 2021 07:59:53 +0000 (09:59 +0200)
committerJiri Vlasak <jiri.vlasak.2@cvut.cz>
Tue, 24 Aug 2021 08:17:25 +0000 (10:17 +0200)
src/rrts.cc

index 33600fcf8147631ddff4999ea3f577d840b904a9..8e1280e972730e125be69758569e83824f64b70d 100644 (file)
@@ -303,6 +303,7 @@ RRTS::next()
        unsigned int ss = this->steered_.size();
        this->join_steered(&this->nodes_.back());
        RRTNode* just_added = &this->nodes_.back();
+       bool gf = false;
        while (ss > 0 && just_added->p() != nullptr) {
                //if (!this->goal_drivable_from(*just_added)) {
                //      ss--;
@@ -326,7 +327,7 @@ RRTS::next()
                                        || ncc < this->goal_.cc()) {
                                this->goal_.p(this->nodes_.back());
                                this->goal_.c(nc);
-                               this->compute_path();
+                               gf = true;
                        }
                }
                ss--;
@@ -342,6 +343,9 @@ RRTS::next()
                        *just_added));
        }
 #endif
+       if (gf) {
+               this->compute_path();
+       }
        ////if (!this->goal_drivable_from(this->nodes_.back())) {
        ////    return this->should_continue();
        ////}