@@ -104,13 +104,13 @@ def planning(self, sx, sy, gx, gy):
104104 # Add it to the closed set
105105 closed_set [c_id ] = current
106106
107+ random .shuffle (self .motion )
108+
107109 # expand_grid search grid based on motion model
108- successors = [self .Node (current .x + self .motion [i ][0 ],
110+ for i , _ in enumerate (self .motion ):
111+ node = self .Node (current .x + self .motion [i ][0 ],
109112 current .y + self .motion [i ][1 ],
110- current .cost + self .motion [i ][2 ], c_id + 1 , current ) for i , _ in enumerate (self .motion )]
111-
112- random .shuffle (successors )
113- for node in successors :
113+ current .cost + self .motion [i ][2 ], c_id + 1 , current )
114114 n_id = self .calc_grid_index (node )
115115
116116 # If the node is not safe, do nothing
@@ -128,7 +128,7 @@ def calc_final_path(self, ngoal, closedset):
128128 rx , ry = [self .calc_grid_position (ngoal .x , self .minx )], [
129129 self .calc_grid_position (ngoal .y , self .miny )]
130130 n = closedset [ngoal .pind ]
131- while n . parent is not None :
131+ while n is not None :
132132 rx .append (self .calc_grid_position (n .x , self .minx ))
133133 ry .append (self .calc_grid_position (n .y , self .miny ))
134134 n = n .parent
0 commit comments