Template Function rclcpp::create_generic_publisher

Function Documentation

template<typename AllocatorT = std::allocator<void>>
std::shared_ptr<GenericPublisher> rclcpp::create_generic_publisher(rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr topics_interface, const std::string &topic_name, const std::string &topic_type, const rclcpp::QoS &qos, const rclcpp::PublisherOptionsWithAllocator<AllocatorT> &options = (rclcpp::PublisherOptionsWithAllocator<AllocatorT>()))

Create and return a GenericPublisher.

The returned pointer will never be empty, but this function can throw various exceptions, for instance when the message’s package can not be found on the AMENT_PREFIX_PATH.

Parameters:
  • topics_interface – NodeTopicsInterface pointer used in parts of the setup

  • topic_name – Topic name

  • topic_type – Topic type

  • qos – QoS settings

  • options – Publisher options. Not all publisher options are currently respected, the only relevant options for this publisher are event_callbacks, use_default_callbacks, and callback_group.