# A New Self-Tuning Nonlinear Model Predictive Controller for Autonomous Vehicles

Authors: Yasin Abdolahi; Sajad Yousefi; Jafar Tavoosi
Journal: Complexity
 (2023)

---

## Abstract

Autonomous driving has recently been in considerable progress, and many algorithms have been suggested to control the motions of driverless cars. The model predictive controller (MPC) is one of the efficient approaches by which the speed and direction of the near future of an automobile could be predicted and controlled. Even though the MPC is of enormous benefit, the performance (minimum tracking error) of such a controller strictly depends on the appropriate tuning of its parameters. This paper applies the particle swarm optimization (PSO) algorithm to find the global minimum tracking error by tuning the controller’s parameters and ultimately calculating the front steering angle and directed motor force to the wheels of an autonomous vehicle (AV). This article consists of acquiring vehicle dynamics, extended model predictive control, and optimization paradigm. The proposed approach is compared with previous research in the literature and simulation results show higher performance, and also it is less computationally expensive. The simulation results show that the proposed method with only three adjustable parameters has an overshoot of about 8% and its RMSE is 0.72.


---

## Body

## 1. Introduction

Driverless cars have become popular in recent years because they promise to transform cities, provide universal access to mobility, and increase transport efficiency [1]. Another reason which attracts researchers and automobile industries is autonomous cars are expected to be by far the safest and more comfortable compared to human driving. Human driving is accident-prone as our tiredness and even wrong or delayed decisions undeniably affect our driving efficiency, which causes loss of property and deaths [2]. In recent decades, numerous studies of research pertinent to the dynamic and control of four-wheel automobiles have been conducted. In [3], the statistical performance of kinematic and dynamic bicycle models is analyzed. Such models are the simplification of four-wheel cars in which two rear wheels and two front wheels are lumped into one (imaginary) rear and front wheel, respectively. A more complex vehicle dynamic is developed in [4] which consists of five connected subsystems: one vehicle body and four wheels, rigidly coupled to the vehicle body. But the more sophisticated a model, the more difficult would be the identification of its parameters and the more challenging approaches to design efficient controllers. Moreover, the nonlinearities of the vehicle’s dynamic represent big challenges against the controller design. While, in many cases, linearization is a good tradeoff between simplicity and accuracy, the nonlinear models are generally expected to be more trustworthy in various scenarios as cover all dynamical moods of a system [5].In the case of controllers, different control techniques have been utilized for the steering angle and speed control of autonomous vehicles. Proportional-integral-derivative (PID) controller is one of the well-known classical methods. In [6], PID gains are adjusted by a radial basis neural network for AVs to control the AV’s speed. A PID controller is developed for controlling AV’s lateral position in [7]. However, PID controllers cannot handle the system constraints, and they cannot guarantee effective performance in different maneuvers. In [8], a car-following structure is developed for AVs based on fuzzy logic. The introduced control mechanism is developed for the AVs on the highways to provide a safe traffic stream. In [9], a fuzzy logic controller is introduced for a mobile robot to follow various trajectories. However, the developed fuzzy logic controller is complicated in that it requires special microprocessing for practical implementation. In [10, 11], neural networks are utilized for path planning to AVs. The availability of the data set for training and testing the neural networks represents a big challenge against the implementation of neural networks. If the data set is not enough and not accurate, the performance of the neural network might not be efficient. On the other side, the MPC is evaluated as a sufficient control technique for different applications including simple and complicated models [12, 13]. In [14], a linear stochastic MPC is proposed for the safety guarantee in some manure and highway simulations showing the effectiveness of the proposed method regarding performance and safety. In [15], there is a comparison between linear and nonlinear MPCs for cruise control in electric vehicles. The performance of both linear and nonlinear MPCs depends on the suitable tuning of their parameters. In the other words, the tracking of regular and irregular reference signals with fewer overshoot, short rise and settling time, and small steady-state error is the main target of the controller which is only met by accurate tuning. These performance criteria are proposed in many studies such as in [16, 17]. However, they limited the trajectory tracking to only step responses. To avoid this, in this paper we propose the minimum error tracking which is efficient for any reference signals (it is not limited to step signals). To tune MPC’s parameters, many approaches like [18] present the application of the genetic algorithm to find the optimal weighting of MPC. In reference [19], MPC is supervised by fuzzy logic. The fuzzy logic supervisor fulfills the online tuning of the predictive control parameters. Moreover, neural networks are mostly used for model identification in MPCs. In [20], a novel tuning approach for MPC based on the artificial neural network along with the PSO algorithm is formulated. But this approach is not promisingly able to find the global optimum. Similarly, in [4], a modified neural network is proposed to tune MPC’s parameters for robotic manipulators. It is worth noting that throughout the tuning process, computational expenses are a considerable matter. In [21], a new low computational burden design is proposed to adjust the gains of the hybridization between the discrete-time Laguerre function and MPC based on the social ski driver algorithm. This algorithm is developed as a recent artificial intelligence technique. Furthermore, in the concept of robustness of uncertainties, a robust model predictive strategy based on an arithmetic optimization algorithm in [22] tends to handle the uncertainties for automatic voltage regulators [23]. A new robust control strategy is introduced in the paper to design the MPC gains. In [24, 25], another optimal nonlinear MPC is designed based on a new modified multitracker optimization algorithm. The merits of this improved intelligence technique are confirmed to track different linear and nonlinear trajectories and to prevent it from becoming trapped in a local optimum in the process of tuning its parameters. In addition, in [25], a nonfragile PID controller is also proposed to deal with uncertainties while determining the optimal gains of a PID controller.In this paper, we use the kinematic bicycle model and nonlinear MPC to control the lateral position and speed of AVs. The controller parameters are tuned based on particle swarm optimization. The proposed procedure is more computationally efficient than what have been proposed in the literature such as [17, 18]. Moreover, the simulation result shows the performance of tracking desired trajectories is much better than what was proposed in the mentioned studies.


