15 #ifndef RCLCPP__NODE_HPP_ 16 #define RCLCPP__NODE_HPP_ 19 #include <condition_variable> 31 #include "rcl_interfaces/msg/list_parameters_result.hpp" 32 #include "rcl_interfaces/msg/parameter_descriptor.hpp" 33 #include "rcl_interfaces/msg/parameter_event.hpp" 34 #include "rcl_interfaces/msg/set_parameters_result.hpp" 81 bool use_intra_process_comms =
false);
99 rclcpp::Context::SharedPtr context,
102 bool use_global_arguments =
true,
103 bool use_intra_process_comms =
false,
104 bool start_parameter_services =
true);
129 rclcpp::callback_group::CallbackGroup::SharedPtr
149 const std::string & topic_name,
size_t qos_history_depth,
192 CallbackT && callback,
194 rclcpp::callback_group::CallbackGroup::SharedPtr group =
nullptr,
195 bool ignore_local_publications =
false,
198 msg_mem_strat =
nullptr,
225 CallbackT && callback,
226 size_t qos_history_depth,
227 rclcpp::callback_group::CallbackGroup::SharedPtr group =
nullptr,
228 bool ignore_local_publications =
false,
231 msg_mem_strat =
nullptr,
240 template<
typename DurationT = std::milli,
typename CallbackT>
245 rclcpp::callback_group::CallbackGroup::SharedPtr group =
nullptr);
248 template<
typename ServiceT>
253 rclcpp::callback_group::CallbackGroup::SharedPtr group =
nullptr);
256 template<
typename ServiceT,
typename CallbackT>
260 CallbackT && callback,
262 rclcpp::callback_group::CallbackGroup::SharedPtr group =
nullptr);
269 rcl_interfaces::msg::SetParametersResult
272 template<
typename ParameterT>
276 const ParameterT & value);
300 template<
typename ParameterT>
315 template<
typename ParameterT>
320 const ParameterT & alternative_value)
const;
331 rcl_interfaces::msg::ListParametersResult
340 template<
typename CallbackT>
366 rclcpp::Event::SharedPtr
380 rclcpp::Event::SharedPtr event,
384 rclcpp::Clock::SharedPtr
393 rclcpp::node_interfaces::NodeBaseInterface::SharedPtr
398 rclcpp::node_interfaces::NodeClockInterface::SharedPtr
403 rclcpp::node_interfaces::NodeGraphInterface::SharedPtr
408 rclcpp::node_interfaces::NodeTimersInterface::SharedPtr
413 rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr
418 rclcpp::node_interfaces::NodeServicesInterface::SharedPtr
423 rclcpp::node_interfaces::NodeParametersInterface::SharedPtr
431 group_in_node(callback_group::CallbackGroup::SharedPtr group);
433 rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base_;
434 rclcpp::node_interfaces::NodeGraphInterface::SharedPtr node_graph_;
435 rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr node_logging_;
436 rclcpp::node_interfaces::NodeTimersInterface::SharedPtr node_timers_;
437 rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr node_topics_;
438 rclcpp::node_interfaces::NodeServicesInterface::SharedPtr node_services_;
439 rclcpp::node_interfaces::NodeParametersInterface::SharedPtr node_parameters_;
440 rclcpp::node_interfaces::NodeClockInterface::SharedPtr node_clock_;
442 bool use_intra_process_comms_;
447 #ifndef RCLCPP__NODE_IMPL_HPP_ 452 #endif // RCLCPP__NODE_HPP_
rclcpp::node_interfaces::NodeGraphInterface::SharedPtr get_node_graph_interface()
Return the Node's internal NodeGraphInterface implementation.
rclcpp::node_interfaces::NodeServicesInterface::SharedPtr get_node_services_interface()
Return the Node's internal NodeServicesInterface implementation.
Subscription implementation, templated on the type of message this subscription receives.
Definition: subscription.hpp:147
const char * get_name() const
Get the name of the node.
A publisher publishes messages of any type to a topic.
Definition: publisher.hpp:155
Generic timer templated on the clock type. Periodically executes a user-specified callback...
Definition: timer.hpp:105
rclcpp::Event::SharedPtr get_graph_event()
Return a graph event, which will be set anytime a graph change occurs.
#define RCLCPP_DISABLE_COPY(...)
Definition: macros.hpp:26
rclcpp::WallTimer< CallbackT >::SharedPtr create_wall_timer(std::chrono::duration< int64_t, DurationT > period, CallbackT callback, rclcpp::callback_group::CallbackGroup::SharedPtr group=nullptr)
Create a timer.
Definition: node_impl.hpp:156
rclcpp::node_interfaces::NodeTimersInterface::SharedPtr get_node_timers_interface()
Return the Node's internal NodeTimersInterface implementation.
const char * get_namespace() const
Get the namespace of the node.
std::shared_ptr< PublisherT > create_publisher(const std::string &topic_name, size_t qos_history_depth, std::shared_ptr< Alloc > allocator=nullptr)
Create and return a Publisher.
Definition: node_impl.hpp:56
std::vector< rclcpp::Parameter > get_parameters(const std::vector< std::string > &names) const
rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr get_node_topics_interface()
Return the Node's internal NodeTopicsInterface implementation.
const std::vector< rclcpp::callback_group::CallbackGroup::WeakPtr > & get_callback_groups() const
Return the list of callback groups in the node.
size_t count_publishers(const std::string &topic_name) const
CallbackGroupType
Definition: callback_group.hpp:43
Definition: client.hpp:118
size_t count_subscribers(const std::string &topic_name) const
rcl_interfaces::msg::SetParametersResult set_parameters_atomically(const std::vector< rclcpp::Parameter > ¶meters)
rclcpp::Clock::SharedPtr get_clock()
Definition: allocator_common.hpp:24
Definition: logger.hpp:63
std::vector< rcl_interfaces::msg::ParameterDescriptor > describe_parameters(const std::vector< std::string > &names) const
Structure to store an arbitrary parameter with templated get/set methods.
Definition: parameter.hpp:32
bool get_parameter_or(const std::string &name, ParameterT &value, const ParameterT &alternative_value) const
Get the parameter value, or the "alternative value" if not set, and assign it to "value".
Definition: node_impl.hpp:241
void set_parameter_if_not_set(const std::string &name, const ParameterT &value)
Definition: node_impl.hpp:214
std::vector< uint8_t > get_parameter_types(const std::vector< std::string > &names) const
void register_param_change_callback(CallbackT &&callback)
Register the callback for parameter changes.
Definition: node_impl.hpp:207
std::shared_ptr< SubscriptionT > create_subscription(const std::string &topic_name, CallbackT &&callback, const rmw_qos_profile_t &qos_profile=rmw_qos_profile_default, rclcpp::callback_group::CallbackGroup::SharedPtr group=nullptr, bool ignore_local_publications=false, typename rclcpp::message_memory_strategy::MessageMemoryStrategy< typename rclcpp::subscription_traits::has_message_type< CallbackT >::type, Alloc >::SharedPtr msg_mem_strat=nullptr, std::shared_ptr< Alloc > allocator=nullptr)
Create and return a Subscription.
Definition: node_impl.hpp:91
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
std::map< std::string, std::vector< std::string > > get_topic_names_and_types() const
rclcpp::Logger get_logger() const
Get the logger of the node.
Definition: service.hpp:88
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.
Default allocation strategy for messages received by subscriptions.
Definition: message_memory_strategy.hpp:38
Node is the single point of entry for creating publishers and subscribers.
Definition: node.hpp:65
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
rclcpp::node_interfaces::NodeParametersInterface::SharedPtr get_node_parameters_interface()
Return the Node's internal NodeParametersInterface implementation.
Node(const std::string &node_name, const std::string &namespace_="", bool use_intra_process_comms=false)
Create a new node with the specified name.
rclcpp::node_interfaces::NodeBaseInterface::SharedPtr get_node_base_interface()
Return the Node's internal NodeBaseInterface implementation.
rclcpp::callback_group::CallbackGroup::SharedPtr create_callback_group(rclcpp::callback_group::CallbackGroupType group_type)
Create and return a callback group.
std::map< std::string, std::vector< std::string > > get_service_names_and_types() const
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)
rcl_interfaces::msg::ListParametersResult list_parameters(const std::vector< std::string > &prefixes, uint64_t depth) const
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:194
rclcpp::Parameter get_parameter(const std::string &name) const
rclcpp::node_interfaces::NodeClockInterface::SharedPtr get_node_clock_interface()
Return the Node's internal NodeClockInterface implementation.
std::vector< rcl_interfaces::msg::SetParametersResult > set_parameters(const std::vector< rclcpp::Parameter > ¶meters)