diff --git a/rclcpp/include/rclcpp/time_source.hpp b/rclcpp/include/rclcpp/time_source.hpp index 6f5280572a..4913c15e2b 100644 --- a/rclcpp/include/rclcpp/time_source.hpp +++ b/rclcpp/include/rclcpp/time_source.hpp @@ -142,6 +142,9 @@ class TimeSource // Store (and update on node attach) logger for logging. Logger logger_; + // Fully qualified node name + const char * node_name_; + // QoS of the clock subscription. rclcpp::QoS qos_; diff --git a/rclcpp/src/rclcpp/time_source.cpp b/rclcpp/src/rclcpp/time_source.cpp index a958629e31..9b03d10c26 100644 --- a/rclcpp/src/rclcpp/time_source.cpp +++ b/rclcpp/src/rclcpp/time_source.cpp @@ -84,6 +84,7 @@ void TimeSource::attachNode( node_parameters_ = node_parameters_interface; // TODO(tfoote): Update QOS + node_name_ = node_base_->get_fully_qualified_name(); logger_ = node_logging_->get_logger(); // Though this defaults to false, it can be overridden by initial parameter values for the node, @@ -297,7 +298,7 @@ void TimeSource::destroy_clock_sub() void TimeSource::on_parameter_event(const rcl_interfaces::msg::ParameterEvent::SharedPtr event) { // Filter out events on 'use_sim_time' parameter instances in other nodes. - if (event->node != node_base_->get_fully_qualified_name()) { + if (event->node != node_name_) { return; } // Filter for only 'use_sim_time' being added or changed.