## 2. Vehicle Dynamic and Model

Figure1 depicts the main forces on a car on the road. The vehicle’s longitudinal motion, governed by Newton’s second law of motion, can be described as follows [26]:(1)∑F=mdvtdt,Fair=ρAcDv2t,Ffriction=mgcrrcosθ,Froll=mgsinθ,(2)mdvtdt=Fwheel−Fair−Ffriction−Froll.where m is the mass of the vehicle, including powertrain inertial effects, vt is longitudinal velocity. Here, Fw is chosen to be the sum of tractive or braking force at the wheels, Fg is the road gradient resistance, and Fr is rolling resistance in which crr is the coefficient of friction and θ is the road slope which is a function of position. In the term representing aerodynamic drag, ρa is the air density, A is the vehicle front area, and CD is the aerodynamic drag coefficient.Figure 1
Longitudinal forces acting on the car.The nonlinear continuous time equations that describe the kinematic bicycle model [3] are summarized in (6)–(9). See Figure 2 where x and y are the coordinates of the center of mass in an inertial frame X,Y, ψ is the inertial heading, and lf and lr represent the distance from the center of the mass of the vehicle to the front and rear axles, respectively. β is the angle of the current velocity of the center of mass with respect to the longitudinal axis of the car, and the control inputs are the front steering angles δ.(3)βt=arctanlrlr+lftanδt,(4)ψ˙t=vtlrsinβt,(5)x˙t=vtcosψt+βt,(6)y˙t=vtsinψt+βt.Figure 2
Kinematic bicycle model.


## 3. Nonlinear Model Predictive Control

