Skip to content

Collaborative astar #1247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

SchwartzCode
Copy link
Contributor

@SchwartzCode SchwartzCode commented Jul 10, 2025

Reference issue

What does this implement/fix?

This PR implements a simple priority based planner. It plans paths for multiple agents in an environment with dynamic obstacles. It plans in descending order of distance from start position to goal. Once a path is planned for an agent, all future plans will avoid that path.

The algorithm outlined in section III of this paper: https://pure.tudelft.nl/ws/portalfiles/portal/67074672/07138650.pdf

priority_planner2

priority_planner

Additional information

PR to gifs repo: AtsushiSakai/PythonRoboticsGifs#8

CheckList

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

@SchwartzCode SchwartzCode marked this pull request as ready for review July 10, 2025 03:51
@AtsushiSakai AtsushiSakai requested a review from Copilot July 12, 2025 08:54
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors single-agent planners into a common interface, adds a new multi-agent priority-based planner, and modularizes plotting and testing.

  • Refactored SpaceTimeAStar and SafeIntervalPathPlanner into SingleAgentPlanner subclasses with static plan methods
  • Introduced PriorityBasedPlanner for multi-agent path planning with priority ordering
  • Extracted plotting logic into Plotting.py and updated tests and documentation accordingly

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/test_space_time_astar.py Updated to call static SpaceTimeAStar.plan and adjusted assertions
tests/test_safe_interval_path_planner.py Updated to call static SafeIntervalPathPlanner.plan
tests/test_priority_based_planner.py Added tests for PriorityBasedPlanner
docs/.../time_based_grid_search_main.rst Documented priority-based planning and added paper reference
PathPlanning/TimeBasedPathPlanning/SpaceTimeAStar.py Refactored into SingleAgentPlanner, static plan, improved API
PathPlanning/TimeBasedPathPlanning/SafeInterval.py Refactored into SingleAgentPlanner, static plan, improved API
PathPlanning/TimeBasedPathPlanning/PriorityBasedPlanner.py New multi-agent PriorityBasedPlanner implementation
PathPlanning/TimeBasedPathPlanning/Plotting.py New plotting utilities for single- and multi-agent paths
PathPlanning/TimeBasedPathPlanning/Node.py Introduced shared Node and NodePath dataclasses
PathPlanning/TimeBasedPathPlanning/GridWithDynamicObstacles.py Added NARROW_CORRIDOR arrangement and reservation APIs
PathPlanning/TimeBasedPathPlanning/BaseClasses.py Added SingleAgentPlanner and MultiAgentPlanner base classes
Comments suppressed due to low confidence (2)

tests/test_space_time_astar.py:23

  • The comment indicates 28 entries but the assertion checks for 31. Update the comment to match the expected path length or adjust the expected value if it changed intentionally.
    # path should have 28 entries

PathPlanning/TimeBasedPathPlanning/GridWithDynamicObstacles.py:23

  • No tests cover the new NARROW_CORRIDOR arrangement. Consider adding unit tests to validate its behavior.
    NARROW_CORRIDOR = 2

Returns the re-ordered StartAndGoal combinations, and a list of path plans. The order of the plans
corresponds to the order of the `start_and_goals` list.
"""
print(f"Using planner: {single_agent_planner_class}")
Copy link
Preview

Copilot AI Jul 12, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider logging single_agent_planner_class.__name__ instead of the full class object for cleaner output.

Suggested change
print(f"Using planner: {single_agent_planner_class}")
print(f"Using planner: {single_agent_planner_class.__name__}")

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

1 participant