68 const auto& first_encountered_overlaps =
69 reference_line_info.FirstEncounteredOverlaps();
71 for (
const auto& overlap : first_encountered_overlaps) {
80 if (traffic_sign_overlap ==
nullptr) {
83 const std::vector<hdmap::PathOverlap>& traffic_light_overlaps =
84 reference_line_info.reference_line().map_path().signal_overlaps();
85 const double start_check_distance =
87 const double adc_front_edge_s = reference_line_info.AdcSlBoundary().end_s();
90 std::vector<hdmap::PathOverlap> next_traffic_lights;
91 static constexpr double kTrafficLightGroupingMaxDist = 2.0;
92 for (
const auto& overlap : traffic_light_overlaps) {
93 const double dist = overlap.start_s - traffic_sign_overlap->
start_s;
94 if (fabs(dist) <= kTrafficLightGroupingMaxDist) {
95 next_traffic_lights.push_back(overlap);
98 bool traffic_light_scenario =
false;
100 for (
const auto& overlap : next_traffic_lights) {
101 const double adc_distance_to_traffic_light =
102 overlap.start_s - adc_front_edge_s;
103 ADEBUG <<
"traffic_light[" << overlap.object_id <<
"] start_s["
104 << overlap.start_s <<
"] adc_distance_to_traffic_light["
105 << adc_distance_to_traffic_light <<
"]";
108 if (adc_distance_to_traffic_light <= 0.0 ||
109 adc_distance_to_traffic_light > start_check_distance) {
113 const auto& signal_color = frame.
GetSignal(overlap.object_id).
color();
114 ADEBUG <<
"traffic_light_id[" << overlap.object_id <<
"] start_s["
115 << overlap.start_s <<
"] color[" << signal_color <<
"]";
119 traffic_light_scenario =
true;
123 if (!traffic_light_scenario) {
126 const auto& turn_type =
127 reference_line_info.GetPathTurnType(traffic_sign_overlap->
start_s);
132 for (
const auto& overlap : next_traffic_lights) {
148 std::string current_traffic_light_overlap_id;
149 const auto& overlaps = reference_line_info.FirstEncounteredOverlaps();
150 for (
auto overlap : overlaps) {
152 current_traffic_light_overlap_id = overlap.second.object_id;
157 if (current_traffic_light_overlap_id.empty()) {
159 ->mutable_planning_status()
160 ->mutable_traffic_light()
162 AERROR <<
"Can not find traffic light overlap in reference line!";
167 const std::vector<apollo::hdmap::PathOverlap>& traffic_light_overlaps =
168 reference_line_info.reference_line().map_path().signal_overlaps();
169 auto traffic_light_overlap_itr = std::find_if(
170 traffic_light_overlaps.begin(), traffic_light_overlaps.end(),
172 return overlap.object_id == current_traffic_light_overlap_id;
174 if (traffic_light_overlap_itr == traffic_light_overlaps.end()) {
176 ->mutable_planning_status()
177 ->mutable_traffic_light()
182 static constexpr double kTrafficLightGroupingMaxDist = 2.0;
183 const double current_traffic_light_overlap_start_s =
184 traffic_light_overlap_itr->start_s;
185 for (
const auto& traffic_light_overlap : traffic_light_overlaps) {
187 traffic_light_overlap.start_s - current_traffic_light_overlap_start_s;
188 if (fabs(dist) <= kTrafficLightGroupingMaxDist) {
190 ->mutable_planning_status()
191 ->mutable_traffic_light()
192 ->add_current_traffic_light_overlap_id(
193 traffic_light_overlap.object_id);
194 ADEBUG <<
"Update PlanningContext with first_encountered traffic_light["
195 << traffic_light_overlap.object_id <<
"] start_s["
196 << traffic_light_overlap.start_s <<
"]";
ScenarioTrafficLightUnprotectedRightTurnConfig scenario_config
std::vector< std::string > current_traffic_light_overlap_ids