A nonlinear system could be described in the following model:(7)dxtdt=fxt,ut,(8)yt=hxt,dt.Here,xt is the state space, f. is the nonlinear dynamic, ut is the input, dt denotes the external disturbance on the system, yt is the output, and h. is the measurement model. MPC uses a model of the system to make predictions about the system’s future behavior, and by solving an online optimization algorithm to find the optimal control action, drives the predicted output to the reference. It can also handle input and output constraints. MPC has preview capability; it can incorporate future reference information into the control problem to improve controller performance. MPC predicts the future control signal within finite steps named the control horizon “M” and utilizes the prediction of the system output within finite steps named the prediction horizon “P” to predict the proper control moves. The best control moves are selected according to the decreasing of a quadratic objective function. This objective function is formulated in the following term:(9)J=∑k=1Pydest+k−yt+k|kQ+γ∑k=0M−1Δut+k|kR.Subject to the system dynamic (7) and (8) and the following inequalities:(10)Δumin<Δuk<Δumax.(11)umin<uk<umax.Here,ydest is the desired reference, Δuk=uk−uk−1, .Q,.R are the Euclidian norm, and γ is the input-output ratio weighting factors. In (9), the first term penalizes the output reference tracking, and the second one penalizes the slope of changes in the input signal.The constraints (10) and (11) are considered for both longitudinal speed and lateral position. These make the algorithm much more liable to be implemented in reality. As the signal control of longitudinal velocity is supposed to be the motor force which obliviously cannot be overvalued or fluctuated in high frequencies because of mechanical constraints in the vehicle’s motor. For controlling the lateral position, in addition to mechanical constraints, the steering angle should be intentionally limited for the sake of safety driving, especially in high speeds. Nevertheless, if the algorithm suggests an over or under-rated signal control, it is considered as a lower or upper limited band, respectively.The extended dynamic model predictive controller (EDMC) is based on a nonlinear model and a simultaneous linear model. During computing control signals, EDMC tries to reduce the difference between nonlinear and simultaneous linear models, doing so based on step responses. In a linear system, the step response of a system is computed by the convolution series.(12)yt=∑i=1∞giΔut−i.For theP step of output prediction and M steps of horizon control, this could be shown in the following matrices. Here, Ym is the simultaneous linear model output, GP×M is the Toeplitz matrix of step responses which are driven by feeding a step signal to the nonlinear dynamic. For computing the P elements of Ypastt+1, it does not need to compute all elements of step response and it can be computed by evaluating Δui=0, i=t,t+1,…. in the nonlinear dynamic.(13)ymt+1|tymt+2|tymt+3|t⋮ymt+P|tP×1=g100⋯0g2g10⋯0g3g2g1⋯⋮⋮⋮⋮⋱gP+M−2gPgP−1gP−2⋯gP+M−1P×MΔutΔut+1Δut+2⋮Δut+M−1M×1+g2Δut−1+g3Δut−2+…g3Δut−1+g4Δut−2+…g4Δut−1+g4Δut−2+…⋮gP+1Δut−1+gP+2Δut−2+…P×1,(14)Ymt+1=GΔUt+Ypastt+1.By assumingQ=IP×PandR=IM×M, the matrix form of the objective function described in (9) can be rewritten in the following form:(15)J1=Ydes−YTYdes−Y+γΔUTΔU,where Y=Ym+D; by defining E=Ydes−Ym−D, the signal control is(16)ΔUt=GTG+γI−1GTE.Moreover, the disturbance term is composed of nonlinear disturbance and measurement disturbance, shown byDnl and Dext, respectively.(17)D=Dnl+Dext.For the external disturbance, the best approach is to assume this disturbance does not change in the near future and equal to the difference between the measurement output and the nonlinear mode’s output.(18)Dext=yt−ynlt1⋮1P×1,(19)Dnl=Ynlt+1−Ymt+1P×1.SinceYnlt+1 and Ymt+1 are functions of ΔUt, in the main loop of the algorithm, there is a fixed point iterative approach to solve the following equations:(20)Dnl−Ynlt+1−Ymt+1=0,(21)Dnll+1=Dnll+αYnlt+1−Ymt+1.


