Add node valid check to fix #271

This commit is contained in:
Atsushi Sakai
2020-01-05 13:53:49 +09:00
parent 570dbec832
commit 5ceb83783e

View File

@@ -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]