|
13 | 13 | // limitations under the License.
|
14 | 14 | #include "traffic_light_classifier_node.hpp"
|
15 | 15 |
|
| 16 | +#include <diagnostic_msgs/msg/diagnostic_status.hpp> |
16 | 17 | #include <tier4_perception_msgs/msg/traffic_light_element.hpp>
|
17 | 18 |
|
18 | 19 | #include <iostream>
|
@@ -60,6 +61,9 @@ TrafficLightClassifierNodelet::TrafficLightClassifierNodelet(const rclcpp::NodeO
|
60 | 61 | this->get_logger(), "please install CUDA, CUDNN and TensorRT to use cnn classifier");
|
61 | 62 | #endif
|
62 | 63 | }
|
| 64 | + |
| 65 | + diagnostics_interface_ptr_ = |
| 66 | + std::make_unique<autoware_utils::DiagnosticsInterface>(this, "traffic_light_classifier"); |
63 | 67 | }
|
64 | 68 |
|
65 | 69 | void TrafficLightClassifierNodelet::connectCb()
|
@@ -165,6 +169,17 @@ void TrafficLightClassifierNodelet::imageRoiCallback(
|
165 | 169 |
|
166 | 170 | output_msg.header = input_image_msg->header;
|
167 | 171 | traffic_signal_array_pub_->publish(output_msg);
|
| 172 | + |
| 173 | + // publish diagnostics |
| 174 | + diagnostics_interface_ptr_->clear(); |
| 175 | + bool found_harsh_backlight = backlight_indices.size() != 0; |
| 176 | + diagnostics_interface_ptr_->add_key_value("found_harsh_backlight", found_harsh_backlight); |
| 177 | + if (found_harsh_backlight) { |
| 178 | + diagnostics_interface_ptr_->update_level_and_message( |
| 179 | + diagnostic_msgs::msg::DiagnosticStatus::WARN, |
| 180 | + "Found harsh backlight in ROI(s) and corresponding ROI(s) were overwritten by UNKNOWN"); |
| 181 | + } |
| 182 | + diagnostics_interface_ptr_->publish(output_msg.header.stamp); |
168 | 183 | }
|
169 | 184 |
|
170 | 185 | bool TrafficLightClassifierNodelet::is_harsh_backlight(const cv::Mat & img) const
|
|
0 commit comments