Class GenericSubscription

Inheritance Relationships

Base Type

  • public rclcpp::GenericSubscription

Class Documentation

class GenericSubscription : public rclcpp::GenericSubscription

Public Functions

template<typename AllocatorT = ::std::allocator<void>>
inline GenericSubscription(::rclcpp::node_interfaces::NodeBaseInterface *node_base, const ::std::shared_ptr<::rcpputils::SharedLibrary> ts_lib, const ::std::string &topic_name, const ::std::string &topic_type, const ::rclcpp::QoS &qos, ::rclcpp::AnySubscriptionCallback<::rclcpp::SerializedMessage, AllocatorT> callback, const ::rclcpp::SubscriptionOptionsWithAllocator<AllocatorT> &options, ::std::shared_ptr<::rclcpp::topic_statistics::SubscriptionTopicStatistics> subscription_topic_stats = nullptr)

Constructor.

In order to properly subscribe to a topic, this subscription needs to be added to the node_topic_interface of the node passed into this constructor.

See also

cras::create_generic_subscription() for creating an instance of this class and adding it to the node_topic_interface.

Parameters:
  • node_base[in] Pointer to parent node’s NodeBaseInterface

  • ts_lib[in] Type support library, needs to correspond to topic_type

  • 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] Subscription options.

  • subscription_topic_stats[in] Optional pointer to a topic statistics subscription. Not all subscription options are currently respected, the only relevant options for this subscription are event_callbacks, use_default_callbacks, ignore_local_publications, topic_statistics and callback_group.

inline void handle_serialized_message(const ::std::shared_ptr<::rclcpp::SerializedMessage> &serialized_message, const ::rclcpp::MessageInfo &message_info) override

Protected Attributes

::std::shared_ptr<::rclcpp::topic_statistics::SubscriptionTopicStatistics> subscription_topic_statistics = {nullptr}

Component which computes and publishes topic statistics for this subscriber.

::rclcpp::AnySubscriptionCallback<::rclcpp::SerializedMessage, ::std::allocator<void>> any_callback

The callback to call when a message is received.