15 #ifndef RCLCPP__NODE_HPP_ 16 #define RCLCPP__NODE_HPP_ 19 #include <condition_variable> 32 #include "rcl_interfaces/msg/list_parameters_result.hpp" 33 #include "rcl_interfaces/msg/parameter_descriptor.hpp" 34 #include "rcl_interfaces/msg/parameter_event.hpp" 35 #include "rcl_interfaces/msg/set_parameters_result.hpp" 138 rclcpp::callback_group::CallbackGroup::SharedPtr
196 [[deprecated(
"use create_publisher(const std::string &, const rclcpp::QoS &, ...) instead")]]
200 size_t qos_history_depth,
215 [[deprecated(
"use create_publisher(const std::string &, const rclcpp::QoS &, ...) instead")]]
245 CallbackT && callback,
249 typename rclcpp::subscription_traits::has_message_type<CallbackT>::type, AllocatorT
251 msg_mem_strat =
nullptr);
273 typename rclcpp::subscription_traits::has_message_type<CallbackT>::type, Alloc>>
276 "use create_subscription(const std::string &, const rclcpp::QoS &, CallbackT, ...) instead" 281 CallbackT && callback,
283 rclcpp::callback_group::CallbackGroup::SharedPtr group =
nullptr,
284 bool ignore_local_publications =
false,
286 typename rclcpp::subscription_traits::has_message_type<CallbackT>::type, Alloc>::SharedPtr
287 msg_mem_strat =
nullptr,
310 typename rclcpp::subscription_traits::has_message_type<CallbackT>::type, Alloc>>
313 "use create_subscription(const std::string &, const rclcpp::QoS &, CallbackT, ...) instead" 318 CallbackT && callback,
319 size_t qos_history_depth,
320 rclcpp::callback_group::CallbackGroup::SharedPtr group =
nullptr,
321 bool ignore_local_publications =
false,
323 typename rclcpp::subscription_traits::has_message_type<CallbackT>::type, Alloc>::SharedPtr
324 msg_mem_strat =
nullptr,
333 template<
typename DurationRepT =
int64_t,
typename DurationT = std::milli,
typename CallbackT>
338 rclcpp::callback_group::CallbackGroup::SharedPtr group =
nullptr);
341 template<
typename ServiceT>
346 rclcpp::callback_group::CallbackGroup::SharedPtr group =
nullptr);
349 template<
typename ServiceT,
typename CallbackT>
353 CallbackT && callback,
355 rclcpp::callback_group::CallbackGroup::SharedPtr group =
nullptr);
398 const rcl_interfaces::msg::ParameterDescriptor & parameter_descriptor =
399 rcl_interfaces::msg::ParameterDescriptor());
422 template<
typename ParameterT>
426 const ParameterT & default_value,
427 const rcl_interfaces::msg::ParameterDescriptor & parameter_descriptor =
428 rcl_interfaces::msg::ParameterDescriptor());
463 template<
typename ParameterT>
476 template<
typename ParameterT>
538 rcl_interfaces::msg::SetParametersResult
610 rcl_interfaces::msg::SetParametersResult
622 template<
typename ParameterT>
624 [[deprecated(
"use declare_parameter() instead")]]
638 template<
typename ParameterT>
639 [[deprecated(
"use declare_parameters() instead")]]
697 template<
typename ParameterT>
716 template<
typename ParameterT>
720 ParameterT & parameter,
721 const ParameterT & alternative_value)
const;
782 template<
typename ParameterT>
802 template<
typename ParameterT>
803 [[deprecated(
"use declare_parameter() and it's return value instead")]]
808 const ParameterT & alternative_value);
827 rcl_interfaces::msg::ParameterDescriptor
877 rcl_interfaces::msg::ListParametersResult
938 template<
typename CallbackT>
939 [[deprecated(
"use set_on_parameters_set_callback() instead")]]
974 rclcpp::Event::SharedPtr
988 rclcpp::Event::SharedPtr event,
992 rclcpp::Clock::SharedPtr
1001 rclcpp::node_interfaces::NodeBaseInterface::SharedPtr
1006 rclcpp::node_interfaces::NodeClockInterface::SharedPtr
1011 rclcpp::node_interfaces::NodeGraphInterface::SharedPtr
1016 rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr
1021 rclcpp::node_interfaces::NodeTimersInterface::SharedPtr
1026 rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr
1031 rclcpp::node_interfaces::NodeServicesInterface::SharedPtr
1036 rclcpp::node_interfaces::NodeWaitablesInterface::SharedPtr
1041 rclcpp::node_interfaces::NodeParametersInterface::SharedPtr
1046 rclcpp::node_interfaces::NodeTimeSourceInterface::SharedPtr
1144 rclcpp::Node::SharedPtr
1183 group_in_node(callback_group::CallbackGroup::SharedPtr group);
1185 rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base_;
1186 rclcpp::node_interfaces::NodeGraphInterface::SharedPtr node_graph_;
1187 rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr node_logging_;
1188 rclcpp::node_interfaces::NodeTimersInterface::SharedPtr node_timers_;
1189 rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr node_topics_;
1190 rclcpp::node_interfaces::NodeServicesInterface::SharedPtr node_services_;
1191 rclcpp::node_interfaces::NodeClockInterface::SharedPtr node_clock_;
1192 rclcpp::node_interfaces::NodeParametersInterface::SharedPtr node_parameters_;
1193 rclcpp::node_interfaces::NodeTimeSourceInterface::SharedPtr node_time_source_;
1194 rclcpp::node_interfaces::NodeWaitablesInterface::SharedPtr node_waitables_;
1203 #ifndef RCLCPP__NODE_IMPL_HPP_ 1208 #endif // RCLCPP__NODE_HPP_
void register_param_change_callback(CallbackT &&callback)
Register the callback for parameter changes.
Definition: node_impl.hpp:414
rclcpp::node_interfaces::NodeServicesInterface::SharedPtr get_node_services_interface()
Return the Node's internal NodeServicesInterface implementation.
rclcpp::node_interfaces::NodeTimersInterface::SharedPtr get_node_timers_interface()
Return the Node's internal NodeTimersInterface implementation.
Definition: logger.hpp:77
Default allocation strategy for messages received by subscriptions.
Definition: message_memory_strategy.hpp:40
std::vector< uint8_t > get_parameter_types(const std::vector< std::string > &names) const
Return a vector of parameter types, one for each of the given names.
rclcpp::callback_group::CallbackGroup::SharedPtr create_callback_group(rclcpp::callback_group::CallbackGroupType group_type)
Create and return a callback group.
rclcpp::Client< ServiceT >::SharedPtr create_client(const std::string &service_name, const rmw_qos_profile_t &qos_profile=rmw_qos_profile_services_default, rclcpp::callback_group::CallbackGroup::SharedPtr group=nullptr)
#define RCLCPP_DISABLE_COPY(...)
Definition: macros.hpp:26
rcl_interfaces::msg::SetParametersResult set_parameter(const rclcpp::Parameter ¶meter)
Set a single parameter.
bool get_parameter_or(const std::string &name, ParameterT ¶meter, const ParameterT &alternative_value) const
Get the parameter value, or the "alternative_value" if not set, and assign it to "parameter".
Definition: node_impl.hpp:360
std::vector< rcl_interfaces::msg::ParameterDescriptor > describe_parameters(const std::vector< std::string > &names) const
Return a vector of parameter descriptors, one for each of the given names.
rclcpp::node_interfaces::NodeBaseInterface::SharedPtr get_node_base_interface()
Return the Node's internal NodeBaseInterface implementation.
Encapsulation of Quality of Service settings.
Definition: qos.hpp:55
Structure to store an arbitrary parameter with templated get/set methods.
Definition: parameter.hpp:51
Definition: timer.hpp:202
Encapsulation of options for node initialization.
Definition: node_options.hpp:34
rclcpp::Clock::SharedPtr get_clock()
std::vector< std::string > get_node_names() const
Get the fully-qualified names of all available nodes.
CallbackGroupType
Definition: callback_group.hpp:46
bool has_parameter(const std::string &name) const
Return true if a given parameter is declared.
size_t count_subscribers(const std::string &topic_name) const
const std::string & get_sub_namespace() const
Return the sub-namespace, if this is a sub-node, otherwise an empty string.
This header provides the get_node_topics_interface() template function.
Definition: allocator_common.hpp:24
rclcpp::Event::SharedPtr get_graph_event()
Return a graph event, which will be set anytime a graph change occurs.
const char * get_fully_qualified_name() const
Get the fully-qualified name of the node.
Definition: service.hpp:88
std::vector< ParameterT > declare_parameters(const std::string &namespace_, const std::map< std::string, ParameterT > ¶meters)
Declare and initialize several parameters with the same namespace and type.
Definition: node_impl.hpp:264
Definition: client.hpp:119
void get_parameter_or_set(const std::string &name, ParameterT &value, const ParameterT &alternative_value)
Get the parameter value; if not set, set the "alternative value" and store it in the node...
Definition: node_impl.hpp:396
rclcpp::Logger get_logger() const
Get the logger of the node.
Subscription implementation, templated on the type of message this subscription receives.
Definition: subscription.hpp:59
rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr get_node_logging_interface()
Return the Node's internal NodeLoggingInterface implementation.
std::function< rcl_interfaces::msg::SetParametersResult(const std::vector< rclcpp::Parameter > &) > OnParametersSetCallbackType
Definition: node_parameters_interface.hpp:162
const rclcpp::NodeOptions & get_node_options() const
Return the NodeOptions used when creating this node.
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
std::vector< rcl_interfaces::msg::SetParametersResult > set_parameters(const std::vector< rclcpp::Parameter > ¶meters)
Set one or more parameters, one at a time.
rcl_interfaces::msg::ParameterDescriptor describe_parameter(const std::string &name) const
Return the parameter descriptor for the given parameter name.
void set_parameters_if_not_set(const std::string &name, const std::map< std::string, ParameterT > &values)
Set a map of parameters with the same prefix.
Definition: node_impl.hpp:323
rclcpp::Node::OnParametersSetCallbackType set_on_parameters_set_callback(rclcpp::Node::OnParametersSetCallbackType callback)
Register a callback to be called anytime a parameter is about to be changed.
A publisher publishes messages of any type to a topic.
Definition: publisher.hpp:46
RCUTILS_WARN_UNUSED bool assert_liveliness() const
Manually assert that this Node is alive (for RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE).
std::shared_ptr< PublisherT > create_publisher(const std::string &topic_name, const rclcpp::QoS &qos, const PublisherOptionsWithAllocator< AllocatorT > &options=PublisherOptionsWithAllocator< AllocatorT >())
Create and return a Publisher.
Definition: node_impl.hpp:69
rclcpp::Node::SharedPtr create_sub_node(const std::string &sub_namespace)
Create a sub-node, which will extend the namespace of all entities created with it.
Structure containing optional configuration for Publishers.
Definition: publisher_options.hpp:47
rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr get_node_topics_interface()
Return the Node's internal NodeTopicsInterface implementation.
Structure containing optional configuration for Subscriptions.
Definition: subscription_options.hpp:46
void set_parameter_if_not_set(const std::string &name, const ParameterT &value)
Set one parameter, unless that parameter has already been set.
Definition: node_impl.hpp:306
rclcpp::WallTimer< CallbackT >::SharedPtr create_wall_timer(std::chrono::duration< DurationRepT, DurationT > period, CallbackT callback, rclcpp::callback_group::CallbackGroup::SharedPtr group=nullptr)
Create a timer.
Definition: node_impl.hpp:194
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
const rclcpp::ParameterValue & declare_parameter(const std::string &name, const rclcpp::ParameterValue &default_value=rclcpp::ParameterValue(), const rcl_interfaces::msg::ParameterDescriptor ¶meter_descriptor=rcl_interfaces::msg::ParameterDescriptor())
Declare and initialize a parameter, return the effective value.
size_t count_publishers(const std::string &topic_name) const
rclcpp::node_interfaces::NodeTimeSourceInterface::SharedPtr get_node_time_source_interface()
Return the Node's internal NodeParametersInterface implementation.
std::map< std::string, std::vector< std::string > > get_topic_names_and_types() const
rclcpp::node_interfaces::NodeClockInterface::SharedPtr get_node_clock_interface()
Return the Node's internal NodeClockInterface implementation.
#define RCUTILS_WARN_UNUSED
rclcpp::node_interfaces::NodeGraphInterface::SharedPtr get_node_graph_interface()
Return the Node's internal NodeGraphInterface implementation.
void undeclare_parameter(const std::string &name)
Undeclare a previously declared parameter.
rclcpp::node_interfaces::NodeParametersInterface::SharedPtr get_node_parameters_interface()
Return the Node's internal NodeParametersInterface implementation.
Store the type and value of a parameter.
Definition: parameter_value.hpp:71
std::shared_ptr< SubscriptionT > create_subscription(const std::string &topic_name, const rclcpp::QoS &qos, CallbackT &&callback, const SubscriptionOptionsWithAllocator< AllocatorT > &options=SubscriptionOptionsWithAllocator< AllocatorT >(), typename rclcpp::message_memory_strategy::MessageMemoryStrategy< typename rclcpp::subscription_traits::has_message_type< CallbackT >::type, AllocatorT >::SharedPtr msg_mem_strat=nullptr)
Create and return a Subscription.
Definition: node_impl.hpp:115
rclcpp::Parameter get_parameter(const std::string &name) const
Return the parameter by the given name.
rcl_interfaces::msg::SetParametersResult set_parameters_atomically(const std::vector< rclcpp::Parameter > ¶meters)
Set one or more parameters, all at once.
const char * get_name() const
Get the name of the node.
const char * get_namespace() const
Get the namespace of the node.
const std::vector< rclcpp::callback_group::CallbackGroup::WeakPtr > & get_callback_groups() const
Return the list of callback groups in the node.
std::vector< rclcpp::Parameter > get_parameters(const std::vector< std::string > &names) const
Return the parameters by the given parameter names.
std::map< std::string, std::vector< std::string > > get_service_names_and_types() const
Node is the single point of entry for creating publishers and subscribers.
Definition: node.hpp:72
rcl_interfaces::msg::ListParametersResult list_parameters(const std::vector< std::string > &prefixes, uint64_t depth) const
Return a list of parameters with any of the given prefixes, up to the given depth.
const std::string & get_effective_namespace() const
Return the effective namespace that is used when creating entities.
void wait_for_graph_change(rclcpp::Event::SharedPtr event, std::chrono::nanoseconds timeout)
Wait for a graph event to occur by waiting on an Event to become set.
Node(const std::string &node_name, const NodeOptions &options=NodeOptions())
Create a new node with the specified name.
rclcpp::Service< ServiceT >::SharedPtr create_service(const std::string &service_name, CallbackT &&callback, const rmw_qos_profile_t &qos_profile=rmw_qos_profile_services_default, rclcpp::callback_group::CallbackGroup::SharedPtr group=nullptr)
Definition: node_impl.hpp:233
rclcpp::node_interfaces::NodeWaitablesInterface::SharedPtr get_node_waitables_interface()
Return the Node's internal NodeWaitablesInterface implementation.