Class SubscriptionManager

Class Documentation

class SubscriptionManager

Public Functions

inline SubscriptionManager()
template<typename MessageT>
inline void add_subscription(const std::string &topic_name, size_t expected_number_of_messages, const rclcpp::QoS &qos = rclcpp::QoS{rmw_qos_profile_default.depth})
template<typename MessageT>
inline std::vector<std::shared_ptr<MessageT>> get_received_messages(const std::string &topic_name)
template<typename Timeout>
inline bool spin_and_wait_for_matched(const std::vector<rclcpp::PublisherBase*> &publishers, Timeout timeout, size_t n_subscribers_to_match = 1)

Wait until publishers will be connected to the subscribers or timeout occur.

Template Parameters:

Timeout – Data type for timeout duration from std::chrono:: namespace

Parameters:
  • publishers – List of raw pointers to the publishers

  • timeout – Maximum time duration during which discovery should happen.

  • n_subscribers_to_match – Number of subscribers each publisher should have for match.

Returns:

true if publishers have specified number of subscribers, otherwise false.

inline std::future<void> spin_subscriptions()
inline void spin_subscriptions_sync()