@@ -38,15 +38,15 @@ def __init__(self, ox, oy, resolution, robot_radius):
38
38
self .motion = self .get_motion_model ()
39
39
40
40
class Node :
41
- def __init__ (self , x , y , cost , parent ):
41
+ def __init__ (self , x , y , cost , parent_index ):
42
42
self .x = x # index of grid
43
43
self .y = y # index of grid
44
44
self .cost = cost
45
- self .parent = parent # index of previous Node
45
+ self .parent_index = parent_index # index of previous Node
46
46
47
47
def __str__ (self ):
48
48
return str (self .x ) + "," + str (self .y ) + "," + str (
49
- self .cost ) + "," + str (self .parent )
49
+ self .cost ) + "," + str (self .parent_index )
50
50
51
51
def planning (self , sx , sy , gx , gy ):
52
52
"""
@@ -88,7 +88,7 @@ def planning(self, sx, sy, gx, gy):
88
88
89
89
if current .x == goal_node .x and current .y == goal_node .y :
90
90
print ("Find goal" )
91
- goal_node .parent = current .parent
91
+ goal_node .parent_index = current .parent_index
92
92
goal_node .cost = current .cost
93
93
break
94
94
@@ -126,12 +126,12 @@ def calc_final_path(self, goal_node, closed_set):
126
126
# generate final course
127
127
rx , ry = [self .calc_position (goal_node .x , self .min_x )], [
128
128
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 ]
132
132
rx .append (self .calc_position (n .x , self .min_x ))
133
133
ry .append (self .calc_position (n .y , self .min_y ))
134
- parent = n .parent
134
+ parent_index = n .parent_index
135
135
136
136
return rx , ry
137
137
0 commit comments