]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/commitdiff
Update ccost of goal's parents
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Mon, 10 Jun 2019 12:51:34 +0000 (14:51 +0200)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Mon, 10 Jun 2019 13:03:46 +0000 (15:03 +0200)
base/rrtbase.cc

index 9f14eed4644664b24dfa72f2c1fecf898c6e531e..b21340f491755448c4adba4f657433f9ebe6e94d 100644 (file)
@@ -494,6 +494,19 @@ bool RRTBase::goal_found(
                                 return false;
                         }
                         this->goal_found_ = true;
+                        // Update ccost of goal's parents
+                        if (this->goals().size() > 0) {
+                                RRTNode *ch = this->goals().back();
+                                RRTNode *pn = this->goals().back()->parent();
+                                while (pn) {
+                                        pn->ccost(
+                                                ch->ccost()
+                                                - this->cost(pn, ch)
+                                        );
+                                        ch = pn;
+                                        pn = pn->parent();
+                                }
+                        }
                         return true;
                 }
         }