How to Dashing action client cancel goal

asked 2019-07-25 01:04:01 -0500

jetman gravatar image

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

I want to customize member_functions.cpp and realize Cancel Goal

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?

edit retag flag offensive close merge delete