Refactor: Use edge.action metadata instead of inferring actions from node names #219
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.
The navigation system was inferring actions (goal_align, row_traversal, etc.) from node naming patterns ("ca", "cb", "WayPoint") instead of using explicit edge metadata. This created tight coupling between map naming schemes and navigation behavior.
Changes
Removed action inference logic
get_goal_align_if()method that parsed edge IDs for naming patterns_process_and_segment_edges()now usesedge["action"]directly:Added timing instrumentation
[TIMING] Goal cancellation took 2.456s[TIMING] Action switch preempt completed in 2.579s[TIMING] Nav client setup completed in 0.034sFilter logs:
ros2 topic echo /rosout | grep "\[TIMING\]"Documented exceptions
handle_row_operation, robot status detection, area classification) still use node patterns for domain-specific geometry calculationsActionsTypewith clear warningsImpact
Original prompt
This section details on the original issue you should resolve
<issue_title>[ISSUE]: Refactor edge action handling: stop inferring actions from node names and use topological map edge metadata</issue_title>
<issue_description>### Description
Problem Statement
The current navigation/action logic infers behaviours and actions from node naming conventions, which is fragile and incorrect.
Actions such as goal alignment, row traversal, row operation, etc., are currently derived purely from string patterns in node names (e.g.
"ca","cb","WayPoint"), rather than from the explicit action definitions already present on topological map edges.This affects logic spread across the following files and needs coordinated refactoring:
edge_action_manager2.pyactions_bt.pylocalisation2.pynavigation2.pyCurrent Implementation (Issue)
In
actions_bt.py, actions are hard-coded and inferred from node name tokens:This leads to logic such as:
"ca"→ triggergoal_align"WayPoint"→ treat as outside edgeThis approach is:
Expected / Correct Behaviour
Actions must be derived from the topological map edges, not inferred from node names.
The topological map already defines explicit action metadata on each edge.
This metadata must be treated as the single source of truth.
Example (existing, correct data already available):
From this:
row_traversal)are all already explicitly defined.
The system should:
edge.actionRequired Refactor
1. Action Source of Truth
Replace all node-name-based action inference with edge metadata parsing
edge.actionmust determine:2. File-level Expectations
edge_action_manager2.pyaction,action_type, and config cleanlyactions_bt.pyRemove all logic tied to:
"ca","cb","WayPoint", index letters, etc.Map BT actions directly from
edge.actionnavigation2.pylocalisation2.pyAdditional Investigation Required
There is a noticeable long pause / wait when:
This needs investigation:
Is the delay caused by:
Identify where the blocking occurs and reduce or eliminate unnecessary waits
Acceptance Criteria
edge.actionMotivation
This change is critical to:
Notes for Copilot / PR Implementation
</issue_description>
<agent_instructions>Refactor edge action handling so behaviours are...
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.