## 3 Design of Trajectory Tracking Control System
### Design of MPC Controller
The quadratic optimization problem can be solved by finding the front wheel steering angle under the constraints. After calculating the optimal steering angle sequence, only the first output controls the system's next sampling time. The optimization problem is solved recursively within each step. The Particle Swarm Optimization Algorithm Optimizes the Controller Parameters  
Particle swarm optimization (PSO) is an algorithm based on bionics proposed by American scholars [PERSON] and [PERSON]. The concept of PSO comes from the study of bird foraging behavior. Birds adjust their behavior by sharing their own existing information and combining the information shared by other individuals in the group so that they are in a favorable position to find food and avoid natural enemies. PSO has the advantages of a fast convergence speed, few parameters, and easy implementation (for high-dimensional optimization problems, it converges to the optimal solution faster than other algorithms); however, it also has the problem of falling into local optimal solutions, so it depends on a good initialization. Assuming a search in a d-dimensional space, particle optimization is equivalent to updating the position and velocity of the individual extreme value and the group extreme value of the particle in each iteration, as shown in Equation (17). \[\left\{ \begin{array}{l}x_{t+1}=x_{t}+v_{t+1}\\ v_{t+1}=\omega_{n}v_{t}+c_{1}r_{1}(P_{t}-x_{t})+c_{2}r_{2}(G_{t}-x_{t})\end{array} \right. \tag{17}\]  
where \(\mathrm{x}=(\mathrm{x}_{1},\mathrm{x}_{2},\ldots,\mathrm{x}_{n})\) represents the position of the particle; \(\mathrm{v}=(\mathrm{v}_{1},\mathrm{v}_{2},\ldots,\mathrm{v}_{n})\) represents the velocity of the particle; \(\mathrm{w}_{n}\) is the inertia factor; \(c_{1},c_{2}\) are the acceleration constant; \(\mathrm{r}_{1}\) and \(\mathrm{r}_{2}\) are random number between 0 and 1; \(\mathrm{P}_{t}\) is the best position of the particle searched so far; and \(\mathrm{G}_{t}\) is the optimal position that PSO has searched so far. The PSO algorithm needs a judgment condition to determine whether the optimal result is achieved. It usually takes the preset maximum number of iterations or the lower limit of the fitness value as the termination condition. The selection of different fitness functions often determines the convergence speed of the PSO and the probability of the optimal solution. Figure 3 shows a flowchart of the optimization process of the PSO algorithm. The commonly used fitness function is as follows: The integral time absolute error (ITAE) criterion is used because the control system designed by the ITAE index has a better dynamic performance and slight overshoot. In this paper, the sum of the ITAE of lateral deviation, heading deviation \(\varphi_{\mathrm{error}}\), and steering input \(\mathrm{u}\) is applied as the performance index function of PSO MPC, as shown in Equation (18). \[ITAE=\omega_{1}\int_{0}^{\infty}t|\mathrm{Y}_{error}(t)|dt+\omega_{2}\int_{0}^{ \infty}t|\,\varphi_{error}(t)|dt+\omega_{3}\int_{0}^{\infty}t|\,u(t)|dt \tag{18}\]  
where \(\mathrm{Y}_{\mathrm{error}}(t),\ \varphi_{\mathrm{error}}(t)\) and \(\mathrm{u}(t)\) represents the lateral deviation, heading deviation, and steering input at time \(\mathrm{t}\); and \(\omega_{1},\ \omega_{2}\) and \(\omega_{3}\) are the weighting coefficients of each item, which determine the proportion of ITAE index of \(\mathrm{Y}_{\mathrm{error}}(t),\varphi_{\mathrm{error}}(t)\) and \(\mathrm{u}(t)\) in the performance function, respectively. Figure 3: Basic flow chart of PSO. The velocity update of the traditional PSO optimization algorithm is shown in Equation (17). The particle swarm will only reach the optimal position if the inertia factor parameter is manageable. They set the inertia factor parameter to be too small, leading to a slow convergence speed.