From 54b6052e9a3df09900f20c148fd1b469e6412c3f Mon Sep 17 00:00:00 2001 From: Bao Sheng Date: Tue, 18 Jun 2019 15:40:25 +0800 Subject: [PATCH] Once find the path, stop RRT* --- PathPlanning/RRTstar/rrt_star.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/PathPlanning/RRTstar/rrt_star.py b/PathPlanning/RRTstar/rrt_star.py index 3ca43b7c..a2064a21 100644 --- a/PathPlanning/RRTstar/rrt_star.py +++ b/PathPlanning/RRTstar/rrt_star.py @@ -63,12 +63,14 @@ class RRT(): if animation and i % 5 == 0: self.DrawGraph(rnd) - # generate coruse - lastIndex = self.get_best_last_index() - if lastIndex is None: - return None - path = self.gen_final_course(lastIndex) - return path + # generate coruse + lastIndex = self.get_best_last_index() + if lastIndex is None: + continue + path = self.gen_final_course(lastIndex) + return path + + return None def choose_parent(self, newNode, nearinds): if not nearinds: