@@ -166,7 +166,7 @@ using intersection::make_ok;
166
166
using intersection::Result;
167
167
168
168
Result<IntersectionModule::BasicData, intersection::InternalError>
169
- IntersectionModule::prepareIntersectionData (const bool is_prioritized, PathWithLaneId * path)
169
+ IntersectionModule::prepareIntersectionData (PathWithLaneId * path)
170
170
{
171
171
const auto lanelet_map_ptr = planner_data_->route_handler_ ->getLaneletMapPtr ();
172
172
const auto routing_graph_ptr = planner_data_->route_handler_ ->getRoutingGraphPtr ();
@@ -175,6 +175,18 @@ IntersectionModule::prepareIntersectionData(const bool is_prioritized, PathWithL
175
175
const auto footprint = planner_data_->vehicle_info_ .createFootprint (0.0 , 0.0 );
176
176
const auto & current_pose = planner_data_->current_odometry ->pose ;
177
177
178
+ // ==========================================================================================
179
+ // update traffic light information
180
+ // updateTrafficSignalObservation() must be called at first because other traffic signal
181
+ // fuctions use last_valid_observation_
182
+ // ==========================================================================================
183
+ // save previous information before calling updateTrafficSignalObservation()
184
+ previous_prioritized_level_ = getTrafficPrioritizedLevel ();
185
+ updateTrafficSignalObservation ();
186
+ const auto traffic_prioritized_level = getTrafficPrioritizedLevel ();
187
+ const bool is_prioritized =
188
+ traffic_prioritized_level == TrafficPrioritizedLevel::FULLY_PRIORITIZED;
189
+
178
190
// spline interpolation
179
191
const auto interpolated_path_info_opt = util::generateInterpolatedPath (
180
192
lane_id_, associative_ids_, *path, planner_param_.common .path_interpolation_ds , logger_);
@@ -264,13 +276,7 @@ IntersectionModule::prepareIntersectionData(const bool is_prioritized, PathWithL
264
276
planner_data_->occupancy_grid ->info .resolution );
265
277
}
266
278
267
- // ==========================================================================================
268
- // update traffic light information
269
- // updateTrafficSignalObservation() must be called at first to because other traffic signal
270
- // fuctions use last_valid_observation_
271
- // ==========================================================================================
272
279
if (has_traffic_light_) {
273
- updateTrafficSignalObservation ();
274
280
const bool is_green_solid_on = isGreenSolidOn ();
275
281
if (is_green_solid_on && !initial_green_light_observed_time_) {
276
282
const auto assigned_lane_begin_point = assigned_lanelet.centerline ().front ();
0 commit comments