File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -2322,6 +2322,10 @@ std::vector<std::string> ControllerManager::get_controller_names()
23222322
23232323void ControllerManager::read (const rclcpp::Time & time, const rclcpp::Duration & period)
23242324{
2325+ if (periodicity_stats_.GetCount () >= 100 )
2326+ {
2327+ periodicity_stats_.Reset ();
2328+ }
23252329 periodicity_stats_.AddMeasurement (1.0 / period.seconds ());
23262330 auto [ok, failed_hardware_names] = resource_manager_->read (time, period);
23272331
@@ -3347,6 +3351,7 @@ void ControllerManager::controller_manager_diagnostic_callback(
33473351 const std::string periodicity_stat_name = " periodicity" ;
33483352 const auto cm_stats = periodicity_stats_.GetStatistics ();
33493353 stat.add (" update_rate" , std::to_string (get_update_rate ()));
3354+ stat.add (periodicity_stat_name + " .sample_count" , std::to_string (cm_stats.sample_count ));
33503355 stat.add (periodicity_stat_name + " .average" , std::to_string (cm_stats.average ));
33513356 stat.add (
33523357 periodicity_stat_name + " .standard_deviation" , std::to_string (cm_stats.standard_deviation ));
You can’t perform that action at this time.
0 commit comments