## 6 Conclusions  
Cities are a challenging environment for Autonomous Vehicles (AVs). In particular, they are complex and chaotic environments that require advanced control to ensure maximum safety. One of the solutions proposed by the scientific community to control AVs at intersections is Autonomous Intersection Management (AIM). AIM is based on communication between AVs and a control entity located at each intersection to obtain a joint control policy that improves the intersection flow. However, the vast majority of AIMs ignore the latency that may exist in the communication channel, which poses a great safety vulnerability and a high risk of accidents. The main contribution of this work is the development of a latency-aware AIM for 5G communication networks integrally trained by Multi-Agent Deep Reinforcement Learning (MADRL). Our proposal uses a MADRL algorithm with centralized training and centralized execution and a network latency forecasting module to obtain an advanced control policy to ensure control security and reduce traffic congestion. In addition, our proposal uses a novel latency predictor module that employs a Transformer-based deep neural network. This is the first latency-aware AIM fully trained by MADRL. When we say latency-aware, we mean that our proposal adapts the control of the AVs to the inherent latency of the 5G network, thus providing traffic security and fluidity. The system was named AIM5 LA, and beyond considering the latency history experienced, AIM5 LA predicts future latency behavior to provide better security and improve traffic flow through the latency predictor module. AIM5 LA was compared with other AIMs [25] as well as other advanced traffic light-based control techniques such as iREDVD [2]. Unlike prior AIM proposals, the results demonstrated AIM5 LA's strong robustness against collisions, fully eliminating them. First, the latency prediction module was able to obtain surprising results, achieving an RMSE of less than 0.4. This allowed it to predict with high accuracy the latency that an AV would suffer during the next control interval. When comparing AIM5 LA with traditional traffic-light based control techniques, AIM5 LA is able to reduce the time loss by 92%, as well as the waiting time by more than 99%. Furthermore, compared to advanced adaptive traffic light control techniques such as iREDVD, AIM5 LA was able to reduce time loss by 84.51% and achieve a significant reduction in other metrics such as time loss (84.51%), waiting time (99.25%), fuel consumption (35.67%), or pollutant gas emissions (48.50%). Moreover, observing the results obtained with AIM5 LA during the ablation study (v0.1 and v0.2), it is possible to observe the contributions of the different modules developed, as well as the importance of considering them in different metrics such as travel time, number of collisions, etc. More specifically, only the full version of AIM5 LA can eliminate crashes in the test scenario. The most important lessons learned during this work included the importance of the latency prediction module to eliminate collisions, as well as the importance of using centralized training and end-to-end multi-agent deep reinforcement learning algorithms, with excellent action space exploration, to obtain high efficiency in future AIM systems. In future work, the forthcoming 6G architecture will be considered, as well as the inclusion of unmanned aerial nodes to reduce communication latency and analyze performance in a real 5G system. Conceptualization, G.-P.A. and C.M.-D.; methodology, G.-P.A. and C.M.-D.; software, G.-P.A. and C.M.-D.; validation, G.-P.A. and C.M.-D.; formal analysis, G.-P.A. and C.M.-D.; investigation, G.-P.A. and C.M.-D.; writing--original draft preparation, G.-P.A. and C.M.-D.; writing--review and editing, G.-P.A. and C.M.-D.; visualization, G.-P.A. ; supervision, C.M.-D.; funding acquisition, G.-P.A. and C.M.-D. All authors have read and agreed to the published version of the manuscript.