@@ -42,7 +42,7 @@ def calc_final_path(goal_node, closed_node_set, resolution):
4242    return  rx , ry 
4343
4444
45- def  dp_planning ( sx ,  sy ,  gx , gy , ox , oy , resolution , rr ):
45+ def  calc_distance_heuristic ( gx , gy , ox , oy , resolution , rr ):
4646    """ 
4747    gx: goal x position [m] 
4848    gx: goal x position [m] 
@@ -52,7 +52,6 @@ def dp_planning(sx, sy, gx, gy, ox, oy, resolution, rr):
5252    rr: robot radius[m] 
5353    """ 
5454
55-     start_node  =  Node (round (sx  /  resolution ), round (sy  /  resolution ), 0.0 , - 1 )
5655    goal_node  =  Node (round (gx  /  resolution ), round (gy  /  resolution ), 0.0 , - 1 )
5756    ox  =  [iox  /  resolution  for  iox  in  ox ]
5857    oy  =  [ioy  /  resolution  for  ioy  in  oy ]
@@ -115,16 +114,7 @@ def dp_planning(sx, sy, gx, gy, ox, oy, resolution, rr):
115114                        priority_queue ,
116115                        (node .cost , calc_index (node , x_w , min_x , min_y )))
117116
118-     rx , ry  =  calc_final_path (closed_set [calc_index (
119-         start_node , x_w , min_x , min_y )], closed_set , resolution )
120- 
121-     return  rx , ry , closed_set 
122- 
123- 
124- def  calc_heuristic (n1 , n2 ):
125-     w  =  1.0   # weight of heuristic 
126-     d  =  w  *  math .sqrt ((n1 .x  -  n2 .x ) **  2  +  (n1 .y  -  n2 .y ) **  2 )
127-     return  d 
117+     return  closed_set 
128118
129119
130120def  verify_node (node , obstacle_map , min_x , min_y , max_x , max_y ):
@@ -184,54 +174,3 @@ def get_motion_model():
184174              [1 , 1 , math .sqrt (2 )]]
185175
186176    return  motion 
187- 
188- 
189- def  main ():
190-     print (__file__  +  " start!!" )
191- 
192-     # start and goal position 
193-     sx  =  10.0   # [m] 
194-     sy  =  10.0   # [m] 
195-     gx  =  50.0   # [m] 
196-     gy  =  50.0   # [m] 
197-     grid_size  =  2.0   # [m] 
198-     robot_size  =  1.0   # [m] 
199- 
200-     ox , oy  =  [], []
201- 
202-     for  i  in  range (60 ):
203-         ox .append (i )
204-         oy .append (0.0 )
205-     for  i  in  range (60 ):
206-         ox .append (60.0 )
207-         oy .append (i )
208-     for  i  in  range (61 ):
209-         ox .append (i )
210-         oy .append (60.0 )
211-     for  i  in  range (61 ):
212-         ox .append (0.0 )
213-         oy .append (i )
214-     for  i  in  range (40 ):
215-         ox .append (20.0 )
216-         oy .append (i )
217-     for  i  in  range (40 ):
218-         ox .append (40.0 )
219-         oy .append (60.0  -  i )
220- 
221-     if  show_animation :  # pragma: no cover 
222-         plt .plot (ox , oy , ".k" )
223-         plt .plot (sx , sy , "xr" )
224-         plt .plot (gx , gy , "xb" )
225-         plt .grid (True )
226-         plt .axis ("equal" )
227- 
228-     rx , ry , _  =  dp_planning (sx , sy , gx , gy , ox , oy , grid_size , robot_size )
229- 
230-     if  show_animation :  # pragma: no cover 
231-         plt .plot (rx , ry , "-r" )
232-         plt .show ()
233- 
234- 
235- if  __name__  ==  '__main__' :
236-     show_animation  =  True 
237-     main ()
0 commit comments