Skip to content

Commit 16b5e8a

Browse files
authored
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.
1 parent e67a69c commit 16b5e8a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

diagnostic_updater/include/diagnostic_updater/publisher.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,9 @@ class DiagnosedPublisher : public TopicDiagnostic
226226
const typename PublisherT::SharedPtr & pub,
227227
diagnostic_updater::Updater & diag,
228228
const diagnostic_updater::FrequencyStatusParam & freq,
229-
const diagnostic_updater::TimeStampStatusParam & stamp)
230-
: TopicDiagnostic(pub->get_topic_name(), diag, freq, stamp),
229+
const diagnostic_updater::TimeStampStatusParam & stamp,
230+
const rclcpp::Clock::SharedPtr & clock = std::make_shared<rclcpp::Clock>())
231+
: TopicDiagnostic(pub->get_topic_name(), diag, freq, stamp, clock),
231232
publisher_(pub)
232233
{
233234
static_assert(has_header<MessageT>::value, "Message type has to have a header.");

0 commit comments

Comments
 (0)