Skip to content

Add Jump Point Search grid path planner - #1529

Open
Zero-State-Logic wants to merge 1 commit into
AtsushiSakai:masterfrom
Zero-State-Logic:feature/jump-point-search
Open

Zero-State-Logic wants to merge 1 commit into
AtsushiSakai:masterfrom
Zero-State-Logic:feature/jump-point-search

Conversation

@Zero-State-Logic

Copy link
Copy Markdown

Reference issue

Closes #1299

What this does

Adds a Jump Point Search (JPS) planner under PathPlanning/JumpPointSearch/. JPS is an enhancement of A* for uniform-cost grids: it returns a path of the same optimal cost while expanding far fewer nodes, by pruning symmetric paths and "jumping" over intermediate cells to the start, the goal, and nodes with a forced neighbor.

The planner mirrors PathPlanning/AStar/a_star.py:

  • same grid, obstacle model, and heuristic (2D Euclidean),
  • same public interface planning(sx, sy, gx, gy) -> rx, ry,
  • same eight-connected movement (diagonal cost sqrt(2), allowed when the target cell is free), so its path cost is directly comparable to A*,
  • a main() example on the identical obstacle map, animated under show_animation.

Why / scope

One new algorithm example, matching the existing A* example's style. No existing code, defaults, or dependencies changed (only math + matplotlib).

Tests

Added tests/test_jump_point_search.py:

  • test_optimality_on_main_obstacle_course, test_optimality_on_open_grid, test_optimality_with_wall_and_gap: import the repo's AStarPlanner, run both planners, and assert the JPS path cost equals A*'s (the key correctness check).
  • test_main: head-less smoke test of the example.

Local results (Python 3.13+): tests pass; the new file passes ruff check with the repo config and python -m py_compile. On the A* main() map both planners report an identical path cost of 104.5685 m. A separate 5000 random-grid cross-check against A* found 0 cost mismatches.

Docs

Added a "Jump Point Search algorithm" section to docs/modules/5_path_planning/grid_base_search/grid_base_search_main.rst explaining neighbor pruning, forced neighbors, and jumping, with references and an autofunction code link.

TODO before merge

  • Add PathPlanning/JumpPointSearch/animation.gif to the PythonRoboticsGifs repo and confirm the image link renders.
  • Build the docs locally and eyeball the new page.

Add a Jump Point Search (JPS) planner under PathPlanning/JumpPointSearch,
an optimization of A* for uniform-cost grids that expands far fewer nodes
while returning a path with the same optimal cost. It mirrors the A*
example's grid, obstacle model, and public interface
(planning(sx, sy, gx, gy) -> rx, ry) so the two are directly comparable.

- Implement forced-neighbor detection and recursive jumping, including
  diagonal jumps that branch into their orthogonal components, on the
  same eight-connected grid used by the A* example.
- Add tests/test_jump_point_search.py asserting the JPS path cost equals
  A*'s on several grids, plus a head-less smoke test of the example.
- Document the algorithm on the grid based search docs page.

Closes AtsushiSakai#1299
Copilot AI balanced review requested due to automatic review settings November 27, 2026 16:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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.

Add Jump Point Search

2 participants