Refactor collect path planner for clarity while preserving behavior#2492
Open
Refactor collect path planner for clarity while preserving behavior#2492
Conversation
shourikb
requested changes
Feb 18, 2026
| // approach | ||
| COARSE_APPROACH, | ||
| enum class State { | ||
| // From start of subbehavior to the start of the slow part of the approach |
Contributor
There was a problem hiding this comment.
For the sake of consistency, states should be in all capital letters
|
|
||
| switch (current_state_) { | ||
| // Moves from the current location to the slow point of approach | ||
| case COARSE_APPROACH: |
Contributor
There was a problem hiding this comment.
Also not sure why this changed from before, more consistent with previous design to keep it how it was
| // Force the path to use the same target if it doesn't move too much | ||
| if (!path_coarse_target_initialized_ || | ||
| (path_coarse_target_ - target_slow_pos).mag() > | ||
| (collect::PARAM_approach_dist_target - collect::PARAM_dist_cutoff_to_control) / 2) { |
Contributor
There was a problem hiding this comment.
Is this the only change made?
automated style fixes Co-authored-by: Squid5678 <Squid5678@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Disclaimer: this was generated by Codex.
Summary
This PR refactors
CollectPathPlannerto make the planner easier to reason about and maintain, while preserving the same overall collection behavior and decision flow.The previous implementation had tightly coupled logic in
plan()and mixed state-management concerns across long code paths. This update keeps the core operational model intact (CoarseApproach -> Intercept -> Dampen -> FineApproach) but makes the control flow explicit and easier to debug.What Changed
enum class Statefor stronger typing and clearer transitions.plan()into focused helpers:update_ball_filters(...)update_approach_direction(...)process_state_transition(...)and retained the same threshold-driven behavior.coarse_approach,intercept,dampen,fine_approach,invalid) and their core planning math.Design Decisions and Rationale
Behavior Expectations
Expected runtime behavior remains the same at a high level:
FineApproach).Files Changed
src/rj_planning/include/rj_planning/planners/collect_path_planner.hppsrc/rj_planning/src/planners/collect_path_planner.cppTesting