Skip to content
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

Pathfinding command #1523

Merged
merged 6 commits into from
Sep 19, 2023
Merged

Pathfinding command #1523

merged 6 commits into from
Sep 19, 2023

Conversation

kostmo
Copy link
Member

@kostmo kostmo commented Sep 14, 2023

Closes #836

Tests

scripts/run-tests.sh  --test-arguments '--pattern "Pathfinding"'

Demo

scripts/play.sh -i data/scenarios/Testing/836-pathfinding/836-automatic-waypoint-navigation.yaml --autoplay

@kostmo kostmo force-pushed the feature/pathfinding branch 2 times, most recently from 3e2002a to 6404d7a Compare September 16, 2023 06:57
@kostmo kostmo force-pushed the feature/pathfinding branch 2 times, most recently from f07a66a to d59335f Compare September 17, 2023 00:02
@kostmo kostmo changed the title [WIP] [Draft] Pathfinding command Pathfinding command Sep 17, 2023
@kostmo kostmo force-pushed the feature/pathfinding branch 2 times, most recently from 2cfc025 to 7483350 Compare September 17, 2023 02:03
@kostmo kostmo marked this pull request as ready for review September 17, 2023 02:03
@xsebek
Copy link
Member

xsebek commented Sep 17, 2023

@kostmo could you please test this on the sheep challenge? I would be interested to know how this performs.

Also based on the signature it returns just the first step direction right? I guess the intent is to check for existence of a path, but won't that be too slow with repeated calls?

I apologise if those questions are answered in code somewhere, I am in mountains on my phone. Either way it would be nice to have some more info in the PR description.

Comment on lines +6 to +22
-- = Design considerations
-- One possible design of the @path@ command entailed storing a computed
-- shortest path and providing a mechanism to retrieve parts of it later
-- without recomputing the whole thing.
-- However, in general the playfield can be dynamic and obstructions may
-- appear that invalidate a given computed shortest path.
-- Therefore, there can be limited value in caching a computed path for use
-- across ticks.
--
-- Instead, in the current implementation a complete path is computed
-- internally upon invoking the @path@ command, and just the direction of the
-- first "move" along that path is returned as a result to the caller.
--
-- == Max distance
--
-- We allow the caller to supply a max distance, but also impose an internal maximum
-- distance to prevent programming errors from irrecoverably freezing the game.
Copy link
Member Author

Choose a reason for hiding this comment

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

FYI some design rationale

@kostmo
Copy link
Member Author

kostmo commented Sep 18, 2023

@kostmo could you please test this on the sheep challenge? I would be interested to know how this performs.

Done: #1537

Also based on the signature it returns just the first step direction right? I guess the intent is to check for existence of a path, but won't that be too slow with repeated calls?

Empirically, it seems to be fine. More rationale is here.

Copy link
Member

@xsebek xsebek left a comment

Choose a reason for hiding this comment

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

The sheep challenge simplification looks great! 👍

src/Swarm/Game/Step/Pathfinding.hs Outdated Show resolved Hide resolved
* allow per-robot specifying certain entities as unwalkable

* add test

* Use 'path' command to check goal in sheep scenario (#1537)
@kostmo kostmo added the merge me Trigger the merge process of the Pull request. label Sep 19, 2023
@mergify mergify bot merged commit e06e04f into main Sep 19, 2023
11 checks passed
@mergify mergify bot deleted the feature/pathfinding branch September 19, 2023 06:21
@kostmo kostmo added the CHANGELOG Once merged, this PR should be highlighted in the changelog for the next release. label Sep 20, 2023
@xsebek
Copy link
Member

xsebek commented Sep 28, 2023

@kostmo it would be helpful if the PR notes mentioned new mkRobot argument.

It's addition just broke my CI tests in #1529. Besides it's not a bad thing, I would love to look at PR description and think "hey, what a nice new feature!" It also would be good to mention this new feature in CHANGELOG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CHANGELOG Once merged, this PR should be highlighted in the changelog for the next release. merge me Trigger the merge process of the Pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fast pathfinding for non-player robots
2 participants