@@ -189,8 +189,12 @@ MultiObjectTracker::MultiObjectTracker(const rclcpp::NodeOptions & node_options)
189
189
}
190
190
191
191
// Debugger
192
- debugger_ = std::make_unique<TrackerDebugger>(*this , world_frame_id_, input_channels_config_);
192
+ debugger_ = std::make_unique<TrackerDebugger>(*this , world_frame_id_,input_channels_config_);
193
+
193
194
published_time_publisher_ = std::make_unique<autoware_utils::PublishedTimePublisher>(this );
195
+ // Diagnostics
196
+ diagnostics_interface_ptr_ =
197
+ std::make_unique<autoware_utils::DiagnosticsInterface>(this , " multi_object_tracker" );
194
198
}
195
199
196
200
void MultiObjectTracker::onTrigger ()
@@ -238,6 +242,17 @@ void MultiObjectTracker::onTimer()
238
242
const double maximum_publish_interval = publisher_period_ * maximum_publish_interval_ratio;
239
243
should_publish = should_publish || elapsed_time > maximum_publish_interval;
240
244
245
+ diagnostics_interface_ptr_->clear ();
246
+ diagnostics_interface_ptr_->add_key_value (" elapsed_time" , elapsed_time);
247
+ if (elapsed_time > 500e-3 ) {
248
+ std::stringstream message;
249
+ message << " MultiObjectTracker::onTimer: elapsed_time exceeds its maximum value, "
250
+ << " which may limit the predition performance." ;
251
+ diagnostics_interface_ptr_->update_level_and_message (
252
+ diagnostic_msgs::msg::DiagnosticStatus::WARN, message.str ());
253
+ }
254
+ diagnostics_interface_ptr_->publish (current_time);
255
+
241
256
// Publish with delay compensation to the current time
242
257
if (should_publish) checkAndPublish (current_time);
243
258
}
0 commit comments