Skip to content

Add more callbacks to rclcpp_action::Client #635

@stertingen

Description

@stertingen

Feature request

Feature description

Using the action client in rclcpp_action requires polling using timers on the future objects returned by Client::async_send_goal and Client::async_get_result. It would be far more convenient to add callbacks to these functions.

(spin_until_future_complete won't work because my node is already spinning.)

Implementation considerations

Possible function signatures could look like this:

using GoalResultCallback =
  std::function<void(std::shared_future<typename GoalHandle::SharedPtr>)>;
using ResultCallback =
  std::function<void(std::shared_future<Result>)>;

std::shared_future<typename GoalHandle::SharedPtr>
async_send_goal(
  const Goal & goal, GoalResultCallback = nullptr,
  FeedbackCallback callback = nullptr, ResultCallback = nullptr,
  bool ignore_result = false);

std::shared_future<Result>
async_get_result(typename GoalHandle::SharedPtr goal_handle, ResultCallback = nullptr)

While these are the callbacks I currently need, it would be consistent to add appropriate callbacks to all functions returning future objects.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions