Skip to content

Commit f12e3c6

Browse files
authored
set QoS History KEEP_ALL explicitly for statistics publisher. (#2650)
* set QoS History KEEP_ALL explicitly for statistics publisher. Signed-off-by: Tomoya Fujita <[email protected]> * test_subscription_options adjustment. Signed-off-by: Tomoya Fujita <[email protected]> --------- Signed-off-by: Tomoya Fujita <[email protected]>
1 parent bcc1475 commit f12e3c6

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

rclcpp/include/rclcpp/subscription_options.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ struct SubscriptionOptionsBase
8080

8181
// An optional QoS which can provide topic_statistics with a stable QoS separate from
8282
// the subscription's current QoS settings which could be unstable.
83-
rclcpp::QoS qos = SystemDefaultsQoS();
83+
// Explicitly set the enough depth to avoid missing the statistics messages.
84+
rclcpp::QoS qos = SystemDefaultsQoS().keep_last(10);
8485
};
8586

8687
TopicStatisticsOptions topic_stats_options;

rclcpp/test/rclcpp/test_subscription_options.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ TEST_F(TestSubscriptionOptions, topic_statistics_options_default_and_set) {
6565
EXPECT_EQ(options.topic_stats_options.state, rclcpp::TopicStatisticsState::NodeDefault);
6666
EXPECT_EQ(options.topic_stats_options.publish_topic, defaultPublishTopic);
6767
EXPECT_EQ(options.topic_stats_options.publish_period, 1s);
68-
EXPECT_EQ(options.topic_stats_options.qos, rclcpp::SystemDefaultsQoS());
68+
EXPECT_EQ(options.topic_stats_options.qos, rclcpp::SystemDefaultsQoS().keep_last(10));
6969

7070
options.topic_stats_options.state = rclcpp::TopicStatisticsState::Enable;
7171
options.topic_stats_options.publish_topic = "topic_statistics";

0 commit comments

Comments
 (0)