From b28222bafa80e4332388fdac84fce675d664e0a4 Mon Sep 17 00:00:00 2001 From: Shohei Sakai Date: Fri, 6 Dec 2024 22:19:19 +0900 Subject: [PATCH] ignore pedestrian traffic light prediction if it is unknown --- .../src/node.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/perception/autoware_crosswalk_traffic_light_estimator/src/node.cpp b/perception/autoware_crosswalk_traffic_light_estimator/src/node.cpp index 2c4da0b95b161..180dfd6afa5ee 100644 --- a/perception/autoware_crosswalk_traffic_light_estimator/src/node.cpp +++ b/perception/autoware_crosswalk_traffic_light_estimator/src/node.cpp @@ -292,7 +292,15 @@ void CrosswalkTrafficLightEstimatorNode::setCrosswalkTrafficSignal( for (const auto & tl_reg_elem : tl_reg_elems) { auto id = tl_reg_elem->id(); // if valid prediction exists, overwrite the estimation; else, use the estimation + bool valid_prediction = false; if (valid_id2idx_map.count(id)) { + size_t idx = valid_id2idx_map[id]; + auto signal = msg.traffic_light_groups[idx]; + if (output.traffic_light_groups[idx].elements[0].color != TrafficSignalElement::UNKNOWN){ + valid_prediction = true; + } + } + if (valid_prediction) { size_t idx = valid_id2idx_map[id]; auto signal = msg.traffic_light_groups[idx]; updateFlashingState(signal); // check if it is flashing