diff --git a/PathPlanning/RRT/rrt.py b/PathPlanning/RRT/rrt.py index b590d7b1..4acea0c1 100644 --- a/PathPlanning/RRT/rrt.py +++ b/PathPlanning/RRT/rrt.py @@ -140,7 +140,7 @@ class RRT: plt.clf() # for stopping simulation with the esc key. plt.gcf().canvas.mpl_connect('key_release_event', - lambda event: [exit(0) if event.key == 'escape' else None]) + lambda event: [exit(0) if event.key == 'escape' else None]) if rnd is not None: plt.plot(rnd.x, rnd.y, "^k") for node in self.node_list: @@ -175,6 +175,10 @@ class RRT: @staticmethod def check_collision(node, obstacleList): + + if node is None: + return False + for (ox, oy, size) in obstacleList: dx_list = [ox - x for x in node.path_x] dy_list = [oy - y for y in node.path_y]