Time-Optimal Trajectory Planning and Tracking for Autonomous Vehicles

This article presents a hierarchical control framework for autonomous vehicle trajectory planning and tracking, addressing the challenge of accurately following high-speed, at-limit maneuvers. The proposed time-optimal trajectory planning and tracking (TOTPT) framework utilizes a hierarchical control structure, with an offline trajectory optimization (TRO) module and an online nonlinear model predictive control (NMPC) module. The TRO layer generates minimum-lap-time trajectories using a direct collocation method, which optimizes the vehicle’s path, velocity, and control inputs to achieve the fastest possible lap time, while respecting the vehicle dynamics and track constraints. The NMPC layer is responsible for precisely tracking the reference trajectories generated by the TRO in real time. The NMPC also incorporates a preview algorithm that utilizes the predicted future travel distance to estimate the optimal reference speed and curvature for the next time step, thereby improving the overall tracking performance. Simulation results on the Catalunya circuit demonstrated the framework’s capability to accurately follow the time-optimal raceline at an average speed of 116 km/h, with a maximum lateral error of 0.32 m. The NMPC module uses an acados solver with a real-time iteration (RTI) scheme, to achieve a millisecond-level computation time, making it possible to implement it in real time in autonomous vehicles.


Introduction
Recent autonomous driving research has aimed to achieve Level 5 self-driving capabilities [1,2] for production vehicles, which requires path tracking controllers to precisely coordinate the throttle, brakes, and steering to control vehicles along predefined paths and velocity profiles.This task becomes particularly challenging when vehicle dynamics approach handling limits during high-speed maneuvers, such as lane changes or obstacle avoidance [3].Consequently, these challenges have propelled autonomous racing to the forefront as a popular research topic [4], as it involves controlling high-performance vehicles under highly nonlinear dynamics with short response times.If vehicles can be reliably controlled within or even beyond their handling limits in such extreme racing or drifting scenarios [5], this could enhance their maneuverability when encountering emergency situations on normal roads, thereby improving overall driving safety.The core of autonomous racing lies in trajectory optimization, which involves planning the time-optimal racing line for a given parameterized racetrack.This process typically entails a comprehensive consideration of various vehicle performance factors and optimization objectives, including drivetrain configuration [6], tire-road friction coefficients [7], active rear-axle steering [8], gear ratios, aerodynamics, roll stiffness, suspension characteristics, and other variable parameters [9][10][11][12].Trajectory optimization problems are typically discretized via the direct collocation method and solved using nonlinear programming (NLP) solvers.The key ad-vantage of this approach is the capability to handle high-order nonlinear dynamic system models and complex constraints, while yielding fully converged optimal solutions.Hierarchical control architectures have been developed to enable autonomous racing cars to accurately follow time-optimal reference trajectories planned in real time.By separating the control task into high and low levels with different prediction horizons and sampling times, the hierarchical approach increases the controller's look-ahead capability, while maintaining a computationally manageable size for NLP problems [13].The hierarchical control scheme in [14] consisted of a long prediction horizon NMPC with a point-mass model and a short horizon NMPC with a high-fidelity vehicle model.This structure allowed for real-time feasibility, without excessively simplifying the vehicle model.Furthermore, Srinivasan et al. [15] implemented a hierarchical control structure in a race car, comprising a 200 Hz low-level controller and a 40 Hz high-level NMPC with an optimized torque vectoring strategy.This strategy minimized the model mismatch between planning and control and verified the ability to outperform professional human drivers in racing scenarios.
This research presents TOTPT, a unified hierarchical optimization framework for controlling autonomous vehicles at their handling limits.It utilizes a TRO layer that plans the time-optimal raceline and velocity offline, and an NMPC layer that tracks the references online.The open-source code for the TOTPT framework is available at the online repository (https://github.com/zlijunting/TOTPT,accessed on 10 May 2024).
This study primarily focused on the development of the following aspects: • A unified vehicle modeling and control framework: The framework employs a consistent four-wheel double-track vehicle model across both the offline TRO and online NMPC layers.This unified modeling approach ensures coherent predictive behavior and enables efficient integration between the planning and control modules.Furthermore, proper scaling of variables and constraints, combined with well-defined problem formulations, facilitates rapid convergence of the optimization solvers in both layers.

•
Tailored tire modeling: Both the TRO and NMPC layers incorporate tire ellipse constraints on all four wheels, to enhance driving stability.The TRO layer utilizes hard tire ellipse constraints to fully utilize tire grip.In contrast, the NMPC layer imposes soft tire ellipse constraints using a pure slip tire model, which is more suitable for the multiple shooting scheme and convergence requirements of NMPC.

•
An adaptive reference preview algorithm: The reference trajectory adapts to the vehicle's speed.Specifically, it utilizes the travel distance and speed predicted from the NMPC to estimate the optimal path station and corresponding reference speed and curvature for the next time step.This approach improves the trajectory tracking performance by fully leveraging the model's predictive capabilities.
This paper is organized as follows: Section 2 describes the kinematic modeling of the vehicle relative to the reference path and the dynamics modeling for path tracking.Section 3 details the 3-DOF double-track vehicle dynamics model, covering the load transfer, wheel torques, nonlinear tire models, and vehicle constraints.Section 4 provides an overview of the hierarchical control scheme, with the offline TRO module generating optimal trajectories and the online modules handling error evaluation, path preview, and NMPC trajectory tracking.Section 5 formulates the TRO problem for offline trajectory planning, using the direct collocation method to discretize the problem into an NLP.Section 6 presents the formulation of the NMPC problem for online trajectory tracking, including the prediction model, discretization method, cost function, and constraints.Additionally, a reference preview algorithm is proposed.Section 7 presents the time-optimal trajectory planned using TRO, along with the trajectory tracking results obtained using NMPC.The path tracking performance, tire workloads, and execution efficiency are also analyzed.

Track Modeling
A scheme diagram of the path tracking model is illustrated in Figure 1  The lateral deviation and relative heading are selected as the primary path tracking states, then the path tracking dynamics are described by the following equations: where ṡ is the vehicle velocity projected onto the direction of the reference course at path The 'distance traveled' is used as the independent variable for the TRO [9].Subsequently, the dependent variable, i.e., time traveled for a given path grid, can be obtained using the factor S f , as defined by

Track Constraint
The lateral deviation of the vehicle is limited, to ensure that it remains within the track boundaries, where w t is the vehicle track width, and w s = 0.2 m is the preserved safety distance.

Vehicle Modeling
The choice of vehicle models for the path-following problem is diverse [16].Considering vehicle control near handling limits during racing maneuvers, the selected model must capture the coupling of longitudinal and lateral motions, as well as the nonlinear behavior of tire forces.In this research, a 3-degree-of-freedom (DOF) double-track vehicle model is employed to address both the TRO and NMPC problems.Aerodynamic drag and lift forces are included, while suspension dynamics are ignored.A rear-wheel drive (RWD) sports car with dual-motor is utilized as the test vehicle in this study, and the vehicle parameters are specified in Table A1.

Double-Track Vehicle Model
Figure 2 shows the layout of the double-track vehicle model, with the vehicle heading at yaw angle ψ from the x-axis of the predefined global coordinates O G .The accelerations a x and a y are located at the vehicle body coordinate O B , and a t and a n are located at the vehicle course coordinate O C .These accelerations are expressed by the following equations: where m v is the vehicle mass, δ is the front wheel steering angle, F x f /l is the total longitudinal tire force at the front/rear axle, F y f /l is the total lateral tire force at the front/rear axle, and x is the aerodynamic drag force, where ρ is the air density, C d is the drag coefficient, A is the vehicle frontal area, and V x is the longitudinal vehicle speed.
The yaw moment about the center of gravity (CG) of the vehicle is where l f and l r are the distances from CG to the front and rear axles.
Similarly to the vehicle models in [6,7,17,18], the total velocity V, sideslip angle β, and yaw rate γ are selected as the state variables; then, the following equations are used to describe the planar dynamics of the vehicle: where I z is the moment of inertia.

Load Transfer
A load transfer model is introduced to evaluate the tire forces when a vehicle undergoes significant changes in both longitudinal and lateral accelerations.Referring to [19], the equations for the static load transfer are where l is the wheelbase, h c is the height of CG, g is the gravity constant, āx and āy are the decision variables provided by the NLP solver, while the aerodynamic lift force, characterized by the lift coefficient C l , is given by x .To prevent algebraic loop issues being encountered by the optimization solver during function evaluations, the algebraic variables āx and āy are introduced, and constraints are imposed to ensure their values are consistent with the vehicle accelerations ( 7) and ( 8), To improve the convergence of online NMPC solvers, the equality constraints on accelerations are approximated using first-order dynamics as the following equations: where the time constant τ acc is set to half the NMPC sampling time.

Wheel Torques
The torque distribution between the front and rear axles are determined by the following equations: where T t and T b are the total traction torque and brake torque commands.k b denotes the distribution ratio of brake torque between the front and rear axles, while k t indicates the split coefficient for traction, which is determined by the drivetrain type of the vehicle.For the RWD vehicle considered in this study, k t = 0 and k b = 0.6.
The axle torques T f and T r are then redistributed to the left and right wheels in proportion to the relative vertical tire forces, similarly to the strategy in [20].Then, the torque commands for the four wheel are determined by the following equations: where the relative vertical loads are calculated as

Tire Modeling
According to the moment and force balance equations, the dynamics of wheel angular velocity are described by the following equation: where T i is the torque applied on the wheel, I w is the spin moment of inertia of the wheel, and r w is the effective rolling radius.The longitudinal velocities of the tire trajectories are given by and the lateral velocities of the tire trajectories are given by Then, the longitudinal slip λ and sideslip angle α of the tire at each corner i ∈ { f l, f r, rl, rr} are defined by The simplified magic formula (simplified MF) [21] (ch.9.2.2, [22]) tire model is used to capture the nonlinear characteristics of tire forces.This model is easy to implement and has good continuity, providing advantages for optimization algorithms that require model gradients.The simplified MF for the longitudinal tire forces under pure longitudinal slip conditions is shown in the left plot of Figure 3.It is the function of the longitudinal tire slip λ, vertical tire force F z , and road friction coefficient µ, as shown in the following equation: where µ 0 is the road friction coefficient during tire testing, and B x , C x , and D x are fitting coefficients.Since the peak factor D x varies linearly with the vertical tire force, it can be modeled as a first-order function of F z with a linear term d 1 and a constant term d 2 , The simplified MF for the lateral tire forces under pure sideslip conditions is shown in the right plot of Figure 3, and it is expressed by the following equation: where Figure 3. Simplified MF tire model.

Combined Slip Tire Model for TRO
In highly dynamic scenarios, a combination of braking and cornering maneuvers is commonly encountered, leading to coupled lateral and longitudinal tire slips and forces.Consequently, the coupled slip effect is incorporated into the TRO, to provide an accurate reference trajectory.The combined slip model from (ch. 4.2.2, [22]) is employed to evaluate the tire forces under combined slip conditions, where the theoretical slip quantities at four corners are defined as And the combined slip longitudinal and lateral tire forces of are defined by 3.4.3.Pure Sideslip Tire Model for NMPC Considering the convergence and real-time requirements of the online trajectory tracking task, wheel dynamics are not considered in the NMPC formulation.Instead, the combined tire force is characterized by tire ellipse constraints.Consequently, the longitudinal and lateral tire forces are described by the following equations:

Vehicle Constraints
Quadratic nonlinear constraints are imposed to ensure that the combined tire forces remain within the tire friction ellipses, thereby preventing a loss of traction.
where µ x,max and µ y,max are the maximum longitudinal and lateral tire friction coefficients.
To achieve the optimal actuation efficiency, it is not desirable to apply both motor and brake torque to the wheel at the same time.Thus, an equality constraint is imposed to ensure that the total traction and braking commands are orthogonal: Considering rear dual electric motors, two equality equations are introduced to limit the motor powers separately, T rl ω rl ≤ P rl,max , T rr ω rr ≤ P rr,max , where P •,max is the maximum motor power for the respective motor, ω is the wheel angular velocity, and subscripts rl and rr denote the rear-left and rear-right wheels, respectively.

Control Architecture
The overall control architecture is shown in Figure 4, with modules for offline and online execution.The offline TRO module generates the time-optimal trajectory based on the racetrack data.The optimal curvature, velocity, and raceline trajectories are then provided to the online modules.During the online path tracking stage, the tracking error evaluation module calculates the lateral deviation and heading error using the algorithm proposed in [23].The preview module queries the reference curvature and speed trajectories based on the preview path station.The NMPC module solves the optimal vehicle inputs for the online trajectory tracking.Subsequently, the low-level controller distributes the desired torque commands as rear driving torques and four-wheel braking torques.

Trajectory Optimization
Trajectory optimization aims to determine the reference path with the shortest travel time for a given racetrack, along with the corresponding vehicle states and input trajectories, while satisfying specified constraints.Prior to optimization, the centerline of the racetrack needs to be smoothed and discretized into uniform grid distances.Subsequently, the direct orthogonal collocation method is employed to discretize the system dynamics and cost functions in the spatial domain, thereby transforming the optimal control problem (OCP) into a standard NLP formulation.

System Dynamics in the Spatial Domain
The TRO problem is formulated in the spatial domain, using the distance along the track as the independent variable instead of time.This allows the dynamics to be expressed as a function of the path position, rather than time.The state variables of the TRO are concatenated from the vehicle states, wheel velocities, and path tracking states, The control variables are the total traction/braking torque commands and front wheel steering angle, The auxiliary variables are the algebraic longitudinal and lateral accelerations, Then, the system dynamics are the function of state, control, auxiliary and parameter variables, as shown in the following equations: The system dynamics in the spatial domain x ′ are transformed from the time domain using the variable S f , The magnitudes of states, controls, and auxiliary variables are bounded due to the physical limits of the vehicle and actuators, where the subscripts min and max denote the lower and upper bounds of the variables.The rates of the control variables are limited according to the dynamic characteristics of the actuators, umin ≤ u ≤ umax . (58)

Direct Collocation
As Figure 5 shows, the distance along the track centerline [s 0 , s f ] is divided into N intervals by the step length ds k , with each interval spanning [s k , s k+1 ], where k ranges from 0 to N − 1.The state trajectory of the interval is approximated using the Legendre polynomial as the following equation: where P i (τ) is the basis of the Legendre polynomial over the unit interval τ = [1, 0], computed using Gauss-Legendre collocation points {τ 0 , τ 1 , . . ., τ q } (ch.10.3, [24]) with order q, as defined by To facilitate the representation of state trajectories within each interval for subsequent formulations, the state variables at the knot and collocation points are aggregated into a matrix denoted as X k , The direct collocation method is utilized to discretize the TRO problem, following the approaches outlined in [11,25,26].This transcription method involves imposing additional constraints to enforce the polynomials approximate to the system dynamics.
For each interval, the derivatives of Legendre polynomials at the collocation points must match the system dynamics, as in the following collocation equation: where x ′ k,j = f s (x k,j , u k , z k , κ k ) are the system dynamics in the spatial domain at the collocation points, and the control u k is piece-wise constant for [s k , s k+1 ).
The state trajectory at the end of the interval must be consistent with the beginning of the next interval, as seen in the following continuity equation: (63) The matrix C is defined using the derivatives of the Legendre polynomials evaluated at collocation points, and the matrix D is defined using the Legendre polynomials evaluated at the end points of the interval, Additional constraints set h include the tire ellipse, actuator orthogonality, motor power, and state/control limits, which are imposed at the knot points only, where h min and h max are the lower and upper bounds of constraint.The variation in control is mapped onto the time domain in a manner that aligns with the specified bounds within the time domain.

Cost Function
The cost function is an integral part of trajectory optimization, representing the objective to be minimized.To minimize the lap time, the time cost within each discretized path interval must be incorporated, as in the following equation: where the matrix B aggregates the contributions of the time cost at the collocation points of intervals, To obtain the shortest laptime with smooth vehicle inputs, the cost function sums the time cost and the quadratic cost of variations in control and auxiliary variables over all intervals, where R and W are the weighting matrices, and if it is observed that the resulting optimal input commands exhibit oscillatory behavior, then the corresponding weights in the matrices need to be incremented.The variations in variables u ′ k and z ′ k are calculated using the following difference equations:

NLP Solver
To improve the convergence of the NLP, it is necessary to properly scale the decision variables of the solver [27].The state and control variables are scaled by the scaling factors, which are determined by their maximum expected values.This normalization process ensures that all the variables lie within a common range, typically between −1 and 1.The detailed workflow and implementation of the scaling procedure can be found in [28].
The overall TRO problem is summarized in Table 1 and includes decision variables, constraints, lower and upper bounds, and scaling factors.The symbolic framework CasADi [29] is used to formulate the TRO problem and transform it into a NLP.The large-scale nonlinear optimization solver Ipopt [30] is used to solve the NLP.

Nonlinear Model Predictive Control
The NMPC serves as the online trajectory tracking controller of the hierarchical control architecture.Its primary objective is to solve the optimal driving inputs, to control the vehicle in following the time-optimal reference trajectories generated by the TRO layer in real time.

Prediction Model
The NMPC needs to predict the future vehicle states, inputs, path station, and tracking errors; thus, the state variables of prediction model are selected as The control variables are the rates of driving inputs: The system dynamics of the prediction model are formulated as: The first to fifth equations in (73) predict the vehicle states and tire vertical loads, the sixth to eighth equations predict the path tracking errors and driving distance.In the last three equations, we assign the rate of system inputs as the extended states, similarly to [5,15,31].Using the variation in driving inputs as the control variable allows us to conveniently penalize it when formulating optimization problems at a higher interface level, thereby aligning with the cost function of TRO (69).
The magnitudes of states, controls, and rates of the control variables are bounded, due to the physical limits of the vehicle and actuators, umin ≤ u ≤ umax . (76)

Discretization
The implicit Runge-Kutta method (IRK) of second order is used to discretize the prediction model over the horizon k = 0, . . ., N p − 1, where x(t) is the measured or estimated stated at the current time, and t s = 0.05 s is the sample time of NMPC or the time interval for solving each optimization problem.The prediction horizon is set as N p = 30, resulting in the prediction time t p = N p t s = 1.5 s.

Preview Path Station
In this section, an algorithm is proposed for generating the optimal reference trajectory for NMPC based on the preview path station.The preview path stations are obtained by moving the previous optimal path station by one step and adding a correction term to predict the distance to move for an additional step.Specifically, the preview path station ŝk at each stage k is set equal to the previous optimal path station: This ensures that the NMPC tracks the most recent optimal path station.
For the final preview path station ŝN p , a correction term is added to extrapolate the distance the vehicle is expected to travel in the final prediction step: where V * N p is the optimal velocity at the end of the prediction horizon, obtained from the previous NMPC solution.By interpolating the reference trajectory planned by TRO using the preview path stations that adapted to the vehicle's current velocity, accurate preview references can be obtained for the NMPC to track.

Reference Output
The output of NMPC is y = [V, β, n, χ] ⊤ , and the reference output at each stage is given by meaning that the vehicle is expected to follow the reference velocity with zero path tracking errors, and the vehicle slip angle follows the kinematic reference value to maintain lateral stability.

Cost Function
Model-plant mismatches or external disturbances can lead to constraint violations that render the original optimization problem infeasible.To address this issue, a slack variable s h is introduced to handle constraint violations, while still maintaining a feasible solution, where h includes the actuator orthogonality, four tire ellipse constraints, and power limits.
To balance the objectives of accurately tracking the desired trajectory, minimizing control efforts, and permitting constraint relaxation, the cost function to be minimized over the prediction horizon N p is formulated by combining tracking errors, control efforts, and penalties on the slack variables: where S y and S u are the scaling matrices, utilizing the maximum allowable deviation from the nominal value as the scaling factors.The weighting matrices Q, R, and Z penalize tracking errors, control efforts, and the slack variable, respectively.The elements within the Q matrix are adjusted to prioritize varying objectives, such as improving velocity tracking or decreasing lateral deviation.Similarly, the R matrix must be fine-tuned to prevent oscillatory behavior in the driving inputs.
The overall NMPC path tracking problem is formulated in Table 2.The fast and embedded solvers acados [32] was utilized as the NMPC solver, which features the implicit Runge-Kutta (IRK) for numerical simulation and the multiple shooting approach to discretize the OCP.Real-time iteration was also implemented, to perform one sequential quadratic programming (SQP) iteration at each sampling step, to further reduce the NMPC computation time.The OCP formulation, integrators, transcription methods, weights, parameters, and QP solvers were stated at the high-level interface of Matlab.In addition, code generation was used to automatically generate a fast NMPC C code that was deployed in Simulink via the S-function.The solver parameters are specified in Table A2.

Simulation Setup
The simulations were performed on a desktop computer with an Intel ® i5-12500 processor.The online modules of Figure 4 were implemented and run in Simulink.The simulation was demonstrated on a lap of the Catalunya Circuit, with the raw data of track being extracted from the racetrack-database (https://github.com/TUMFTM/racetrackdatabase,accessed on 5 October 2024) and the time-optimal trajectories generated by the proposed TRO algorithm.The total length of the raceline s f = 4584 m was divided into uniform discrete intervals of ds = 3 m for TRO planning and ds = 1 m for NMPC tracking.To examine the convergence of NMPC at low speeds, where the numerical sensitivity to small longitudinal velocity and its associated gradients can be issues, the initial speed of the vehicle model in TRO, NMPC, and Simulink were set to 1 m s −1 .

Path Tracking Results
Figure 6 presents the path tracking response in global coordinates.The raceline displays the position of the vehicle's CG with the velocity contour.It can be observed that the vehicle decelerated appropriately before reaching the apex, accelerated during the exit phase, and maintained high speeds on the straight sections of the track.The average velocity of the vehicle was 116.5 km h −1 .The lap time achieved by the NMPC was 141.45 s, which was 1.37 s more than the optimal lap time solved by the TRO, representing a relative error of 0.98%.

Vehicle States
Figure 8 demonstrates the performance of the NMPC controller in accurately tracking the highly dynamic trajectories planned by the TRO layer.The NMPC controlled the vehicle to approach the at-limit speed profile, while utilizing the yaw rate to follow an aggressive path curvature, and keeping the sideslip angle within a stable range.

Driving Inputs
Figure 9 shows the optimal vehicle accelerations, driving inputs, and wheel torque commands.The first plot shows that the vehicle acceleration solved by the NMPC controller was consistent with the planned acceleration from the TRO, exhibiting a similar trend in the torque commands.The steering and total torque commands were smooth, without any oscillation, which made them easier for the actuators to implement, and the total traction and braking commands satisfied the orthogonal constraint, enabling the actuators to operate with optimal efficiency.The traction and braking torques were appropriately distributed to four wheels based on the vertical load of each wheel.
Under the tire ellipse constraint, the majority of the tire friction data points for all four wheels lay within the friction circle.The data points exceeding the boundary constituted 16% and 13% of the total data points for the left-rear wheel and right-rear wheel, respectively.The maximum values of the tire workloads did not exceed µ = 1.1, which falls within an acceptable tolerance range.

Execution Performance
Figure 11 records information about the acados solver.We configured the solver with both the SQP and SQP-RTI schemes and performed racing simulations, while keeping the other parameters unchanged.Both schemes achieved the same lap time and consistent cost function residuals.However, there was a significant difference in the computation time: the average computation time per sampling instance was 0.01 s for SQP and 0.005 s for RTI.It is noteworthy that the number of iterations using the SQP scheme alone did not exceed five, indicating that the problem exhibited good convergence and was well-defined.This provided a suitable environment for the RTI scheme, which performed only one iteration per sampling time.Furthermore, the cost function residuals being close to unity suggests that all the decision variables of the solver were appropriately scaled.

Conclusions
The proposed TOTPT framework utilizes a two-layered approach, with an offline TRO module and an online NMPC module.The TRO layer generates minimum-lap-time trajectories using a direct collocation method, which optimizes the vehicle's path, velocity, and control inputs to achieve the fastest possible lap time, while respecting vehicle dynamics and track constraints.This computationally expensive offline optimization leverages a consistent double-track vehicle model to ensure coherence between the planning and tracking stages.The NMPC layer, operating in real time, is responsible for precisely tracking the reference trajectories generated by the TRO.By incorporating predicted path stations and adapting the reference trajectory based on the vehicle's current speed and projected travel distance, the NMPC controller is able to maintain accurate path following, even under highly dynamic conditions.Notably, the NMPC formulation achieved millisecond-level execution times through the use of the RTI scheme.The authors validated the TOTPT framework through simulation on the Catalunya circuit, where the vehicle was able to track the optimal racing line with high speed and low tracking errors.The results highlight the framework's ability to push the vehicle to its limits, which could translate to enhanced maneuverability and safety for autonomous vehicles in emergency scenarios on public roads.

Future Work
Although the proposed control scheme demonstrated precise tracking results in the simulation, certain aspects require further improvement for practical application in future work.Firstly, while the simulation results demonstrated the framework's performance in controlling a planar vehicle model on a two-dimensional track, it would be valuable to evaluate its robustness and adaptability on tracks with different features (e.g., track curvature, elevation changes, surface conditions).Secondly, considering real-time path planning, we could either look for solvers capable of solving NLP in real-time or simplify the TRO problem by employing a point-mass vehicle model with g-g-v diagram constraints.Finally, conducting experiments in real environments is crucial.A viable approach would be to implement the algorithm in the low-cost autonomous vehicle system of the F1TENTH platform [33], conducting path-following experiments to evaluate the real-time performance and robustness of the control algorithms under practical conditions.
, where R is the distance from the vehicle CG to the instantaneous center of rotation (ICR), κ = dϕ ref (ds) −1 is the path curvature at a given path station s, ϕ ref is the reference course angle, and N l ∈ R + and N r ∈ R + are the normal distances from the path to the left and right track boundaries.The vehicle moves in the direction defined by the vehicle's course angle ϕ, with a velocity of V.The relative states between the vehicle and the path include the normal distance from the vehicle's CG to the nearest point on the path n, the relative heading ξ = ψ − ϕ ref , and relative course χ = ϕ − ϕ ref = ξ + β.

Figure 1 .
Figure 1.Kinematic relationship between the vehicle and the reference path.

Figure 2 .
Figure 2. Diagram of the double-track vehicle model.

Figure 4 .
Figure 4. Control architecture for the path following problem.

Figure 5 .
Figure 5. Illustration of the decision variables for the direct collocation with q = 3 in a path interval.

Figure 6 .
Figure 6.Path tracking response in global coordinates.

Figure 7
Figure 7 presents the path tracking errors in Cartesian coordinates.The NMPC considered the future vehicle states, path tracking states, and preview references to coordinate the vehicle lateral and longitudinal motions, allowing the vehicle to follow the reference path with minimal tracking errors.Under the imposed racetrack constraints, the vehicle remained within the track boundaries during the race, as is evident from the blue line representing the lateral deviation not reaching the black line boundaries.The RMS and maximum values of the absolute lateral deviation were 0.11 m and 0.32 m, respectively.The RMS and maximum values of the absolute course error were 0.33 deg and 1.28 deg, respectively.

Figure 7 .
Figure 7. Path tracking errors in Cartesian coordinates.

Figure 8 .
Figure 8. Trajectory tracking results with vehicle states.The black dotted lines are the optimal trajectories computed by the TRO.The blue lines are the tracking results achieved by the NMPC.

Figure 9 .
Figure 9. Optimal driving inputs and wheel torque commands.The black dotted lines are the optimal trajectories computed by the TRO.

7. 5 .
Figure10shows the tire grip margin using the tire workload plots, where the tire workloads in longitudinal and lateral directions are defined byμxi = F xi F zi , μyi = F yi F zi , i ∈ { f l, f r, rl, rr}.(84)

Figure 11 .
Figure 11.SQP iteration, execution time, and residual of cost function of NMPC solver.