@@ -38,15 +38,15 @@ def __init__(self, ox, oy, resolution, robot_radius):
3838 self .motion = self .get_motion_model ()
3939
4040 class Node :
41- def __init__ (self , x , y , cost , parent ):
41+ def __init__ (self , x , y , cost , parent_index ):
4242 self .x = x # index of grid
4343 self .y = y # index of grid
4444 self .cost = cost
45- self .parent = parent # index of previous Node
45+ self .parent_index = parent_index # index of previous Node
4646
4747 def __str__ (self ):
4848 return str (self .x ) + "," + str (self .y ) + "," + str (
49- self .cost ) + "," + str (self .parent )
49+ self .cost ) + "," + str (self .parent_index )
5050
5151 def planning (self , sx , sy , gx , gy ):
5252 """
@@ -88,7 +88,7 @@ def planning(self, sx, sy, gx, gy):
8888
8989 if current .x == goal_node .x and current .y == goal_node .y :
9090 print ("Find goal" )
91- goal_node .parent = current .parent
91+ goal_node .parent_index = current .parent_index
9292 goal_node .cost = current .cost
9393 break
9494
@@ -126,12 +126,12 @@ def calc_final_path(self, goal_node, closed_set):
126126 # generate final course
127127 rx , ry = [self .calc_position (goal_node .x , self .min_x )], [
128128 self .calc_position (goal_node .y , self .min_y )]
129- parent = goal_node .parent
130- while parent != - 1 :
131- n = closed_set [parent ]
129+ parent_index = goal_node .parent_index
130+ while parent_index != - 1 :
131+ n = closed_set [parent_index ]
132132 rx .append (self .calc_position (n .x , self .min_x ))
133133 ry .append (self .calc_position (n .y , self .min_y ))
134- parent = n .parent
134+ parent_index = n .parent_index
135135
136136 return rx , ry
137137
0 commit comments