## 4. Optimization Problem

Particle swarm optimization (PSO) is a bio-inspired algorithm that optimizes an objective function by iteratively trying to improve a candidate solution with regard to a given measure of quality in the solution space. It is different from other optimization algorithms in such a way that only the objective function is needed and it is not dependent on the gradient or any differential form of the objective. This method was originally proposed in [27] to find the maximum or minimum of a function defined on a multidimensional vector space. In this paper for the NLMPC, the mean square error (MSE) objective function is suggested to find the optimal parameters: prediction horizon P, control horizon M, and weighting factor γ.(22)J2=1T−t0∑t=t0Tydest−yt,where t0 and T is the start and end time of desired pattern, respectively. What was developed in references [17, 18] is not only limited to step reference signal but also is rather computationally expensive than what is proposed in this paper. However, the objective function J2 (22) is quite efficient for any desired pattern. In addition, the objective function J1 (15) has only three variables to the optimization problem.Following would be the algorithm of tuning EDMC using PSO. Assume there areN particles by which the position of each particle is denoted by Xij=Pij,Mij,γij. Beside the position, there is a velocity for each particle, denoted by Vij. In the iteration of j, the position and velocity of particles in the next iteration are updated by the following rules:(23)Vij+1=wVij+c1Xpbesti−Xij+c2Xgbest−Xij,Xij+1=Xij+Vij+1.The constantw is the inertia weight. It determines how much should the particle keep on with its previous velocity. The constants c1 and c2 are called the cognitive and the social coefficients, respectively. They control how much weight should be given between refining the search result of the particle itself and recognizing the search result of the swarm. Xpbesti is the position that gives the minimum J2 which is ever explored by particle i, and Xgbest is that explored by all the particles in the swarm.The proposed algorithm of EDMC along with PSO can be expressed in Algorithm1 and Figure 3.Figure 3
Scheme of EDMC tuned by PSO.Algorithm 1: The pseudocode of the main steps of the proposed paradigm.
Given the patterns ofydes for both lateral position and longitudinal velocity
PSO loop for finding optimalP, M and γ
Fort=t0,t1,…,T
Compute the step responses by evaluatingΔui=0, i=t0,t0+1,…. in the nonlinear dynamics, using equations (5)–(8).
Evaluating Toeplitz andYpast matrices, using (13) and (14).
EvaluatingDext, using (18)
Loop for computingΔu and Dnl
InitialingDnl=0
ComputingΔu, using (16)
UpdateDnl, using (21)
End
Computing input signals:ut=ut−1+Δut
End


## 5. Simulations and Results

