Avoid notification of green-yellow state to TM vehicles

This commit is contained in:
Joel Moriana 2022-07-18 17:37:34 +02:00 committed by glopezdiest
parent 24e07a31f2
commit c242104c28
1 changed files with 8 additions and 0 deletions

View File

@ -43,6 +43,14 @@ void SimulationState::UpdateKinematicHybridEndLocation(ActorId actor_id, cg::Loc
}
void SimulationState::UpdateTrafficLightState(ActorId actor_id, TrafficLightState state) {
// The green-yellow state transition is not notified to the vehicle. This is done to avoid
// having vehicles stopped very near the intersection when only the rear part of the vehicle
// is colliding with the trigger volume of the traffic light.
auto previous_tl_state = GetTLS(actor_id);
if (previous_tl_state.at_traffic_light && previous_tl_state.tl_state == TLS::Green) {
state.tl_state = TLS::Green;
}
tl_state_map.at(actor_id) = state;
}