rclcpp
master
C++ ROS Client Library API
|
Go to the documentation of this file.
15 #ifndef RCLCPP__PARAMETER_EVENT_HANDLER_HPP_
16 #define RCLCPP__PARAMETER_EVENT_HANDLER_HPP_
21 #include <unordered_map>
34 #include "rcl_interfaces/msg/parameter_event.hpp"
167 template<
typename NodeT>
176 event_subscription_ = rclcpp::create_subscription<rcl_interfaces::msg::ParameterEvent>(
177 node_topics,
"/parameter_events", qos,
181 using ParameterEventCallbackType =
192 ParameterEventCallbackHandle::SharedPtr
193 add_parameter_event_callback(
202 remove_parameter_event_callback(
203 ParameterEventCallbackHandle::SharedPtr callback_handle);
217 ParameterCallbackHandle::SharedPtr
218 add_parameter_callback(
233 remove_parameter_callback(
234 ParameterCallbackHandle::SharedPtr callback_handle);
249 get_parameter_from_event(
250 const rcl_interfaces::msg::ParameterEvent & event,
270 get_parameter_from_event(
271 const rcl_interfaces::msg::ParameterEvent & event,
282 get_parameters_from_event(
283 const rcl_interfaces::msg::ParameterEvent & event);
291 event_callback(
const rcl_interfaces::msg::ParameterEvent & event);
309 seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
315 hash_combine(seed, s.first);
316 hash_combine(seed, s.second);
325 CallbacksContainerType,
338 #endif // RCLCPP__PARAMETER_EVENT_HANDLER_HPP_
void hash_combine(std::size_t &seed, const T &v) const
Definition: parameter_event_handler.hpp:306
Definition: parameter_event_handler.hpp:39
Definition: parameter_event_handler.hpp:50
Definition: parameter_event_handler.hpp:302
std::shared_ptr< rclcpp::node_interfaces::NodeBaseInterface > get_node_base_interface(NodeType &&node)
Get the NodeBaseInterface as a shared pointer from a pointer to a "Node like" object.
Definition: get_node_base_interface.hpp:72
ParameterCallbackType callback
Definition: parameter_event_handler.hpp:47
A class used to "handle" (monitor and respond to) changes to parameters.
Definition: parameter_event_handler.hpp:159
std::shared_ptr< rclcpp::node_interfaces::NodeBaseInterface > node_base_
Definition: parameter_event_handler.hpp:297
std::recursive_mutex mutex_
Definition: parameter_event_handler.hpp:333
ParameterEventHandler(NodeT node, const rclcpp::QoS &qos=rclcpp::QoS(rclcpp::QoSInitialization::from_rmw(rmw_qos_profile_parameter_events)))
Construct a parameter events monitor.
Definition: parameter_event_handler.hpp:168
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
Subscription implementation, templated on the type of message this subscription receives.
Definition: subscription.hpp:69
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
Encapsulation of Quality of Service settings.
Definition: qos.hpp:110
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
std::function< void(const rclcpp::Parameter &)> ParameterCallbackType
Definition: parameter_event_handler.hpp:43
static QoSInitialization from_rmw(const rmw_qos_profile_t &rmw_qos)
Create a QoSInitialization from an existing rmw_qos_profile_t, using its history and depth.
ParameterEventCallbackType callback
Definition: parameter_event_handler.hpp:57
std::string parameter_name
Definition: parameter_event_handler.hpp:45
std::list< ParameterEventCallbackHandle::WeakPtr > event_callbacks_
Definition: parameter_event_handler.hpp:331
rclcpp::Subscription< rcl_interfaces::msg::ParameterEvent >::SharedPtr event_subscription_
Definition: parameter_event_handler.hpp:329
void event_callback(const rcl_interfaces::msg::ParameterEvent &event)
Callback for parameter events subscriptions.
std::shared_ptr< rclcpp::node_interfaces::NodeTopicsInterface > get_node_topics_interface(NodeType &&node)
Get the NodeTopicsInterface as a shared pointer from a pointer to a "Node like" object.
Definition: get_node_topics_interface.hpp:72
size_t operator()(const std::pair< std::string, std::string > &s) const
Definition: parameter_event_handler.hpp:312
std::function< void(const rcl_interfaces::msg::ParameterEvent &)> ParameterEventCallbackType
Definition: parameter_event_handler.hpp:55
std::string node_name
Definition: parameter_event_handler.hpp:46
Structure to store an arbitrary parameter with templated get/set methods.
Definition: parameter.hpp:52
std::unordered_map< std::pair< std::string, std::string >, CallbacksContainerType, StringPairHash > parameter_callbacks_
Definition: parameter_event_handler.hpp:327