diff --git a/source/Tutorials/Intermediate/Writing-an-Action-Server-Client/Cpp.rst b/source/Tutorials/Intermediate/Writing-an-Action-Server-Client/Cpp.rst index 3ada605427a..20cf5e9e440 100644 --- a/source/Tutorials/Intermediate/Writing-an-Action-Server-Client/Cpp.rst +++ b/source/Tutorials/Intermediate/Writing-an-Action-Server-Client/Cpp.rst @@ -312,21 +312,21 @@ That response is handled by ``goal_response_callback``: .. literalinclude:: scripts/client.cpp :language: c++ - :lines: 62-71 + :lines: 64-71 Assuming the goal was accepted by the server, it will start processing. Any feedback to the client will be handled by the ``feedback_callback``: .. literalinclude:: scripts/client.cpp :language: c++ - :lines: 72-83 + :lines: 73-83 When the server is finished processing, it will return a result to the client. The result is handled by the ``result_callback``: .. literalinclude:: scripts/client.cpp :language: c++ - :lines: 84-107 + :lines: 85-107 We now have a fully functioning action client. Let's get it built and running. diff --git a/source/Tutorials/Intermediate/Writing-an-Action-Server-Client/scripts/client.cpp b/source/Tutorials/Intermediate/Writing-an-Action-Server-Client/scripts/client.cpp index 4ec691ba82c..b95f58aeab7 100644 --- a/source/Tutorials/Intermediate/Writing-an-Action-Server-Client/scripts/client.cpp +++ b/source/Tutorials/Intermediate/Writing-an-Action-Server-Client/scripts/client.cpp @@ -53,12 +53,13 @@ class FibonacciActionClient : public rclcpp::Node std::bind(&FibonacciActionClient::feedback_callback, this, _1, _2); send_goal_options.result_callback = std::bind(&FibonacciActionClient::result_callback, this, _1); - this->client_ptr_->async_send_goal(goal_msg, send_goal_options); + goal_future_ = this->client_ptr_->async_send_goal(goal_msg, send_goal_options); } private: rclcpp_action::Client::SharedPtr client_ptr_; rclcpp::TimerBase::SharedPtr timer_; + std::shared_future goal_future_; void goal_response_callback(const GoalHandleFibonacci::SharedPtr & goal_handle) {