Skip to content

Deprecate get_status() on action client goal handles in favor of get_status_code() #3306

Description

@dv-picknik

Description

#3292 adds get_status_code() to ClientGoalHandle and GenericClientGoalHandle. It returns a GoalStatusCode enum and throws InvalidGoalStatusError if the server sent a status outside the action_msgs/GoalStatus values. This issue proposes deprecating get_status(), which returns the raw int8_t, so callers move to the typed getter.

Depends on #3292.

Motivation

Two getters return the same value in different forms. get_status() passes through whatever the server sent. Callers compare it against GoalStatus::STATUS_* constants and have to handle out-of-range values themselves. With one getter, every caller gets the type and the range check.

Design / Implementation Considerations

  • Rolling only. A deprecation in a released distro would add warnings there, so this one should not be backported. Add GoalStatusCode enum and get_status_code() to client goal handles #3292 can be.

  • It follows the pattern from deprecate rclcpp::spin_some and rclcpp::spin_all #2848: [[deprecated("use get_status_code() instead")]] before RCLCPP_ACTION_PUBLIC, and RCPPUTILS_DEPRECATION_WARNING_OFF_START/STOP around tests that still call get_status().

  • I have a branch ready. It moves 39 test assertions and 5 benchmark checks in rclcpp_action to get_status_code(), and rclcpp_action builds without warnings.

  • Downstream projects need their own PRs to switch to get_status_code():

    • Nav2 has 5 call sites, including nav2_behavior_tree/bt_action_node.hpp.
    • MoveIt 2 has 1, in the motion planning RViz plugin.

    I found these with GitHub code search on default branches, so the list may be incomplete. Those PRs can merge once get_status_code() is in a rolling release. A branch that also builds for released distros will need a version check, because those distros don't have get_status_code(). I plan to open the PRs for Nav2 and MoveIt 2. Ideally they merge before the deprecation, so neither project sees the warning.

Additional Information

get_status_code() throws where get_status() did not. A caller that reads the status on every tick, like bt_action_node, will need to decide how to handle InvalidGoalStatusError. Checking the status where it arrives, in handle_status_message() and the result callback, would remove that case. That belongs in a separate change.

Done when

Claude Code with Claude Opus 5.5 drafted this issue. I reviewed it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions