Skip to content

Fix bidirectional A* crash when the goal is unreachable (fixes #1504) - #1507

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

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

Conversation

@blessedefe4real

Copy link
Copy Markdown

Reference issue

Fixes #1504

What does this implement/fix?

BidirectionalAStarPlanner.planning raised AttributeError: 'NoneType' object has no attribute 'x' when the goal is unreachable: the search loop breaks on an empty open set while the meeting points are still None, and path reconstruction dereferences them.

  • Return [], [] as soon as either open set is exhausted (same behavior as the Dijkstra fix proposed in Fix Dijkstra failure when goal is unreachable #1418), and document it in the planning docstring.
  • Add tests/test_bidirectional_a_star.py, which did not exist: it runs main() without animation and checks the unreachable-goal case.

Normal planning is unchanged.

Additional information

test_unreachable_goal_returns_empty_path raises AttributeError on master and passes with this change. 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 either open set was exhausted the search loop only broke out,
leaving the meeting points as None, and calc_final_bidirectional_path
then raised AttributeError ('NoneType' object has no attribute 'x').

Return empty lists when either search runs out of nodes. Add a test
file for bidirectional A* covering the example and an unreachable 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.

Bidirectional A* raises AttributeError when the goal is unreachable

1 participant