*Article* **A Hierarchical Autonomous Driver for a Racing Car: Real-Time Planning and Tracking of the Trajectory**

**Margherita Montani 1,\*, Leandro Ronchi 1, Renzo Capitani <sup>1</sup> and Claudio Annicchiarico <sup>2</sup>**


**Abstract:** The aim of this study was to develop trajectory planning that would allow an autonomous racing car to be driven as close as possible to what a driver would do, defining the most appropriate inputs for the current scenario. The search for the optimal trajectory in terms of lap time reduction involves the modeling of all the non-linearities of the vehicle dynamics with the disadvantage of being a time-consuming problem and not being able to be implemented in real-time. However, to improve the vehicle performances, the trajectory needs to be optimized online with the knowledge of the actual vehicle dynamics and path conditions. Therefore, this study involved the development of an architecture that allows an autonomous racing car to have an optimal online trajectory planning and path tracking ensuring professional driver performances. The real-time trajectory optimization can also ensure a possible future implementation in the urban area where obstacles and dynamic scenarios could be faced. It was chosen to implement a local trajectory planning based on the Model Predictive Control (MPC) logic and solved as Linear Programming (LP) by Sequential Convex Programming (SCP). The idea was to achieve a computational cost, 0.1 s, using a point mass vehicle model constrained by experimental definition and approximation of the car's GG-V, and developing an optimum model-based path tracking to define the driver model that allows A car to follow the trajectory defined by the planner ensuring a signal input every 0.001 s. To validate the algorithm, two types of tests were carried out: a Matlab-Simulink, Vi-Grade co-simulation test, comparing the proposed algorithm with the performance of an offline motion planning, and a real-time simulator test, comparing the proposed algorithm with the performance of a professional driver. The results obtained showed that the computational cost of the optimization algorithm developed is below the limit of 0.1 s, and the architecture showed a reduction of the lap time of about 1 s compared to the offline optimizer and reproducibility of the performance obtained by the driver.

**Keywords:** autonomous driving; trajectory planning; path tracking; sequential convex programming; linear programming; quadratic constraints; autonomous racing car
