Skip to content

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

Closed
dv-picknik wants to merge 1 commit into
rollingfrom
feature/2482-goal-status-enum
Closed

dv-picknik wants to merge 1 commit into
rollingfrom
feature/2482-goal-status-enum

Conversation

@dv-picknik

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

Copy link
Copy Markdown
Member

Review draft inside our fork. Upstream, the base becomes ros2/rclcpp:rolling.

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() returns UNKNOWN, so callers never see an unnamed enum value. 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().

Would you rather deprecate get_status() on rolling and have it return the enum instead of adding a second getter? I kept this additive so it can be backported to humble, which the issue asks for. Deprecating would make it rolling-only. I can do either.

Fixes ros2#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. It fails without the range check, where get_status_code() returns 0x2A.

This branch is on an organization fork, which GitHub does not let maintainers push to. If you want changes, tell me and I will make them.

@dv-picknik dv-picknik self-assigned this Sep 28, 2026
@dv-picknik
dv-picknik marked this pull request as ready for review September 28, 2026 21:07
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: David Vadovszki <david.vadovszki@picknik.ai>
@dv-picknik
dv-picknik force-pushed the feature/2482-goal-status-enum branch from 07d47ce to 344ed0c Compare September 28, 2026 21:07
@dv-picknik

Copy link
Copy Markdown
Member Author

Superseded by ros2#3292.

@dv-picknik dv-picknik closed this Sep 29, 2026
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

1 participant