rclcpp
master
C++ ROS Client Library API
|
#include <subscription_topic_statistics.hpp>
Public Member Functions | |
SubscriptionTopicStatistics (const std::string &node_name, rclcpp::Publisher< statistics_msgs::msg::MetricsMessage >::SharedPtr publisher) | |
Construct a SubscriptionTopicStatistics object. More... | |
virtual | ~SubscriptionTopicStatistics () |
virtual void | handle_message (const CallbackMessageT &received_message, const rclcpp::Time now_nanoseconds) const |
Handle a message received by the subscription to collect statistics. More... | |
void | set_publisher_timer (rclcpp::TimerBase::SharedPtr publisher_timer) |
Set the timer used to publish statistics messages. More... | |
virtual void | publish_message_and_reset_measurements () |
Publish a populated MetricsStatisticsMessage. More... | |
Protected Member Functions | |
std::vector< StatisticData > | get_current_collector_data () const |
Return a vector of all the currently collected data. More... | |
Class used to collect, measure, and publish topic statistics data. Current statistics supported for subscribers are received message age and received message period.
CallbackMessageT | the subscribed message type |
|
inline |
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.
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. |
std::invalid_argument | if publisher pointer is nullptr |
|
inlinevirtual |
|
inlinevirtual |
Handle a message received by the subscription to collect statistics.
This method acquires a lock to prevent race conditions to collectors list.
received_message | the message received by the subscription |
now_nanoseconds | current time in nanoseconds |
|
inline |
Set the timer used to publish statistics messages.
publisher_timer | the timer to fire the publisher, created by the node |
|
inlinevirtual |
Publish a populated MetricsStatisticsMessage.
This method acquires a lock to prevent race conditions to collectors list.
|
inlineprotected |
Return a vector of all the currently collected data.
This method acquires a lock to prevent race conditions to collectors list.