@@ -97,7 +97,7 @@ def is_collision(sx, sy, gx, gy, rr, okdtree):
9797 dx = gx - sx
9898 dy = gy - sy
9999 yaw = math .atan2 (gy - sy , gx - sx )
100- d = math .sqrt (dx ** 2 + dy ** 2 )
100+ d = math .hypot (dx , dy )
101101
102102 if d >= MAX_EDGE_LEN :
103103 return True
@@ -171,7 +171,7 @@ def dijkstra_planning(sx, sy, gx, gy, ox, oy, rr, road_map, sample_x, sample_y):
171171 road_map: ??? [m]
172172 sample_x: ??? [m]
173173 sample_y: ??? [m]
174-
174+
175175 @return: Two lists of path coordinates ([x1, x2, ...], [y1, y2, ...]), empty list when no path was found
176176 """
177177
@@ -182,7 +182,7 @@ def dijkstra_planning(sx, sy, gx, gy, ox, oy, rr, road_map, sample_x, sample_y):
182182 openset [len (road_map ) - 2 ] = nstart
183183
184184 path_found = True
185-
185+
186186 while True :
187187 if not openset :
188188 print ("Cannot find path" )
@@ -213,7 +213,7 @@ def dijkstra_planning(sx, sy, gx, gy, ox, oy, rr, road_map, sample_x, sample_y):
213213 n_id = road_map [c_id ][i ]
214214 dx = sample_x [n_id ] - current .x
215215 dy = sample_y [n_id ] - current .y
216- d = math .sqrt (dx ** 2 + dy ** 2 )
216+ d = math .hypot (dx , dy )
217217 node = Node (sample_x [n_id ], sample_y [n_id ],
218218 current .cost + d , c_id )
219219
@@ -226,7 +226,7 @@ def dijkstra_planning(sx, sy, gx, gy, ox, oy, rr, road_map, sample_x, sample_y):
226226 openset [n_id ].pind = c_id
227227 else :
228228 openset [n_id ] = node
229-
229+
230230 if path_found is False :
231231 return [], []
232232
0 commit comments