Class AStarPlanner
Class AStarPlanner
min_dist = float('inf')
nearest = None
if nearest:
print(f"Found nearest road point {nearest} at distance {min_dist:.2f}")
return nearest
else:
print("Error: Could not find nearest road point")
return None
open_set = []
open_set_hash = set()
closed_set = set()
heapq.heappush(open_set, start)
open_set_hash.add((start.x, start.y))
current = heapq.heappop(open_set)
open_set_hash.remove((current.x, current.y))
# Goal reached
if current.x == goal.x and current.y == goal.y:
path = []
while current:
path.append((current.x, current.y))
current = current.parent
print(f"Path found with {len(path)} points after {iterations}
iterations")
return path[::-1] # Return reversed path
closed_set.add((current.x, current.y))