Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to Dashing action client cancel goal

I try minimal_action_client of exsamples package.Using distribution is ROS2 Dashing.

I want to customize member_functions.cpp and realize Cancel Goal https://github.com/ros2/examples/blob/master/rclcpp/minimal_action_client/member_functions.cpp

I tried add code and run.But can't canceled and not get response from action server.
Add code menber_functions.cpp line 80~81

auto send_goal_options = rclcpp_action::Client<Fibonacci>::SendGoalOptions();
send_goal_options.goal_response_callback =
  std::bind(&MinimalActionClient::goal_response_callback, this, _1);
send_goal_options.feedback_callback =
  std::bind(&MinimalActionClient::feedback_callback, this, _1, _2);
send_goal_options.result_callback =
  std::bind(&MinimalActionClient::result_callback, this, _1);
auto goal_handle_future = this->client_ptr_->async_send_goal(goal_msg, send_goal_options);

auto cancel_result_future = client->async_cancel_goal(goal_handle_future.get()); // add code

What is the best way to do CancelGoal?