ros2 action — send goals and monitor progress from the terminal
Atlasbot · 17/8/2026 · 10 min read
An action (such as Nav2's /navigate_to_pose) differs from a service because it runs for longer and provides feedback along the way. ros2 action tests an action server without building a UI, especially useful when debugging Nav2 over SSH without a display for RViz2.
Key concepts
ros2 action list # list available action servers
ros2 action info /navigate_to_pose # show connected clients/servers
ros2 action send_goal /navigate_to_pose nav2_msgs/action/NavigateToPose \
"{pose: {header: {frame_id: 'map'}, pose: {position: {x: 1.0, y: 2.0}}}}"
send_goal sends a real goal to the action server, then keeps the terminal open until the action completes or is canceled (Ctrl+C), printing feedback along the way — unlike service call, which waits for exactly one response and exits.
How it works
Reading feedback while an action is running:
$ ros2 action send_goal /navigate_to_pose nav2_msgs/action/NavigateToPose "{...}" --feedback
Goal accepted with ID: 8f3a...
Feedback:
current_pose: ...
distance_remaining: 3.42
Feedback:
current_pose: ...
distance_remaining: 2.87
...
Result:
error_code: 0
The --feedback flag enables real-time printing of each feedback message. With NavigateToPose, a steadily decreasing distance_remaining indicates that the robot is moving in the right direction; if it stays constant or increases, Nav2 has a problem that you can identify before opening RViz2.
In short: An action combines a service (final response), a topic (continuous feedback) and cancellation —
send_goal --feedbacklets you verify all three directly in the terminal without a graphical interface.
Canceling a running goal:
ros2 action send_goal ... # Ctrl+C to cancel the goal while waiting for its result
Pressing Ctrl+C while send_goal waits sends a cancel request for that goal to the server — equivalent to Nav2 receiving an emergency stop command during navigation, exactly the flow to test when checking recovery/safety logic.
Technical details
Parameters
Some additional useful flags when working with ros2 action:
| Flag/command | Effect |
|---|---|
ros2 action info /navigate_to_pose -t | Also show the action type without a separate command |
ros2 action list -t | List every action with its type |
ros2 action send_goal ... --feedback | Required to see feedback — disabled by default |
Unlike ros2 service call (which has no default timeout), send_goal expects a goal acceptance/rejection response almost immediately (the server must quickly say whether it accepts the goal), but the final result can take a long time depending on the task (for example, a long navigation route). This makes --feedback important for telling whether the action is actually progressing or has stalled.
Practical applications
ros2 action send_goal --feedback is especially valuable for field engineers diagnosing remotely over SSH. If a robot is stuck in a warehouse and opening RViz2 on a large-screen laptop onsite is inconvenient, simply SSH into the robot computer, send a navigation goal and watch whether distance_remaining decreases. This quickly distinguishes two situations: Nav2 is stuck in path planning (no feedback or an immediately REJECTED goal), or the robot is physically stuck (feedback continues but distance_remaining stays unchanged). These causes require entirely different solutions.
Practical example
$ ros2 action info /navigate_to_pose -t
Output:
Action: /navigate_to_pose
Action clients: 0
Action servers: 1
/bt_navigator [nav2_msgs/action/NavigateToPose]
Action clients: 0 means no client (including RViz2) is currently sending goals. If it remains 0 after clicking in RViz2, the problem is the connection between RViz2 and the system, rather than bt_navigator.
Common mistakes
- Forgetting
--feedbackand assuming the action has hung — by default,send_goalprints no feedback, so the terminal stays silent while the robot may be moving normally. Always add--feedbackto monitor progress. - Mistaking a
REJECTEDgoal for an accepted one — check whether the first line saysGoal accepted...; do not assume acceptance simply because the command ran without an error. - Expecting Ctrl+C to stop the robot instantly — the server takes time to process cancellation (entering
CANCELINGbefore stopping). It is not always instantaneous; a moving physical robot still needs time to brake safely. - An action server mishandles cancellation and the request hangs indefinitely — if the server implementation does not check the cancel flag regularly (as discussed in the Action Communication article), the CLI can wait forever for
CANCELED. This indicates a server code bug rather than incorrect CLI use.
Conclusion
ros2 action send_goal --feedback is the most powerful tool for testing action servers from the terminal, especially over SSH without a graphical interface. Always add --feedback and check the goal status (accepted/rejected), rather than trusting that a command ran without errors. The next article covers ros2 param — the equivalent tool for inspecting and changing node parameters from the terminal.
Get new articles and lessons by email
When a new technical article or course module is published, Atlas Robotics sends you a short email. No spam.
Unsubscribe any time with the link in each email. See our Privacy policy.