|
30 | 30 | #include <autoware_utils/ros/uuid_helper.hpp>
|
31 | 31 |
|
32 | 32 | #include <autoware_perception_msgs/msg/detected_objects.hpp>
|
| 33 | +#include <diagnostic_msgs/msg/diagnostic_status.hpp> |
33 | 34 | #include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
|
34 | 35 |
|
35 | 36 | #include <boost/geometry.hpp>
|
|
50 | 51 | #include <functional>
|
51 | 52 | #include <limits>
|
52 | 53 | #include <memory>
|
| 54 | +#include <sstream> |
53 | 55 | #include <string>
|
54 | 56 | #include <utility>
|
55 | 57 | #include <vector>
|
@@ -497,6 +499,11 @@ MapBasedPredictionNode::MapBasedPredictionNode(const rclcpp::NodeOptions & node_
|
497 | 499 | time_keeper_ = std::make_shared<autoware_utils::TimeKeeper>(time_keeper);
|
498 | 500 | path_generator_->setTimeKeeper(time_keeper_);
|
499 | 501 | predictor_vru_->setTimeKeeper(time_keeper_);
|
| 502 | + |
| 503 | + // diagnostics handler |
| 504 | + diagnostics_interface_ptr_ = |
| 505 | + std::make_unique<autoware_utils::DiagnosticsInterface>(this, "map_based_prediction"); |
| 506 | + processing_time_tolerance_ms_ = declare_parameter<double>("processing_time_tolerance_ms"); |
500 | 507 | }
|
501 | 508 |
|
502 | 509 | if (use_debug_marker) {
|
@@ -671,6 +678,18 @@ void MapBasedPredictionNode::objectsCallback(const TrackedObjects::ConstSharedPt
|
671 | 678 | "debug/cyclic_time_ms", cyclic_time_ms);
|
672 | 679 | processing_time_publisher_->publish<autoware_internal_debug_msgs::msg::Float64Stamped>(
|
673 | 680 | "debug/processing_time_ms", processing_time_ms);
|
| 681 | + |
| 682 | + diagnostics_interface_ptr_->clear(); |
| 683 | + bool is_processing_time_ok = processing_time_ms > processing_time_tolerance_ms_; |
| 684 | + diagnostics_interface_ptr_->add_key_value("is_processing_time_ok", is_processing_time_ok); |
| 685 | + if (is_processing_time_ok) { |
| 686 | + std::ostringstream oss; |
| 687 | + oss << "Processing time exceeded " << processing_time_tolerance_ms_ << "[ms] < " |
| 688 | + << processing_time_ms << "[ms]"; |
| 689 | + diagnostics_interface_ptr_->update_level_and_message( |
| 690 | + diagnostic_msgs::msg::DiagnosticStatus::WARN, oss.str()); |
| 691 | + } |
| 692 | + diagnostics_interface_ptr_->publish(output.header.stamp); |
674 | 693 | }
|
675 | 694 | }
|
676 | 695 |
|
|
0 commit comments