1. Introduction
Autonomously driving vehicles and electrification of vehicle parts have been hot topics in the automobile industry over the past few years, and many parts of vehicles have been replaced with electric devices. Accordingly, researchers are studying model predictive control (MPC) algorithms, which they apply to autonomous vehicles to track the vehicle’s driving route or optimize the efficiency of the engine, transmission, exhaust gas consumption, and motor performance. In the early 1960s, research on MPC involved the use of linear quadratic regulators designed by Kalman to minimize unconstrained quadratic objective functions. However, MPC was not applied in industry for a long time owing to the nonlinearity of actual industrial processes. Finally, in 1978 [
1], chemical engineers applied MPC in chemical industrial control processes, thereby demonstrating its advantages over other control technologies.
When Ford Motor Company began exploring MPC-based control technology, MPC has already been applied in different automobile fields, such as for direct injection stratified engines [
2] and traction control [
3,
4]. When user convenience became increasingly important and autonomously driving vehicles started to emerge, researchers studied optimal trajectories or collision avoidance trajectories by extending the use of MPC algorithms to the fields of advanced driver assistance systems (ADAS) [
5,
6,
7] and autonomous driving [
8,
9]. These studies have demonstrated that constrained, multivariate MPC has advantages in following the path of autonomous vehicles [
10].
MPC algorithms have been developed to improve the tracking performance by considering the nonlinearity of a vehicle model through nonlinear MPC or by further strengthening the state constraint such as with Robust MPC [
11,
12,
13]. However, depending on the size of the prediction horizon, control horizon, and sampling time, the computation complexity can increase, or the tracking performance can be insufficient. In the above study, MPC was performed by fixing the size of the sampling time, and the size of the sampling time was set empirically. However, MPC using a fixed sampling time has improved tracking performance when the sampling time is small, but causes computational load. Conversely, when the sampling time is large, the computation time is fast, but the tracking performance is insufficient. The disadvantage of this method is that it is not suitable for vehicles that need to perform various actions in various scenarios.
As a result, subsequent research is using weight matrix, prediction horizon, and sampling time set as fixed parameters in MPC as variables, and changing and controlling prediction horizon or sampling time by applying arbitrarily designated prediction horizon and sampling time according to the conditions of each stage [
14,
15,
16,
17].
This paper proposes a variable sampling-time model predictive control algorithm (VST-MPC) for improving the path tracking performance of a vehicle, and the sampling time is adjusted based on the optimal steering angle and lateral acceleration inputs calculated with MPC. Previously published studies set the sampling time as constant or arbitrarily determined according to the conditions. However, the proposed VST-MPC algorithm adjusts the sampling time by using the gradient descent method according to the calculated optimal input. Therefore, it is controlled using various sampling times and designed to gradually converge to the minimum or maximum value. In addition, since the sampling time is changed based on the optimal input calculated from the MPC rather than the external parameters of the vehicle, it can be utilized in various environments and scenarios. This paper simulates four types of MPCs (MPC with a sampling time of 0.1, MPC with a sampling time of 0.2, MPC with a sampling time of 0.05, and the proposed MPC) in two scenarios. The simulation results show the path-following performance of the proposed MPC is improved compared to the MPC with a fixed sampling time. The algorithm was developed in the MATLAB environment, and the actual model utilized in the simulation used a vehicle among the car models provided by the Automated Driving Toolbox of MATLAB. The Automated Driving Toolbox of MATLAB provides many actors (cars, trucks, bicycles, and pedestrians). In addition, many of the vehicle parameters can be set, so various existing vehicles can be implemented by setting the parameters. Road design features and sensors can be used to collect driving data. The camera sensor was used to collect the reference data in this paper. The parameters of the vehicle and a more detailed description of the automated driving toolbox are given in
Section 4.
The remainder of the paper is organized as follows.
Section 2 discusses the basic MPC design to implement the proposed MPC.
Section 3 describes the proposed VST-MPC algorithm.
Section 4 describes the experimental environment and scenarios, and the results of each scenario. Finally, a conclusion is presented in
Section 5.
3. A Variable Sampling-Time Model Predictive Control (VST-MPC) Algorithm
In MPC, the sampling time determines how many times the MPC runs the control algorithm during a driving scenario. When the sampling time is short, because the control algorithm is run by dividing the scenario into a long sequence, it can respond quickly to disturbances and improve the tracking performance. However, the computation time is long. When the sampling time is long, and the computation time is shortened because the scenario is divided into a short sequence; however, the tracking performance is insufficient, and the algorithm cannot respond quickly to disturbances [
25]. In this section, we propose the VST-MPC method, which adjusts the sampling time based on the optimal input value calculated by the MPC algorithm.
3.1. Proposed VST-MPC Algorithm Using Optimal Input Sequence
The VST-MPC algorithm is designed to run while adjusting the sampling time according to the driving situation at each stage. The basic VST-MPC algorithm is as follows: In a straight driving section, because the input steering angle and lateral acceleration are approximately zero, the sampling time does not have much effect on the tracking performance and influence of the disturbance. Thus, the sampling time is set to the maximum in the straight driving section for faster computation. In the curved driving section, because the input steering angle and lateral acceleration change continuously, the sampling time affects the tracking performance and reactivity toward the disturbance. Therefore, the sampling time is gradually decreased to improve the tracking performance in the curved driving section.
Algorithm 1 presents the pseudo-code of the VST-MPC algorithm. The description of the pseudo-code is as follows: In Step 1, the default sampling time is set to 0.2. In Step 2, the parameters of the MPC algorithm (various parameters such as
,
) are set, and the MPC algorithm computes the optimal input to predict the next move. In Step 3, the control input calculated with the MPC algorithm is used to predict the next move of the vehicle. In Step 4, the predicted state is stored as the past state, and the control input is stored as the past input. In Step 5, the sampling time to be used when the next vehicle move is predicted is calculated with the calculated inputs
and
. The contents of the equations of the fifth step are described in detail in
Section 3.2. In Step 6, the sampling time calculated in Step 5 is set as the sampling time for the next prediction of the MPC. Step 7 prevents the sampling time from continuously increasing or decreasing. When the sampling time calculated in Step 5 exceeds the maximum value of the sampling time, the sampling time for the next prediction of the MPC is set as the maximum value of the sampling time. In contrast, when the sampling time calculated in Step 5 exceeds the minimum value of the sampling time, the sampling time for the next prediction of the MPC is set as the minimum value of the sampling time. In Step 7, the algorithm returns to Step 2 and continues to predict the next move of the vehicle from Step 2 to Step 7 until the scenario is over.
Algorithm 1 The Pseudo Code of VST-MPC. |
Step 1: Set the initial sampling time |
Step 2: Set the MPC parameter and calculate the optimal input with MPC |
Step 3: Predict |
Step 4: Update Xpast = Xa (K + 1), upast = u(K) |
Step 5: Calculate the next sampling time using the following equation. |
|
where |
Step 6: Set = |
Step 7: If Ts > = else if < = end |
Step 8: Go to Step 2 until MPC iteration is over. |
3.2. Design a Function of VST-MPC for Sampling Time Variation
This section presents the equation for setting the sampling time in the VST-MPC algorithm:
where
where
and C are manually determined constants. The values of
and C are described in
Section 4.1.
In Equation (48), and are the inputs calculated by solving the cost function. This expression is designed to change the sampling time according to the control input. In the driving scenario, the inputs and converge to 0 in the straight driving section. However, in the curved driving section, the inputs and have non-zero values. Equation (47) reduces the computation time by maintaining a long sampling time in the straight driving section owing to these driving characteristics. In the curved driving section, the sampling time is gradually decreased according to the calculated input to improve the tracking performance and for reliable reactivity to sudden disturbances.
In other words, in a driving scenario starting when the sampling time is set to 0.2, Z is zero because the control input is close to zero in the straight driving scenario. The next sampling time is predicted by adding the selected C value to the existing sampling time of 0.2. However, 0.2 is maintained owing to the maximum value condition of the sampling time in Step 7 of the pseudo-code. In the curved driving scenario, the control input gradually increases. Thus, the new sampling time is determined by subtracting Z from the equation from the existing sampling time 0.2.
In general, the path tracking error of MPC increases over curved sections. Therefore, to reduce the path-tracking error, it is necessary to significantly reduce the sampling time when the input calculated through MPC is large. In other words, the sampling time should change significantly in the curved driving section where the calculated inputs are increasing. However, when the sampling time is changed rapidly, the inputs will also change rapidly, reducing the ride quality. There may be situations where the MPC cannot compute the inputs. To prevents this phenomenon, the sampling time should be changed by a small increment at the first changing point from the linear driving section to the curved driving section, and the sampling time should be gradually changed according to the input. For this reason, in the first point where the sampling time changes, is set so that the sampling time, which is the smallest possible increment, changes to 0.01. For the same reason, C is set as the smallest increment so that the sampling time is adjusted step by step. The value of C is set to 0.01 when the input is 0, that is, to increase the sampling time in the straight section. Therefore, C is set to −0.01 to add to the existing sampling time.
Equation (50) determines the sign of the calculated expression. The reason for selecting the smaller of the values C and Z in Equation (47) is to cause the sampling time that converges to 0.05 in a curved driving section to converge to 0.2 again in a straight driving section. Therefore, when C is selected, the calculated expression must be added to the existing sampling time. Conversely, when C is not selected, it is set to subtract the calculated equation from the existing sampling time, as it indicates a curved driving section. The gradient descent algorithm is used in this equation such that the sampling time gradually converges to the minimum bound, 0.05, or maximum bound, 0.2, as the curvature of the driving path changes [
26]. In the curved driving section, the sampling time decreases to 0.05. In the straight driving section, the sampling time increases to 0.2.
4. Configuration Driving Scenario Using MATLAB and Simulations
In this section, the proposed VST-MPC algorithm presented in
Section 2 and
Section 3 is verified based on different scenarios.
Section 4.1 describes the scenario, and
Section 4.2 presents the experimental results.
The simulation was performed with the following environment:
CPU: AMD Ryzen 7 3800XT 8-Core Processor 3.90 GHz
RAM: 32.0 GB
GPU: NVIDIA GeForce RTX 3070
RAM: 32.0 GB
Tool: MATLAB 2020b, Automated Driving Toolbox
For the scenario configuration and simulations, MATLAB and Automated Driving Toolbox be linked. The Automated Driving Toolbox of MATLAB provides many actors (car, truck, bicycle, and pedestrian). In this paper, the car was used for the vehicle model for simulations. The camera sensor was used for collecting the reference data of the simulations. The Automated Driving Toolbox can be used to set many vehicle parameters and can collect the driving data through road design and sensors. The toolbox provides several algorithms and functions that facilitate the simulation of ADAS and autonomous driving systems (static and dynamic actors, various sensors, etc.). In addition, some visualization environments such as 3D simulation and bird’s eye view are provided. Scenarios can also be exported to MATLAB in the form of functions, making it easy to link with MATLAB and to plot experimental results on MATLAB. Because of these advantages, it is used in ADAS and autonomous driving system verification in various papers [
27].
Table 1 shows the parameters of a vehicle model and input constraints. Because the scenario was performed at a speed of 20 m/s, the maximum acceleration constraint was set using 2.24 m/s
2, the empirical maximum acceleration value of a petrol car driving at 20 m/s. The minimum acceleration constraint was set using 3.97 m/s
2, the empirical maximum deceleration value of a petrol car driving at 20 m/s [
28]. The maximum steering angle constraint was set by using Ackerman Jeantaud geometry in that the minimum radius of gyration is set to 6 m [
29].
Figure 2 shows the trajectory of scenario 1 and scenario 2. A detailed description of the scenario is provided in
Section 4.1. Most of the MPC-related papers use the sampling time as 0.1 [
30]. Therefore, 0.1 is also used in this paper. Additionally, the sampling time, 0.2 was selected for comparison between the proposed MPC and the MPC with a longer sampling time than 0.1. The sampling time, 0.2 is used at tracking control system and cruise control system [
31,
32].
4.1. Scenario Description
In this section, the results of the MPC system with 0.2, 0.1, and 0.05 sampling times and those of the proposed VST-MPC system for each scenario are compared.
The first scenario is shown in
Figure 2a: the vehicle runs on two curved roads in a row. In the beginning, the vehicle runs on a straight road of 40 m length and turns left into a curved driving section with a 20 m radius of gyration. Subsequently, it runs on a 40 m straight driving section and enters a (right-turning) curved section with a 20 m radius of gyration. The scenario ends when the 40 m straight driving section has been passed. The initial speed of the vehicle is 20 m/s, the prediction horizon is 10, and the control horizon is 2. The prediction horizon indicates the amount of data that MPC references to calculate the next prediction. The prediction horizon affects tracking performance and computation time. However, in this paper, it is set as a fixed constant. Many papers set the prediction horizon to 10 [
7,
20]. In an MPC system with a prediction horizon equal to 10, tracking performance and computation time are reasonable, so the prediction horizon is set to 10. The value of
, which is a constant in Equation (47) is 0.0045, and C, which is a constant in Equation (47), is −0.001. In addition, the experiment is performed at different sampling times: 0.2, 0.1, and a variable sampling time.
The second scenario is shown in
Figure 2b. This scenario consists of two driving lanes. At the start of the scenario, the vehicle runs on the second lane of a two-lane road. It switches to the first lane after detecting an obstacle at approximately 50 m distance from the start and returns to the second lane after passing the obstacle. The initial speed of the vehicle is 20 m/s, the prediction horizon is 10, and the control horizon is 2. In the second scenario, most of the parameters are the same except that
is 0.02, which is set empirically. The results of the four MPC algorithms with different sampling times are compared to assess the tracking performance of each algorithm.
4.2. Simulation Results of Scenario 1
Figure 3 shows the sampling time of scenario 1 in each step. The violet curve is the sampling time in each step. The results indicate that the sampling time changes based on the calculated input values of the lateral acceleration and steering angle when the vehicle enters the curved driving section. Owing to the effect of the proposed MPC, a low sampling time was selected for the curved driving section, and a high sampling time was selected for the straight driving section.
Figure 4 compares the trajectories of the four MPC algorithms. The black curve is the reference trajectory, the red curve represents the MPC algorithm with 0.2 sampling time, the blue curve represents the MPC algorithm with 0.1 sampling time, the green curve represents the results of the proposed MPC algorithm, and the brown curve represents the result of the MPC algorithm with 0.05 sampling time. Because discussing the tracking error of each MPC algorithm based on a figure that shows the entire trajectories is difficult, the tracking errors of each section are discussed separately.
Figure 5a is section A. Section A is the section entering from the first straight driving area to the first curved driving area (35–65 m on the
X axis).
Figure 5b is section B. Section B is the section entering from the second straight driving area to the second curved driving area (50–80 m on the
X axis).
The proposed VST-MPC is closest to the reference trajectory compared to the MPC with a 0.1 sampling time and the MPC with a 0.2 sampling time. This indicates that the path-following performance is improved by the effect of the proposed VST-MPC. The proposed VST-MPC shows similar tracking performance to the MPC with a sampling time of 0.05. However, in terms of computation time, the proposed MPC improves over the MPC with a sampling time of 0.05. This is discussed in detail in
Table 2.
Figure 6 presents the control inputs of the proposed MPC. The value tends to change rapidly in the section in which the sampling time is changed. That is, when the sampling time is long, the control input is large because the reference for predicting the next step changes to a large increment. When the sampling time is short, the calculated control input is small because the reference for predicting the next step relatively changes to a small increment. In the proposed MPC algorithm, because the sampling time changes continuously, the control input increases or decreases according to the sampling time. Thus, the input value tends to change rapidly.
Although this does not pose a major safety risk, this problem must be addressed in further studies to ensure passenger comfort.
Figure 7 is the tracking error for the four MPCs. The tracking error of MPC with a 0.1 sampling time and MPC with a 0.2 sampling time increases in the curved driving section.
Figure 7 shows that the tracking errors of VST-MPC and MPC with sampling time 0.05 are the smallest.
The average tracking error and computation time are determined when the MPC algorithm has completed all cycles. The average tracking error is calculated using the average absolute error.
Table 2 shows the average tracking errors and computation times of the four MPC algorithms. The sampling time affects the average tracking error and computation time. When the sampling time is long, there is an advantage in that the computation time is decreased. However, there is a disadvantage in that the tracking error is increased. In the opposite case, when the sampling time is short, there is an advantage in that the tracking error is decreased. However, there is a disadvantage in that the computation time is increased.
The MPC algorithm with a 0.2 sampling time has the disadvantage of a fairly large average tracking error, 0.6407 m, but it has the advantage of a short computation time, 0.1292 s.
The MPC algorithm with a 0.1 sampling time shows adequate performance with an average tracking error of 0.1617 m. In addition, the computation time is 0.2880 s, maintaining an appropriate level.
The MPC algorithm with a 0.05 sampling time has the advantage of the smallest average tracking error, 0.1344 m, but it has the disadvantage of a long computation time, 0.4170 s.
The computation time of the proposed MPC algorithm is increased compared to the computation time of the MPC algorithm with a 0.2 sampling time and the MPC algorithm with a 0.1 sampling time. However, the average tracking performance of the proposed MPC algorithm is improved compared to the average tracking performance of the MPC algorithm with 0.2 sampling time and the MPC algorithm with 0.1 sampling time. The computation time of the proposed MPC algorithm is decreased compared to the computation time of the MPC algorithm with a sampling time of 0.05. The average tracking performance of the proposed MPC algorithm is similar to that of the MPC algorithm with a 0.05 sampling time. This confirms that the computation time can be shortened while maintaining similar performance in terms of tracking performance when the proposed VST-MPC algorithm and the MPC algorithm with the shortest sampling time are compared.
The path-tracking error of the proposed VST-MPC was reduced by about 14% compared to the MPC with a 0.1 sampling time and was reduced by about 351% compared to the MPC with a 0.2 sampling time. However, the path-tracking error of the proposed VST-MPC was increased only by about 5% compared to the MPC with a 0.05 sampling time. The computation time was increased by about 12% compared to the MPC with a 0.1 sampling time and was increased by about 153% compared to the MPC with a 0.2 sampling time. However, the computation time was reduced by about 28% compared to the MPC with a 0.05 sampling time. Due to the effect of the proposed VST-MPC algorithm, the tracking performance is increased compared to the MPC with a 0.1 sampling time and MPC with a 0.2 sampling time. And it shows performance similar to the tracking performance of MPC with a sampling time of 0.05. The proposed VST-MPC algorithm has a disadvantage in that it increases the computation time, but this is low compared to the increase in tracking performance. The proposed VST-MPC algorithm can reduce the computation time compared to MPC with a 0.05 sampling time. That is, the code that changes the sampling time in the proposed MPC algorithm does not significantly affect the computation time, and only the changed sampling time increases the computation time. This means that the proposed VST-MPC has the advantages of both MPC with long sampling time and MPC with short sampling time.
4.3. Simulation Result of Scenario 2
Figure 8 shows the sampling times for Scenario 2 in each stage. The violet curve is the sampling time in each step. The results indicate that the sampling time changes according to the calculated lateral acceleration and steering angle input values when the vehicle enters a curved driving section. Due to the effect of the proposed MPC, a low sampling time was selected for the curve driving section and a high sampling time was selected for the straight driving section. In addition, in the section that is the inflection point in the trajectory, the sampling time is increased again because the steering angle and the lateral acceleration are close to zero.
Figure 9 compares the trajectories of the four MPC algorithms. The black curve is the reference trajectory, the red curve represents the MPC algorithm with a 0.2 sampling time, the blue curve represents the MPC algorithm with a 0.1 sampling time, the green curve represents the proposed MPC algorithm, and the brown curve represents the MPC algorithm with a 0.05 sampling time. The proposed VST-MPC is closest to the reference trajectory compared to the MPC with a 0.1 sampling time and the MPC with a 0.2 sampling time. This indicates that the path-following performance is improved by the effect of the proposed VST-MPC. Additionally, the proposed VST-MPC shows similar tracking performance to the MPC with a sampling time of 0.05. However, in terms of computation time, the proposed MPC improves over the MPC with a sampling time of 0.05. This is discussed in detail in
Table 3.
Figure 10 presents the control input of Scenario 2. As noted in
Section 4.2, the control input changes suddenly, according to the sampling time.
Figure 11 shows the tracking errors of the four MPC algorithms. When the sampling time is 0.2 and 0.05, the tracking error is large. By contrast, the proposed VST-MPC algorithm does not have a large tracking error. Even compared to MPC with a 0.05 sampling time, the tracking error of the proposed VST-MPC is similar with the MPC with a 0.05 sampling time.
The average tracking error and computation time are measured when the MPC has completed all cycles.
Table 3 shows the average tracking errors and computation times of the four MPC algorithms. The sampling time affects the average tracking error and computation time.
The MPC algorithm with 0.2 sampling time has the disadvantage of a fairly large average tracking error, 0.4079 m, but it has the advantage of a short computation time, 0.0883 s.
The MPC algorithm with a 0.05 sampling time has the advantage of the smallest average tracking error, 0.0556 m, but it has the disadvantage of a long computation time, 0.3121 s.
The proposed MPC algorithm has improved tracking performance over the MPC algorithm with 0.1 sampling time and the MPC algorithm with 0.2 sampling time.
The computation time of the proposed MPC algorithm is decreased compared to the computation time of the MPC algorithm with a sampling time of 0.05. The average tracking performance of the proposed MPC algorithm is similar to that of the MPC algorithm with a 0.05 sampling time. This confirms that the computation time can be shortened while maintaining similar performance in terms of tracking performance when the proposed VST-MPC algorithm and the MPC algorithm with the shortest sampling time are compared.
The tracking error of the proposed VST-MPC was reduced by about 145% compared to the MPC with a 0.1 sampling time and 616% compared to the MPC with a 0.2 sampling time. However, the path-tracking error of the proposed VST-MPC was increased only by about 2% compared to the MPC with a 0.05 sampling time. The computation time was increased by about 42% compared to MPC with a 0.1 sampling time and by 138% compared to MPC with a 0.2 sampling time. However, the computation time was reduced by about 54% compared to the MPC with a 0.05 sampling time. Due to the effect of the proposed VST-MPC algorithm, the tracking performance is improved over that of MPC with a 0.1 sampling time and MPC with a 0.2 sampling time. And it shows performance similar to the tracking performance of MPC with a sampling time of 0.05. The proposed VST-MPC algorithm has a disadvantage in that it increases the computation time, but this is low compared to the increase in tracking performance. The proposed VST-MPC algorithm can reduce computation time compared to MPC with a 0.05 sampling time. That is, the code that changes the sampling time in the proposed MPC algorithm does not significantly affect the computation time, and only the changed sampling time increases the computation time. This means that the proposed VST-MPC has the advantages of both MPC with long sampling time and MPC with short sampling time.
5. Conclusions and Future Work
This paper proposed an MPC algorithm for autonomous vehicles. The algorithm adjusts the sampling time based on the lateral acceleration and steering angle, which are the inputs calculated by the MPC algorithm when the vehicle is running. When a short sampling time is chosen, the algorithm can cope well with sudden disturbances and improve its tracking performance, however, this prolongs the computation time. When the sampling time is long, the computation time is shortened. However, the algorithm cannot cope well with sudden disturbances and exhibits poor tracking performance. To compensate for these deficiencies, this paper proposes the VST-MPC algorithm. This algorithm adjusts the sampling time of each step using optimized input calculated by the MPC algorithm when driving the vehicle. The tracking characteristics and computation time of the proposed and conventional MPC algorithms were compared with two fixed sampling times in two scenarios. According to the results, the proposed MPC algorithm shows improving tracking performance and similar computation time to MPC with a sampling time of 0.1. This means that the proposed VST-MPC has both advantages of MPC with short sampling time and MPC with long sampling time.
Because the vehicle is driven by continuously changing the sampling time, the input lateral acceleration and the front wheel steering angle are continuously changed. Although this does not affect the safety of the passengers, it may diminish driving comfort. Therefore, the research to improve this is being planned. In addition, the research using HiLS or real-time simulation is being planned for better proof of the algorithm.