rclcpp
master
C++ ROS Client Library API
|
Go to the documentation of this file.
15 #ifndef RCLCPP__CREATE_PUBLISHER_HPP_
16 #define RCLCPP__CREATE_PUBLISHER_HPP_
43 typename NodeParametersT,
47 NodeParametersT & node_parameters,
48 NodeTopicsT & node_topics,
57 const rclcpp::QoS & actual_qos = options.qos_overriding_options.get_policy_kinds().size() ?
59 options.qos_overriding_options, node_parameters,
60 node_topics_interface->resolve_topic_name(topic_name),
65 auto pub = node_topics_interface->create_publisher(
67 rclcpp::create_publisher_factory<MessageT, AllocatorT, PublisherT>(options),
72 node_topics_interface->add_publisher(pub, options.callback_group);
74 return std::dynamic_pointer_cast<PublisherT>(pub);
103 return detail::create_publisher<MessageT, AllocatorT, PublisherT>(
104 node, node, topic_name, qos, options);
114 rclcpp::node_interfaces::NodeParametersInterface::SharedPtr & node_parameters,
115 rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr & node_topics,
123 return detail::create_publisher<MessageT, AllocatorT, PublisherT>(
124 node_parameters, node_topics, topic_name, qos, options);
129 #endif // RCLCPP__CREATE_PUBLISHER_HPP_
A publisher publishes messages of any type to a topic.
Definition: publisher.hpp:53
std::shared_ptr< PublisherT > create_publisher(NodeT &node, const std::string &topic_name, const rclcpp::QoS &qos, const rclcpp::PublisherOptionsWithAllocator< AllocatorT > &options=(rclcpp::PublisherOptionsWithAllocator< AllocatorT >()))
Create and return a publisher of the given MessageT type.
Definition: create_publisher.hpp:94
std::enable_if_t< rclcpp::node_interfaces::has_node_parameters_interface< decltype(std::declval< typename rcpputils::remove_pointer< NodeT >::type >))>::value||std::is_same< typename std::decay_t< NodeT >, rclcpp::node_interfaces::NodeParametersInterface::SharedPtr >::value, rclcpp::QoS > declare_qos_parameters(const ::rclcpp::QosOverridingOptions &options, NodeT &node, const std::string &topic_name, const ::rclcpp::QoS &default_qos, EntityQosParametersTraits)
Definition: qos_parameters.hpp:126
std::shared_ptr< PublisherT > create_publisher(NodeParametersT &node_parameters, NodeTopicsT &node_topics, const std::string &topic_name, const rclcpp::QoS &qos, const rclcpp::PublisherOptionsWithAllocator< AllocatorT > &options=(rclcpp::PublisherOptionsWithAllocator< AllocatorT >()))
Create and return a publisher of the given MessageT type.
Definition: create_publisher.hpp:46
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
Encapsulation of Quality of Service settings.
Definition: qos.hpp:110
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
Structure containing optional configuration for Publishers.
Definition: publisher_options.hpp:65
Definition: qos_parameters.hpp:42