In this section, the performance of the proposed optimization paradigm, in comparison with the approaches in [17, 18] is shown. Moreover, the robustness of the EDMC in the case of disturbance rejection and the uncertainties in the model’s parameters is illustrated. To begin with, in the PSO-MPC approach in [17] and GA-MPC in [18], the weighting factors of the control horizon and prediction horizon were supposed to be different in each step. As a result, the PSO algorism has to search in the higher dimensional space, which makes the algorithm computationally expensive, particularly while the long horizon of control and prediction are needed. However, proposed objective function (15), only has to have three parameters to tune.The nominal parameters of the vehicle dynamic are shown in Table1 [28]. And, the suggested EDMC parameters (M, P, γ) are tuned by the PSO algorithm for each desired output pattern.Table 1
The vehicle parameters.
m
2020
kg
ρ
1.184
kg
/
m
3
A
2.1
m
2
C
D
0.33
C
r
r
0.0015
l
f
1.4
m
l
r
1.65
m
g
9.81
m
/
s
2The performance of the auto-tuned MPC for the control of speed and lateral position is shown in Figures4 and 5, respectively. The response of the PSO-MPC algorithm, alongside the results of methods presented in [17, 18] (M=2 and P=20 for speed control and M=2 and P=15 for lateral position control), is shown. While the objective function in the PSO-MPC is defined to reduce overshoot, steady-state error, and rise and settling time, the objective function in this paper (MSE) represents the response performance more efficiently.Figure 4
Speed control.Figure 5
Lateral position control.The results of the comparison are summarized in Tables2 and 3 for the vehicle speed and lateral position, respectively.Table 2
The response characteristics of vehicle’s speed.
Proposed approach
GA-MPC
PSO-MPC
Number of tuned parameters
3
22
22
RMSE
6.77
7.10
7.24
Overshoot
6.16%
31.84
36.28%
Steady-state error
0.00
0.00
0.00
Rise time
4.70 sec
4.2 sec
4.20 sec
Settling time
11.20 sec
14.50 sec
17.20 secTable 3
The response characteristics of vehicle’s lateral position.
Proposed approach
GA_MPC
PSO-MPC
Number of tuned parameters
3
17
17
RMSE
0.72
0.73
0.73
Overshoot
8.01%
17.13
20.27%
Steady-state error
0.00
0.00
0.00
Rise time
0.16 sec
0.15 sec
0.14 sec
Settling time
0.62 sec
0.58 sec
0.58 secTables2 and 3 show that the proposed method has a much better performance compared to the other two methods. Note that the sampling time for the speed controller is Ts=0.1sec and the PSO algorithm would tune the parameters at =2, P=32, and γ=2.1e−4. However, Ts=0.01sec is chosen for the lateral position controller at the constant speed of 30m/sec and the parameters are tuned at =2, P=21, and γ=23. The results show that it can provide a good tracking performance and is more computationally effective rather than conventional MPCs. It is worth noting that there is no limitation to simultaneously implementing both speed and lateral position controllers. Another merit of the proposed approach is the robustness in the case of uncertainties in the model parameters and external disturbances. Figures 6–9 show how the controller deals with uncertainty in the parameters in CD,Crr,lr,lf, comparing to the nominal value (Table 1).(24)lrdevitated=0.5lr,lfdevitated=1.5lr,Crrdevitated=1.5Crr,CDdevitated=0.5CD.Figure 6
Tracking desired velocity in the presence of uncertainties in the model parameters.Figure 7
Tracking desired lateral position in the presence of uncertainties in the model parameters.Figure 8
Tracking desired velocity in the presence of external disturbance.Figure 9
Tracking desired lateral position in the presence of external disturbance.It is crystal clear that the proposed paradigm can control the lateral position and speed of an AV at a high range of performance. In comparison with the previous studies [17, 18], the proposed algorithm not only results in better performance but also takes less time to tune the controller’s parameters. The details are shown in Tables 2 and 3. Moreover, the robustness of the controller shows it is not sensitive to accurate identification of the nonlinear model’s parameters. Figure 10 illustrates the performance of the tracking nonlinear reference signal in the presence of fluctuating slope of the road.Figure 10
Tracking nonconstant desired velocity on a nonconstant slope road.The result shows the robustness of the proposed approach in no stationary environment.


## 6. Conclusions

For the formation control of the lateral position and speed of an AV, this paper first modeled the dynamic of a four-wheel vehicle by applying the kinematic bicycle model. Afterward, the study formulated the EDMC algorithm. Finally, the PSO algorithm is devoted to finding the optimal solution by tuning the controller’s parameters. The output results emphasize that the proposed method is superior to the other methods and it is more effective to track regular and irregular trajectories with a desired mean square error, short settling time, and less overshoot. The simulation results show the proposed approach desirably meets the performance criteria. Moreover, the suggested technique is robust versus the system parameters uncertainties. For future work, the reference signals could be extracted from recently developed control strategies such as reinforcement learning. Furthermore, regarding collision avoidance and safe driving, the motion of other vehicles should be taken into account [24].



---

*Source: 8720849-2023-01-16.xml*