mirror of
https://github.com/AtsushiSakai/PythonRobotics.git
synced 2026-04-22 03:00:22 -04:00
fix astar logic
This commit is contained in:
@@ -99,14 +99,10 @@ def a_star_planning(sx, sy, gx, gy, ox, oy, reso, rr):
|
||||
|
||||
if n_id not in openset:
|
||||
openset[n_id] = node # Discover a new node
|
||||
|
||||
tcost = current.cost + calc_heuristic(current, node)
|
||||
|
||||
if tcost >= node.cost:
|
||||
continue # this is not a better path
|
||||
|
||||
node.cost = tcost
|
||||
openset[n_id] = node # This path is the best unitl now. record it!
|
||||
else:
|
||||
if openset[n_id].cost >= node.cost:
|
||||
# This path is the best until now. record it!
|
||||
openset[n_id] = node
|
||||
|
||||
rx, ry = calc_fianl_path(ngoal, closedset, reso)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user