Skip to content

Add GoalStatusCode enum and get_status_code() to client goal handles - #3292

Merged
jmachowinski merged 2 commits into
ros2:rollingfrom
PickNikRobotics:feature/2482-goal-status-enum
Oct 3, 2026
Merged

jmachowinski merged 2 commits into
ros2:rollingfrom
PickNikRobotics:feature/2482-goal-status-enum

Conversation

@dv-picknik

@dv-picknik dv-picknik commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

This implements #2482. ClientGoalHandle::get_status() and GenericClientGoalHandle::get_status() return int8_t. Callers have to know those values are action_msgs::msg::GoalStatus::STATUS_* constants. ResultCode does not fit, because it covers only the three terminal states.

This adds rclcpp_action::GoalStatusCode, an int8_t enum class in types.hpp with all seven GoalStatus values. Both goal handles get a get_status_code() that returns it.

The status comes straight from the server's status topic, and the client does not check it. If a server sends a value outside the seven, get_status_code() throws exceptions::InvalidGoalStatusError. get_status() still returns the raw byte.

The change only adds API, and the new GenericClientGoalHandle member is non-virtual, so existing binaries keep working.

The names are open to change. I also considered GoalState, which matches rcl_action's GOAL_STATE_*, and get_goal_status().

Deprecating get_status() in favor of get_status_code() will follow in its own PR.

Fixes #2482

Is this user-facing behavior change?

No behavior change. New API only.

Did you use Generative AI?

Yes. Claude Code with Claude Opus 5.5 wrote the code, the tests and this description. I reviewed the change, then built and tested it.

Additional Information

I tested on rolling with rclcpp and rcl built from source. All rclcpp_action tests and linters pass. The package skips cppcheck on rolling. New assertions in test_client.cpp and test_generic_client.cpp check ACCEPTED, SUCCEEDED, UNKNOWN after invalidation, and CANCELED after cancel-all. A new get_status_code_out_of_range test in each file publishes status 42 for a live goal and checks that get_status() returns 42 and get_status_code() throws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: David Vadovszki <david.vadovszki@picknik.ai>
Comment thread rclcpp_action/src/generic_client_goal_handle.cpp Outdated
…status

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: David Vadovszki <david.vadovszki@picknik.ai>
@jmachowinski

Copy link
Copy Markdown
Collaborator

Pulls: #3292
Gist: https://gist.githubusercontent.com/jmachowinski/61511c43b775b5ae5714a4f88bddfa1f/raw/7fa66eaa5b0f65d3abc9936317da8bf6ed894d57/ros2.repos
BUILD args:
TEST args:
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/20631

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@jmachowinski
jmachowinski merged commit 6c35dd2 into ros2:rolling Oct 3, 2026
3 checks passed
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.

rclcpp_action: Provide enum class return ClientGoalHandle::get_status

2 participants