15 #ifndef RCLCPP_ACTION__CLIENT_GOAL_HANDLE_IMPL_HPP_
16 #define RCLCPP_ACTION__CLIENT_GOAL_HANDLE_IMPL_HPP_
18 #include <rcl_action/types.h>
29 template<
typename ActionT>
30 ClientGoalHandle<ActionT>::ClientGoalHandle(
31 const GoalInfo & info, FeedbackCallback feedback_callback, ResultCallback result_callback)
33 result_future_(result_promise_.get_future()),
34 feedback_callback_(feedback_callback),
35 result_callback_(result_callback)
39 template<
typename ActionT>
44 template<
typename ActionT>
48 return info_.goal_id.uuid;
51 template<
typename ActionT>
58 template<
typename ActionT>
62 return this->async_get_result();
65 template<
typename ActionT>
70 if (!is_result_aware_) {
73 return result_future_;
76 template<
typename ActionT>
78 ClientGoalHandle<ActionT>::set_result(
const WrappedResult & wrapped_result)
81 status_ =
static_cast<int8_t
>(wrapped_result.code);
82 result_promise_.set_value(wrapped_result);
83 if (result_callback_) {
84 result_callback_(wrapped_result);
88 template<
typename ActionT>
90 ClientGoalHandle<ActionT>::set_feedback_callback(FeedbackCallback callback)
93 feedback_callback_ = callback;
96 template<
typename ActionT>
98 ClientGoalHandle<ActionT>::set_result_callback(ResultCallback callback)
101 result_callback_ = callback;
104 template<
typename ActionT>
112 template<
typename ActionT>
120 template<
typename ActionT>
125 return feedback_callback_ !=
nullptr;
128 template<
typename ActionT>
133 return is_result_aware_;
136 template<
typename ActionT>
141 bool previous = is_result_aware_;
142 is_result_aware_ = awareness;
146 template<
typename ActionT>
148 ClientGoalHandle<ActionT>::invalidate()
151 status_ = GoalStatus::STATUS_UNKNOWN;
155 template<
typename ActionT>
157 ClientGoalHandle<ActionT>::call_feedback_callback(
158 typename ClientGoalHandle<ActionT>::SharedPtr shared_this,
161 if (shared_this.get() !=
this) {
166 if (
nullptr == feedback_callback_) {
171 feedback_callback_(shared_this, feedback_message);
176 #endif // RCLCPP_ACTION__CLIENT_GOAL_HANDLE_IMPL_HPP_