ros2 / ros2/rclcpp

rclcpp_action: Provide enum class return ClientGoalHandle::get_status

Open
#2,482 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
805
Forks
564
Avg merge
1d 17h
Merged PRs (30d)
27

Description

Feature request

Feature description

rclcpp_action get_status returns an int, but I want the enum values. Enums provide better type safety. Casting from an int to an enum has the potential to invoke undefined behavior. Especially because there are multiple sensical enums that could apply to this, and the docs don't say which one to use.

https://github.com/ros2/rclcpp/blob/f9c4894f96ea083fc5acfcea4f1ea83850759e63/rclcpp_action/include/rclcpp_action/client_goal_handle.hpp#L93-L95

rclcpp_action::ResultCode currently represents the state that an action can finish in, but there is no enum that represents all the states of an action. It is my understanding that get_status can return more ints than are in ResultCode.

I would like to add a new enum class that can represent the values of the ints returned in get_status. It could live here:
https://github.com/ros2/rclcpp/blob/f9c4894f96ea083fc5acfcea4f1ea83850759e63/rclcpp_action/include/rclcpp_action/types.hpp#L34

Then, add a new function similar to ClientGoalHandle::get_status() that returns this enum. I want this in humble, so breaking ABI is not an option.

Implementation considerations

Need to come up with a name for get_status that returns the enum class because you can't overload with a different return type.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with rclcpp_action/include/rclcpp_action/client_goal_handle.hpp at ClientGoalHandle::get_status and rclcpp_action/include/rclcpp_action/types.hpp near ResultCode. Review the status values available to get_status and the ABI constraint for Humble, then determine a distinct name for the enum-returning API. Done means all returned states are represented and the new API avoids breaking the existing get_status interface.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.