Template Function cras::create_generic_subscription(::rclcpp::node_interfaces::NodeParametersInterface::SharedPtr, ::rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr, const ::std::string&, const ::std::string&, const ::rclcpp::QoS&, CallbackT&&, const ::rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&)

Function Documentation

template<typename CallbackT, typename AllocatorT = ::std::allocator<void>>
::std::shared_ptr<::cras::GenericSubscription> cras::create_generic_subscription(::rclcpp::node_interfaces::NodeParametersInterface::SharedPtr parameters_interface, ::rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr topics_interface, const ::std::string &topic_name, const ::std::string &topic_type, const ::rclcpp::QoS &qos, CallbackT &&callback, const ::rclcpp::SubscriptionOptionsWithAllocator<AllocatorT> &options = {})

Create and return a GenericSubscription which can handle topic statistics.

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:
  • parameters_interface[in] NodeParametersInterface pointer used in parts of the setup.

  • topics_interface[in] NodeTopicsInterface pointer used in parts of the setup.

  • topic_name[in] Topic name

  • topic_type[in] Topic type

  • qos[in] QoS settings

  • callback[in] Callback for new messages of serialized form

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