Template Class SubscriptionTopicStatistics
Defined in File subscription_topic_statistics.hpp
Class Documentation
-
template<typename CallbackMessageT>
class SubscriptionTopicStatistics Class used to collect, measure, and publish topic statistics data. Current statistics supported for subscribers are received message age and received message period.
- Template Parameters:
CallbackMessageT – the subscribed message type
Public Functions
Construct a SubscriptionTopicStatistics object.
This object wraps utilities, defined in libstatistics_collector, to collect, measure, and publish topic statistics data. This throws an invalid_argument if the input publisher is null.
- Parameters:
node_name – the name of the node, which created this instance, in order to denote topic source
publisher – instance constructed by the node in order to publish statistics data. This class owns the publisher.
- Throws:
std::invalid_argument – if publisher pointer is nullptr
-
inline virtual ~SubscriptionTopicStatistics()
-
inline virtual void handle_message(const CallbackMessageT &received_message, const rclcpp::Time now_nanoseconds) const
Handle a message received by the subscription to collect statistics.
This method acquires a lock to prevent race conditions to collectors list.
- Parameters:
received_message – the message received by the subscription
now_nanoseconds – current time in nanoseconds
Set the timer used to publish statistics messages.
- Parameters:
publisher_timer – the timer to fire the publisher, created by the node
-
inline virtual void publish_message_and_reset_measurements()
Publish a populated MetricsStatisticsMessage.
This method acquires a lock to prevent race conditions to collectors list.
Protected Functions
-
inline std::vector<StatisticData> get_current_collector_data() const
Return a vector of all the currently collected data.
This method acquires a lock to prevent race conditions to collectors list.
- Returns:
a vector of all the collected data