mirror of
https://github.com/AtsushiSakai/PythonRobotics.git
synced 2026-01-13 12:08:08 -05:00
easier path retrieving and shuffle children node
This commit is contained in:
@@ -100,6 +100,8 @@ class BreadthFirstSearchPlanner:
|
||||
# Remove the item from the open set
|
||||
del open_set[c_id]
|
||||
|
||||
random.shuffle(self.motion)
|
||||
|
||||
# expand_grid search grid based on motion model
|
||||
for i, _ in enumerate(self.motion):
|
||||
node = self.Node(current.x + self.motion[i][0],
|
||||
@@ -123,14 +125,11 @@ class BreadthFirstSearchPlanner:
|
||||
rx, ry = [self.calc_grid_position(ngoal.x, self.minx)], [
|
||||
self.calc_grid_position(ngoal.y, self.miny)]
|
||||
n = closedset[ngoal.pind]
|
||||
while n.parent is not None:
|
||||
while n is not None:
|
||||
rx.append(self.calc_grid_position(n.x, self.minx))
|
||||
ry.append(self.calc_grid_position(n.y, self.miny))
|
||||
n = n.parent
|
||||
|
||||
rx.append(self.calc_grid_position(n.x, self.minx))
|
||||
ry.append(self.calc_grid_position(n.y, self.miny))
|
||||
|
||||
return rx, ry
|
||||
|
||||
def calc_grid_position(self, index, minp):
|
||||
|
||||
Reference in New Issue
Block a user