rclcpp_action
master
C++ ROS Action Client Library
|
Go to the documentation of this file.
15 #ifndef RCLCPP_ACTION__SERVER_GOAL_HANDLE_HPP_
16 #define RCLCPP_ACTION__SERVER_GOAL_HANDLE_HPP_
18 #include <rcl_action/types.h>
19 #include <rcl_action/goal_handle.h>
21 #include <action_msgs/msg/goal_status.hpp>
76 : rcl_handle_(rcl_handle)
116 mutable
std::mutex rcl_handle_mutex_;
120 template<typename ActionT>
134 template<typename ActionT>
151 auto feedback_message = std::make_shared<typename ActionT::Impl::FeedbackMessage>();
152 feedback_message->goal_id.uuid = uuid_;
153 feedback_message->feedback = *feedback_msg;
154 publish_feedback_(feedback_message);
168 abort(
typename ActionT::Result::SharedPtr result_msg)
171 auto response = std::make_shared<typename ActionT::Impl::GetResultService::Response>();
172 response->status = action_msgs::msg::GoalStatus::STATUS_ABORTED;
173 response->result = *result_msg;
174 on_terminal_state_(uuid_, response);
188 succeed(
typename ActionT::Result::SharedPtr result_msg)
191 auto response = std::make_shared<typename ActionT::Impl::GetResultService::Response>();
192 response->status = action_msgs::msg::GoalStatus::STATUS_SUCCEEDED;
193 response->result = *result_msg;
194 on_terminal_state_(uuid_, response);
208 canceled(
typename ActionT::Result::SharedPtr result_msg)
211 auto response = std::make_shared<typename ActionT::Impl::GetResultService::Response>();
212 response->status = action_msgs::msg::GoalStatus::STATUS_CANCELED;
213 response->result = *result_msg;
214 on_terminal_state_(uuid_, response);
227 on_executing_(uuid_);
248 auto null_result = std::make_shared<typename ActionT::Impl::GetResultService::Response>();
249 null_result->status = action_msgs::msg::GoalStatus::STATUS_CANCELED;
250 on_terminal_state_(uuid_, null_result);
265 on_terminal_state_(on_terminal_state), on_executing_(on_executing),
266 publish_feedback_(publish_feedback)
284 #endif // RCLCPP_ACTION__SERVER_GOAL_HANDLE_HPP_
std::function< void(const GoalUUID &)> on_executing_
Definition: server_goal_handle.hpp:279
const std::shared_ptr< const typename ActionT::Goal > goal_
The user provided message describing the goal.
Definition: server_goal_handle.hpp:271
RCLCPP_ACTION_PUBLIC bool try_canceling() noexcept
RCLCPP_ACTION_PUBLIC void _canceled()
void abort(typename ActionT::Result::SharedPtr result_msg)
Indicate that a goal could not be reached and has been aborted.
Definition: server_goal_handle.hpp:168
ServerGoalHandle(std::shared_ptr< rcl_action_goal_handle_t > rcl_handle, GoalUUID uuid, std::shared_ptr< const typename ActionT::Goal > goal, std::function< void(const GoalUUID &, std::shared_ptr< void >)> on_terminal_state, std::function< void(const GoalUUID &)> on_executing, std::function< void(std::shared_ptr< typename ActionT::Impl::FeedbackMessage >)> publish_feedback)
Definition: server_goal_handle.hpp:256
void publish_feedback(std::shared_ptr< typename ActionT::Feedback > feedback_msg)
Send an update about the progress of a goal.
Definition: server_goal_handle.hpp:149
RCLCPP_ACTION_PUBLIC ServerGoalHandleBase(std::shared_ptr< rcl_action_goal_handle_t > rcl_handle)
Definition: server_goal_handle.hpp:73
const GoalUUID & get_goal_id() const
Get the unique identifier of the goal.
Definition: server_goal_handle.hpp:239
Definition: client.hpp:44
virtual RCLCPP_ACTION_PUBLIC ~ServerGoalHandleBase()
RCLCPP_ACTION_PUBLIC bool is_executing() const
RCLCPP_ACTION_PUBLIC bool is_canceling() const
std::function< void(const GoalUUID &, std::shared_ptr< void >)> on_terminal_state_
Definition: server_goal_handle.hpp:278
RCLCPP_ACTION_PUBLIC void _cancel_goal()
void canceled(typename ActionT::Result::SharedPtr result_msg)
Indicate that a goal has been canceled.
Definition: server_goal_handle.hpp:208
void execute()
Indicate that the server is starting to execute a goal.
Definition: server_goal_handle.hpp:224
std::function< void(std::shared_ptr< typename ActionT::Impl::FeedbackMessage >)> publish_feedback_
Definition: server_goal_handle.hpp:280
Action Server.
Definition: server.hpp:268
const std::shared_ptr< const typename ActionT::Goal > get_goal() const
Get the user provided message describing the goal.
Definition: server_goal_handle.hpp:232
RCLCPP_ACTION_PUBLIC void _abort()
void succeed(typename ActionT::Result::SharedPtr result_msg)
Indicate that a goal has succeeded.
Definition: server_goal_handle.hpp:188
Definition: server_goal_handle.hpp:42
#define RCLCPP_ACTION_PUBLIC
Definition: visibility_control.hpp:50
RCLCPP_ACTION_PUBLIC bool is_active() const
const GoalUUID uuid_
A unique id for the goal request.
Definition: server_goal_handle.hpp:274
RCLCPP_ACTION_PUBLIC void _execute()
RCLCPP_ACTION_PUBLIC void _succeed()
Class to interact with goals on a server.
Definition: server_goal_handle.hpp:135
virtual ~ServerGoalHandle()
Definition: server_goal_handle.hpp:244