Class PublicationManager

Class Documentation

class PublicationManager

Public Functions

inline PublicationManager()
template<class MsgT>
inline void setup_publisher(const std::string &topic_name, const std::shared_ptr<MsgT> message, const size_t repetition, const rclcpp::QoS &qos = rclcpp::QoS{rclcpp::KeepAll()}, const std::chrono::milliseconds interval = 50ms)
template<class MsgT>
inline void setup_publisher(const std::string &topic_name, const MsgT &message, const size_t repetition, const rclcpp::QoS &qos = rclcpp::QoS{rclcpp::KeepAll()}, const std::chrono::milliseconds interval = 50ms)
inline void run_publishers(bool verbose = false) const
inline void run_publishers_async(bool verbose = false) const
template<typename DurationRepT = int64_t, typename DurationT = std::milli>
inline bool wait_for_matched(const char *topic_name, std::chrono::duration<DurationRepT, DurationT> timeout = std::chrono::seconds(10), size_t n_subscribers_to_match = 1)

Wait until publisher with specified topic will be connected to the subscribers or timeout occur.

Template Parameters:

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

Parameters:
  • topic_name – topic name to find corresponding publisher

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

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

Returns:

true if find publisher by specified topic_name and publisher has specified number of subscribers, otherwise false.

template<>
void setup_publisher(const std::string &topic_name, const test_msgs::msg::BasicTypes &message, const size_t repetition, const rclcpp::QoS &qos, const std::chrono::milliseconds interval)

Template specialization with test_msgs::msg::BasicTypes.

Will assign current repetition number to the message->uint64_value and timestamp from steady clock to the message->int64_value for each publishing message.