From 10f89b8fabe47ce19c3b25f9a769a5105d9ac7be Mon Sep 17 00:00:00 2001 From: Rein Appeldoorn Date: Thu, 27 Jun 2024 10:12:49 +0200 Subject: [PATCH] change(diagnosed-publisher): allow specifying node clock (#340) A new clock was created for every diagnosed publisher. When running with 'use_sim_time', the /clock time was not respected. (cherry picked from commit 16b5e8a7e450003a4a64de34730c85bb56cb56ba) --- diagnostic_updater/include/diagnostic_updater/publisher.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/diagnostic_updater/include/diagnostic_updater/publisher.hpp b/diagnostic_updater/include/diagnostic_updater/publisher.hpp index d23c7fd1f..f2bdcb47a 100644 --- a/diagnostic_updater/include/diagnostic_updater/publisher.hpp +++ b/diagnostic_updater/include/diagnostic_updater/publisher.hpp @@ -226,8 +226,9 @@ class DiagnosedPublisher : public TopicDiagnostic const typename PublisherT::SharedPtr & pub, diagnostic_updater::Updater & diag, const diagnostic_updater::FrequencyStatusParam & freq, - const diagnostic_updater::TimeStampStatusParam & stamp) - : TopicDiagnostic(pub->get_topic_name(), diag, freq, stamp), + const diagnostic_updater::TimeStampStatusParam & stamp, + const rclcpp::Clock::SharedPtr & clock = std::make_shared()) + : TopicDiagnostic(pub->get_topic_name(), diag, freq, stamp, clock), publisher_(pub) { static_assert(has_header::value, "Message type has to have a header.");