Skip to content

Commit 5ceb837

Browse files
committed
Add node valid check to fix AtsushiSakai#271
1 parent 570dbec commit 5ceb837

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

PathPlanning/RRT/rrt.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def draw_graph(self, rnd=None):
140140
plt.clf()
141141
# for stopping simulation with the esc key.
142142
plt.gcf().canvas.mpl_connect('key_release_event',
143-
lambda event: [exit(0) if event.key == 'escape' else None])
143+
lambda event: [exit(0) if event.key == 'escape' else None])
144144
if rnd is not None:
145145
plt.plot(rnd.x, rnd.y, "^k")
146146
for node in self.node_list:
@@ -175,6 +175,10 @@ def get_nearest_node_index(node_list, rnd_node):
175175

176176
@staticmethod
177177
def check_collision(node, obstacleList):
178+
179+
if node is None:
180+
return False
181+
178182
for (ox, oy, size) in obstacleList:
179183
dx_list = [ox - x for x in node.path_x]
180184
dy_list = [oy - y for y in node.path_y]

0 commit comments

Comments
 (0)