add error handling code

This commit is contained in:
Atsushi Sakai
2018-06-16 22:14:09 +09:00
parent a7eec6371b
commit ba2247c1b0

View File

@@ -311,7 +311,11 @@ class BITStar(object):
currId = self.goalId
while (currId != self.startId):
plan.append(self.tree.nodeIdToRealWorldCoord(currId))
currId = self.nodes[currId]
try:
currId = self.nodes[currId]
except(KeyError):
print("Path key error")
return []
plan.append(self.start)
plan = plan[::-1] # reverse the plan