ROS 2 rclcpp + rcl - rolling
rolling-a919a6e5
ROS 2 C++ Client Library with ROS Client Library
|
#include <rclcpp/topic_statistics/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 void | handle_message (const rmw_message_info_t &message_info, 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.
Definition at line 52 of file subscription_topic_statistics.hpp.
|
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 |
Definition at line 71 of file subscription_topic_statistics.hpp.
|
inlineprotected |
Return a vector of all the currently collected data.
This method acquires a lock to prevent race conditions to collectors list.
Definition at line 156 of file subscription_topic_statistics.hpp.
|
inlinevirtual |
Handle a message received by the subscription to collect statistics.
This method acquires a lock to prevent race conditions to collectors list.
message_info | the message info corresponding to the received message |
now_nanoseconds | current time in nanoseconds |
Definition at line 98 of file subscription_topic_statistics.hpp.
References rclcpp::Time::nanoseconds().
|
inlinevirtual |
Publish a populated MetricsStatisticsMessage.
This method acquires a lock to prevent race conditions to collectors list.
Definition at line 121 of file subscription_topic_statistics.hpp.
References rclcpp::Publisher< MessageT, AllocatorT >::publish().
|
inline |
Set the timer used to publish statistics messages.
publisher_timer | the timer to fire the publisher, created by the node |
Definition at line 112 of file subscription_topic_statistics.hpp.