Skip to content

Conversation

Copy link

Copilot AI commented Dec 17, 2025

edge_action_manager2.py incorrectly assumes all Nav2 goals have a poses[] array field, causing AttributeError: 'NavigateToPose_Goal' object has no attribute 'poses' when executing NavigateToPose actions. Only NavigateThroughPoses goals have poses[]; NavigateToPose goals have a single pose field.

Changes

  • edge_action_manager2.py:1340-1347: Add conditional to handle both action types when extracting destination coordinates for logging and visualization
# Before
current_destination = (target_goal.poses[-1].pose.position.x, target_goal.poses[-1].pose.position.y)

# After
if target_action == self.ACTIONS.NAVIGATE_TO_POSE:
    current_destination = (target_goal.pose.pose.position.x, target_goal.pose.pose.position.y)
else:
    current_destination = (target_goal.poses[-1].pose.position.x, target_goal.poses[-1].pose.position.y)

This prevents the abort and allows both action types to execute successfully.

Original prompt

This section details on the original issue you should resolve

<issue_title>[ISSUE]: Nav2 action goal mismatch in edge_action_manager2 causes NavigateToPose abort</issue_title>
<issue_description>### Description

Summary
topological_navigation aborts when executing the edge action NavigateToPose because edge_action_manager2.py incorrectly assumes the Nav2 goal message has a poses[] field. NavigateToPose_Goal only contains a single pose, so the action server throws AttributeError and the goal is aborted.


Environment

  • ROS 2: Humble

  • Package: topological_navigation

  • Script(s):

    • topological_navigation/scripts/navigation2.py
    • topological_navigation/edge_action_manager2.py

Steps to Reproduce

  1. Run the topological navigation stack.
  2. Trigger an edge traversal that selects the action NavigateToPose (via edge action manager).
  3. Observe runtime error and aborted goal.

Expected Behavior

NavigateToPose should execute successfully, and destination extraction should use goal.pose (single pose).


Actual Behavior

The action server crashes during execute callback and aborts the goal.

Logs:

[edge_action_manager]: Executing action : NavigateToPose
[topological_navigation]: Error raised in execute callback: 'NavigateToPose_Goal' object has no attribute 'poses'
Traceback (most recent call last):
  ...
  File ".../topological_navigation/edge_action_manager2.py", line 1388, in execute
    current_destination = (target_goal.poses[-1].pose.position.x, target_goal.poses[-1].pose.position.y)
AttributeError: 'NavigateToPose_Goal' object has no attribute 'poses'
...
[topological_navigation]: Goal state not set, assuming aborted.

Root Cause

edge_action_manager2.py uses:

target_goal.poses[-1]

This is only valid for nav2_msgs/action/NavigateThroughPoses goals (which have poses[]).
For nav2_msgs/action/NavigateToPose, the goal field is pose (singular).

So when NavigateToPose is selected, accessing poses raises AttributeError.


Additional Notes

  • If the intended behavior is to follow multiple waypoints, then the edge action should be configured to use NavigateThroughPoses instead of NavigateToPose.

  • Current behavior suggests either:

    1. action selection is correct but the destination extraction is wrong, or
    2. action selection should be NavigateThroughPoses but is misconfigured.

Impact

  • Navigation goals abort immediately when the selected edge action is NavigateToPose.
  • Breaks autonomy execution flow and topological edge traversal.
    </issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix Nav2 action goal mismatch in edge_action_manager2 Fix AttributeError in edge_action_manager2 when executing NavigateToPose actions Dec 17, 2025
Copilot AI requested a review from ibrahimhroob December 17, 2025 21:20
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.

2 participants