Skip to content

Commit f299826

Browse files
committed
update code
1 parent f38c1f2 commit f299826

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

PathPlanning/AStar/a_star.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,12 @@ def a_star_planning(sx, sy, gx, gy, ox, oy, reso, rr):
100100
if n_id not in openset:
101101
openset[n_id] = node # Discover a new node
102102

103-
if node.cost >= node.cost:
103+
tcost = current.cost + calc_heuristic(current, node)
104+
105+
if tcost >= node.cost:
104106
continue # this is not a better path
105107

108+
node.cost = tcost
106109
openset[n_id] = node # This path is the best unitl now. record it!
107110

108111
rx, ry = calc_fianl_path(ngoal, closedset, reso)

0 commit comments

Comments
 (0)