Skip to content

Return an empty path from A* when the goal is unreachable (fixes #1509) - #1510

Open
blessedefe4real wants to merge 1 commit into
AtsushiSakai:masterfrom
blessedefe4real:fix/a-star-unreachable-goal
Open

blessedefe4real wants to merge 1 commit into
AtsushiSakai:masterfrom
blessedefe4real:fix/a-star-unreachable-goal

Conversation

@blessedefe4real

Copy link
Copy Markdown

Reference issue

Fixes #1509

What does this implement/fix?

When the open set was exhausted, AStarPlanner.planning only broke out of the search loop and then reconstructed a path from the goal node, whose parent was never set. It returned [gx], [gy], a one-point "path" on the goal, so callers could not tell failure from success.

Normal planning is unchanged.

Additional information

Added tests/test_a_star_unreachable_goal.py (a separate file so it does not conflict with the A* test added in #1495):

  • test_unreachable_goal_returns_empty_path gets [8.0] on master and passes with this change.
  • test_start_equal_to_goal_returns_single_point_path guards the existing start == goal behavior.

Full suite (pytest tests -Werror, as in runtests.sh): 158 passed; ruff check passes on the changed files.

CheckList

  • Did you add an unittest for your new example or defect fix?
  • Did you add documents for your new example? (not applicable: defect fix)
  • All CIs are green? (You can check it after submitting)

When the open set was exhausted, AStarPlanner.planning only broke out
of the search loop and then reconstructed a path from the goal node,
whose parent was never set. It returned [gx], [gy], a one-point "path"
at the goal, so callers could not tell failure from success.

Return empty lists instead, as proposed for Dijkstra in AtsushiSakai#1418. Add
regression tests for an unreachable goal and for start equal to goal.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A* returns a one-point path at the goal when the goal is unreachable

1 participant