Nav2 Navigation Stack - humble
humble
ROS 2 Navigation Stack
|
An action server wrapper to make applications simpler using Actions. More...
#include <nav2_util/include/nav2_util/simple_action_server.hpp>
Public Types | |
typedef std::function< void()> | ExecuteCallback |
typedef std::function< void()> | CompletionCallback |
Public Member Functions | |
template<typename NodeT > | |
SimpleActionServer (NodeT node, const std::string &action_name, ExecuteCallback execute_callback, CompletionCallback completion_callback=nullptr, std::chrono::milliseconds server_timeout=std::chrono::milliseconds(500), bool spin_thread=false, const rcl_action_server_options_t &options=rcl_action_server_get_default_options()) | |
An constructor for SimpleActionServer. More... | |
SimpleActionServer (rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base_interface, rclcpp::node_interfaces::NodeClockInterface::SharedPtr node_clock_interface, rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr node_logging_interface, rclcpp::node_interfaces::NodeWaitablesInterface::SharedPtr node_waitables_interface, const std::string &action_name, ExecuteCallback execute_callback, CompletionCallback completion_callback=nullptr, std::chrono::milliseconds server_timeout=std::chrono::milliseconds(500), bool spin_thread=false, const rcl_action_server_options_t &options=rcl_action_server_get_default_options()) | |
An constructor for SimpleActionServer. More... | |
rclcpp_action::GoalResponse | handle_goal (const rclcpp_action::GoalUUID &, std::shared_ptr< const typename ActionT::Goal >) |
handle the goal requested: accept or reject. This implementation always accepts. More... | |
rclcpp_action::CancelResponse | handle_cancel (const std::shared_ptr< rclcpp_action::ServerGoalHandle< ActionT >> handle) |
Accepts cancellation requests of action server. More... | |
void | handle_accepted (const std::shared_ptr< rclcpp_action::ServerGoalHandle< ActionT >> handle) |
Handles accepted goals and adds to preempted queue to switch to. More... | |
void | work () |
Computed background work and processes stop requests. | |
void | activate () |
Active action server. | |
void | deactivate () |
Deactive action server. | |
bool | is_running () |
Whether the action server is munching on a goal. More... | |
bool | is_server_active () |
Whether the action server is active or not. More... | |
bool | is_preempt_requested () const |
Whether the action server has been asked to be preempted with a new goal. More... | |
const std::shared_ptr< const typename ActionT::Goal > | accept_pending_goal () |
Accept pending goals. More... | |
void | terminate_pending_goal () |
Terminate pending goals. | |
const std::shared_ptr< const typename ActionT::Goal > | get_current_goal () const |
Get the current goal object. More... | |
const rclcpp_action::GoalUUID | get_current_goal_id () const |
const std::shared_ptr< const typename ActionT::Goal > | get_pending_goal () const |
Get the pending goal object. More... | |
bool | is_cancel_requested () const |
Whether or not a cancel command has come in. More... | |
void | terminate_all (typename std::shared_ptr< typename ActionT::Result > result=std::make_shared< typename ActionT::Result >()) |
Terminate all pending and active actions. More... | |
void | terminate_current (typename std::shared_ptr< typename ActionT::Result > result=std::make_shared< typename ActionT::Result >()) |
Terminate the active action. More... | |
void | succeeded_current (typename std::shared_ptr< typename ActionT::Result > result=std::make_shared< typename ActionT::Result >()) |
Return success of the active action. More... | |
void | publish_feedback (typename std::shared_ptr< typename ActionT::Feedback > feedback) |
Publish feedback to the action server clients. More... | |
Protected Member Functions | |
constexpr auto | empty_result () const |
Generate an empty result object for an action type. | |
constexpr bool | is_active (const std::shared_ptr< rclcpp_action::ServerGoalHandle< ActionT >> handle) const |
Whether a given goal handle is currently active. More... | |
void | terminate (std::shared_ptr< rclcpp_action::ServerGoalHandle< ActionT >> &handle, typename std::shared_ptr< typename ActionT::Result > result=std::make_shared< typename ActionT::Result >()) |
Terminate a particular action with a result. More... | |
void | info_msg (const std::string &msg) const |
Info logging. | |
void | debug_msg (const std::string &msg) const |
Debug logging. | |
void | error_msg (const std::string &msg) const |
Error logging. | |
void | warn_msg (const std::string &msg) const |
Warn logging. | |
Protected Attributes | |
rclcpp::node_interfaces::NodeBaseInterface::SharedPtr | node_base_interface_ |
rclcpp::node_interfaces::NodeClockInterface::SharedPtr | node_clock_interface_ |
rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr | node_logging_interface_ |
rclcpp::node_interfaces::NodeWaitablesInterface::SharedPtr | node_waitables_interface_ |
std::string | action_name_ |
ExecuteCallback | execute_callback_ |
CompletionCallback | completion_callback_ |
std::future< void > | execution_future_ |
bool | stop_execution_ {false} |
std::recursive_mutex | update_mutex_ |
bool | server_active_ {false} |
bool | preempt_requested_ {false} |
std::chrono::milliseconds | server_timeout_ |
std::shared_ptr< rclcpp_action::ServerGoalHandle< ActionT > > | current_handle_ |
std::shared_ptr< rclcpp_action::ServerGoalHandle< ActionT > > | pending_handle_ |
rclcpp_action::Server< ActionT >::SharedPtr | action_server_ |
bool | spin_thread_ |
rclcpp::CallbackGroup::SharedPtr | callback_group_ {nullptr} |
rclcpp::executors::SingleThreadedExecutor::SharedPtr | executor_ |
std::unique_ptr< nav2_util::NodeThread > | executor_thread_ |
An action server wrapper to make applications simpler using Actions.
Definition at line 37 of file simple_action_server.hpp.
|
inlineexplicit |
An constructor for SimpleActionServer.
node | Ptr to node to make actions |
action_name | Name of the action to call |
execute_callback | Execution callback function of Action |
server_timeout | Timeout to to react to stop or preemption requests |
spin_thread | Whether to spin with a dedicated thread internally |
options | Options to pass to the underlying rcl_action_server_t |
Definition at line 62 of file simple_action_server.hpp.
|
inlineexplicit |
An constructor for SimpleActionServer.
<node | interfaces> Abstract node interfaces to make actions |
action_name | Name of the action to call |
execute_callback | Execution callback function of Action |
server_timeout | Timeout to to react to stop or preemption requests |
spin_thread | Whether to spin with a dedicated thread internally |
options | Options to pass to the underlying rcl_action_server_t |
Definition at line 87 of file simple_action_server.hpp.
References nav2_util::SimpleActionServer< ActionT >::handle_accepted(), nav2_util::SimpleActionServer< ActionT >::handle_cancel(), and nav2_util::SimpleActionServer< ActionT >::handle_goal().
|
inline |
Accept pending goals.
Definition at line 336 of file simple_action_server.hpp.
References nav2_util::SimpleActionServer< ActionT >::debug_msg(), nav2_util::SimpleActionServer< ActionT >::empty_result(), nav2_util::SimpleActionServer< ActionT >::error_msg(), and nav2_util::SimpleActionServer< ActionT >::is_active().
Referenced by nav2_util::SimpleActionServer< ActionT >::work().
|
inline |
Get the current goal object.
Definition at line 381 of file simple_action_server.hpp.
References nav2_util::SimpleActionServer< ActionT >::error_msg(), and nav2_util::SimpleActionServer< ActionT >::is_active().
|
inline |
Get the pending goal object.
Definition at line 409 of file simple_action_server.hpp.
References nav2_util::SimpleActionServer< ActionT >::error_msg().
|
inline |
Handles accepted goals and adds to preempted queue to switch to.
Goal | A server goal handle to cancel |
Definition at line 177 of file simple_action_server.hpp.
References nav2_util::SimpleActionServer< ActionT >::debug_msg(), nav2_util::SimpleActionServer< ActionT >::error_msg(), nav2_util::SimpleActionServer< ActionT >::is_active(), nav2_util::SimpleActionServer< ActionT >::is_running(), nav2_util::SimpleActionServer< ActionT >::terminate(), and nav2_util::SimpleActionServer< ActionT >::work().
Referenced by nav2_util::SimpleActionServer< ActionT >::SimpleActionServer().
|
inline |
Accepts cancellation requests of action server.
uuid | Goal ID |
Goal | A server goal handle to cancel |
Definition at line 157 of file simple_action_server.hpp.
References nav2_util::SimpleActionServer< ActionT >::debug_msg(), and nav2_util::SimpleActionServer< ActionT >::warn_msg().
Referenced by nav2_util::SimpleActionServer< ActionT >::SimpleActionServer().
|
inline |
handle the goal requested: accept or reject. This implementation always accepts.
uuid | Goal ID |
Goal | A shared pointer to the specific goal |
Definition at line 137 of file simple_action_server.hpp.
References nav2_util::SimpleActionServer< ActionT >::debug_msg().
Referenced by nav2_util::SimpleActionServer< ActionT >::SimpleActionServer().
|
inlineconstexprprotected |
Whether a given goal handle is currently active.
handle | Goal handle to check |
Definition at line 540 of file simple_action_server.hpp.
Referenced by nav2_util::SimpleActionServer< ActionT >::accept_pending_goal(), nav2_util::SimpleActionServer< ActionT >::get_current_goal(), nav2_util::SimpleActionServer< ActionT >::handle_accepted(), nav2_util::SimpleActionServer< ActionT >::publish_feedback(), nav2_util::SimpleActionServer< ActionT >::succeeded_current(), nav2_util::SimpleActionServer< ActionT >::terminate(), and nav2_util::SimpleActionServer< ActionT >::work().
|
inline |
Whether or not a cancel command has come in.
Definition at line 425 of file simple_action_server.hpp.
References nav2_util::SimpleActionServer< ActionT >::error_msg().
|
inline |
Whether the action server has been asked to be preempted with a new goal.
Definition at line 326 of file simple_action_server.hpp.
|
inline |
Whether the action server is munching on a goal.
Definition at line 305 of file simple_action_server.hpp.
Referenced by nav2_util::SimpleActionServer< ActionT >::deactivate(), and nav2_util::SimpleActionServer< ActionT >::handle_accepted().
|
inline |
Whether the action server is active or not.
Definition at line 316 of file simple_action_server.hpp.
|
inline |
Publish feedback to the action server clients.
feedback | A feedback object to send to the clients |
Definition at line 490 of file simple_action_server.hpp.
References nav2_util::SimpleActionServer< ActionT >::error_msg(), and nav2_util::SimpleActionServer< ActionT >::is_active().
|
inline |
Return success of the active action.
result | A result object to send to the terminated actions |
Definition at line 473 of file simple_action_server.hpp.
References nav2_util::SimpleActionServer< ActionT >::debug_msg(), and nav2_util::SimpleActionServer< ActionT >::is_active().
|
inlineprotected |
Terminate a particular action with a result.
handle | goal handle to terminate |
the | Results object to terminate the action with |
Definition at line 551 of file simple_action_server.hpp.
References nav2_util::SimpleActionServer< ActionT >::info_msg(), nav2_util::SimpleActionServer< ActionT >::is_active(), and nav2_util::SimpleActionServer< ActionT >::warn_msg().
Referenced by nav2_util::SimpleActionServer< ActionT >::handle_accepted(), nav2_util::SimpleActionServer< ActionT >::terminate_all(), nav2_util::SimpleActionServer< ActionT >::terminate_current(), nav2_util::SimpleActionServer< ActionT >::terminate_pending_goal(), and nav2_util::SimpleActionServer< ActionT >::work().
|
inline |
Terminate all pending and active actions.
result | A result object to send to the terminated actions |
Definition at line 447 of file simple_action_server.hpp.
References nav2_util::SimpleActionServer< ActionT >::terminate().
Referenced by nav2_util::SimpleActionServer< ActionT >::deactivate(), and nav2_util::SimpleActionServer< ActionT >::work().
|
inline |
Terminate the active action.
result | A result object to send to the terminated action |
Definition at line 461 of file simple_action_server.hpp.
References nav2_util::SimpleActionServer< ActionT >::terminate().