You are on page 1of 15

MPC controller design

for autonomous vehicle


lane changing

MPC Course
Mahdi Ansari 40200216
Project assignment 6

1
Contents
Introduction .................................................................................................................................................. 3
Literature review........................................................................................................................................... 4
Model development ..................................................................................................................................... 5
MPC Controller design .................................................................................................................................. 7
Explicit MPC design ..................................................................................................................................... 11
Conclusion ................................................................................................................................................... 14
References .................................................................................................................................................. 15

2
Introduction

Lane change maneuver is one of the challenges in the path of designing of autonomous vehicles.
This operation must be done with respect to the relative kinematics of the vehicle and the other
vehicles.

Figure 1 Lane change maneuver

In this project, we use a bicycle model for the vehicle. With this model, we simplify the vehicle by
using two wheels and a body to represent the vehicle. The front and rear tires can rotate about their
centers and are responsible for steering of the car.

Figure 2 Vehicle bicycle model

An MPC system will be designed in order to guide the vehicle on a suitable trajectory from one lane
to another. In this project the MPC will control the lateral movement of the vehicle. Through this
maneuver the vehicle must remain stable with conditions which will be discussed later.

3
Literature review

One of the basic yet challenging aspects in the driver assistance systems is the automated
lane change system. Not only this system frees the driver form the task of lane changing, but also
has a positive impact on prevention of car accidents which most of the times are caused by
human error.
Many control strategies and models have been used in order to implement this
maneuver. One of the most common models for lateral dynamics of a vehicle is known as “bicycle
model”. Using this model with Kalman regulators resulted in minimization of deviation from the
reference and hence successful LCM. Extensive simulation tests showed the effectiveness of this
controller by comparing open-loop and closed-loop system. (Mirosław Gidlewski, 2017). The
validity of bicycle model for 4-wheel steering (4WS) vehicles have been also verified. Researcher
tested the response of the model to LCM using transfer functions and “bang-bang” control signal.
(Dębowski, 2022)
Others assessed LCM in extreme conditions like on a curved highway in rainy weather. An
adaptive path planning model and a model predictive controller (MPC) has been presented for
this purpose. (Tao Peng, 2020). In some cases, the dynamic environment of the LCM is taken into
consideration. A two-wheel dynamic bicycle model combines the longitudinal and lateral motion
of the vehicle and together with an MPC-based method presents a solution for LCM while the
other vehicles are not running at constant speeds. (Li, 2020)
Furthermore, some researches have been focused on the safety aspect of the LCM. To
develop a rule-based control strategy, some solved a quadratic program-based optimization
problem using control Lyapunov functions and control barrier functions. This made possible for
the vehicle to find a safe way to do a collision-free LCM. (He, Zeng, Zhang, & Sreenath, 2021)
Cooperative LCM among several connected and automated vehicles is one the interesting
areas in this subject. This work proposes an MPC-based cooperative lane change controller by
taking into account the changing of preceding vehicle and the relationship between the lateral
and longitudinal motions. (Sun, Zhao, Gong, & Wu, 2023).
One of the important parts of LCM is considering other vehicles behavior. Kekatos et al.
proposed a benchmark for LCM of autonomous vehicles. This paper studied the cooperative
implementation of LCM between 4 fully automatic vehicles with linear low-level controller that
regulates their longitudinal and lateral behavior. (Kekatos, 2018)
Lastly, researchers incorporated a recurrent neural network (RNN) scheme in order to
control LCM with longitudinal speed variation. They trained multiple RNN controllers by
considering the corresponding MPC with fixed vehicle speeds and the simulations showed better
performance than the MPC. (Quan, 2020)

4
Model development
The schematic of the bicycle model is illustrated in the figure below.

Figure 3 Bicycle model with two steered wheels

Applying the 2nd law of Newton in the planar motion gives us the following equations:

∑ 𝐹𝐹𝑥𝑥 = 𝑚𝑚𝑎𝑎𝑥𝑥 => 𝑚𝑚�𝑉𝑉𝑥𝑥̇ − 𝑉𝑉𝑦𝑦 𝜓𝜓̇� = 𝐹𝐹𝑥𝑥𝑥𝑥 𝑐𝑐𝑐𝑐𝑐𝑐𝛿𝛿𝑓𝑓 − 𝐹𝐹𝑦𝑦𝑦𝑦 𝑠𝑠𝑠𝑠𝑠𝑠𝛿𝛿𝑓𝑓 + 𝐹𝐹𝑦𝑦𝑦𝑦 𝑠𝑠𝑠𝑠𝑠𝑠𝛿𝛿𝑟𝑟 1

∑ 𝐹𝐹𝑦𝑦 = 𝑚𝑚𝑎𝑎𝑦𝑦 => 𝑚𝑚�𝑉𝑉𝑦𝑦̇ + 𝑉𝑉𝑥𝑥 𝜓𝜓̇� = 𝐹𝐹𝑥𝑥𝑥𝑥 𝑠𝑠𝑠𝑠𝑠𝑠𝛿𝛿𝑓𝑓 + 𝐹𝐹𝑦𝑦𝑦𝑦 𝑐𝑐𝑐𝑐𝑐𝑐 𝛿𝛿𝑓𝑓 + 𝐹𝐹𝑦𝑦𝑦𝑦 𝑐𝑐𝑐𝑐𝑐𝑐 𝛿𝛿𝑟𝑟 2

∑ 𝑀𝑀𝑧𝑧 = 𝐼𝐼𝑧𝑧 𝜓𝜓̈ => 𝐼𝐼𝑧𝑧 𝜓𝜓̈ = 𝑙𝑙𝑓𝑓 𝐹𝐹𝑥𝑥𝑥𝑥 𝑠𝑠𝑠𝑠𝑠𝑠𝛿𝛿𝑓𝑓 + 𝑙𝑙𝑓𝑓 𝐹𝐹𝑦𝑦𝑦𝑦 𝑐𝑐𝑐𝑐𝑐𝑐 𝛿𝛿𝑓𝑓 − 𝑙𝑙𝑟𝑟 𝐹𝐹𝑦𝑦𝑦𝑦 𝑠𝑠𝑠𝑠𝑠𝑠𝛿𝛿𝑟𝑟 3

Assuming that the longitudinal velocity is constant during the maneuver, we can neglect the first
equation. This leaves us with lateral force equation and moment equation. We can assume that the
steering angles are small and use the below relations to simplify the equations.

𝐹𝐹𝑦𝑦 = 2𝐶𝐶𝛼𝛼 𝛼𝛼 4
𝑉𝑉𝑦𝑦 𝜓𝜓̇𝑙𝑙𝑓𝑓 𝑉𝑉𝑦𝑦 𝜓𝜓̇𝑙𝑙𝑟𝑟
𝛼𝛼𝑓𝑓 = − − + 𝛿𝛿𝑓𝑓 , 𝛼𝛼𝑟𝑟 = − + − 𝛿𝛿𝑟𝑟 5
𝑉𝑉𝑋𝑋 𝑉𝑉𝑥𝑥 𝑉𝑉𝑋𝑋 𝑉𝑉𝑥𝑥

Using the above relations, the state-space model of the system is derived as follows:
̇
�𝑋𝑋 = 𝐴𝐴𝐴𝐴 + 𝐵𝐵𝐵𝐵 6
𝑌𝑌 = 𝐶𝐶𝐶𝐶 + 𝐷𝐷𝐷𝐷

5
2𝐶𝐶𝛼𝛼𝛼𝛼 + 2𝐶𝐶𝛼𝛼𝛼𝛼 2𝑙𝑙𝑓𝑓 𝐶𝐶𝛼𝛼𝛼𝛼 − 2𝑙𝑙𝑟𝑟 𝐶𝐶𝛼𝛼𝛼𝛼
⎡ � � �−𝑉𝑉𝑥𝑥 + � 0 0 ⎤
⎢ −𝑚𝑚𝑉𝑉𝑥𝑥 −𝑚𝑚𝑉𝑉𝑥𝑥 ⎥
⎢ 2𝑙𝑙 𝐶𝐶 − 2𝑙𝑙𝑟𝑟 𝐶𝐶𝛼𝛼𝛼𝛼 2𝑙𝑙12 𝐶𝐶𝛼𝛼𝛼𝛼 + 2𝑙𝑙22 𝐶𝐶𝛼𝛼𝛼𝛼 ⎥
𝐴𝐴 = ⎢� 𝑓𝑓 𝛼𝛼𝛼𝛼 � � � 0 0 ⎥
⎢ −𝐼𝐼𝑧𝑧 𝑉𝑉𝑥𝑥 −𝐼𝐼𝑧𝑧 𝑉𝑉𝑥𝑥 ⎥
⎢ 1 0 0 𝑉𝑉𝑥𝑥 ⎥
⎣ 0 1 0 0 ⎦
2𝐶𝐶𝛼𝛼𝛼𝛼 /𝑚𝑚 −2𝐶𝐶𝛼𝛼𝛼𝛼 /𝑚𝑚 1 0 0 0
2𝑙𝑙𝑓𝑓 𝐶𝐶𝛼𝛼𝛼𝛼 /𝐼𝐼𝑧𝑧 2𝑙𝑙𝑟𝑟 𝐶𝐶𝛼𝛼𝛼𝛼 /𝐼𝐼𝑧𝑧 0 1 0 0� , 𝐷𝐷 = [0]
𝐵𝐵 = � � , 𝐶𝐶 = � 7
0 0 0 0 1 0
0 0 0 0 0 1

The state-space variables are lateral slipping speed (𝑉𝑉𝑦𝑦 ), yaw angle rate (𝜓𝜓̇), vertical position of the vehicle
(Y) and the yaw angle of the vehicle (𝜓𝜓). The outputs of the system are the same as the state-space
variables. The inputs of the system are front and rear steering angle (𝛿𝛿𝑓𝑓 & 𝛿𝛿𝑟𝑟 ).

6
MPC Controller design
The aforementioned model in the previous section has been used both as control-oriented model and the
plant for simulation of the controller. The manipulated variables, front and rear steering angle (𝛿𝛿𝑓𝑓 & 𝛿𝛿𝑟𝑟 ),
output variables and MPC weights have been defined as structures in MATLAB. The steering angle the for
front and rear tires are subjected to conditions to be in range of -20 to +20 degrees which is compatible
with most of the steering systems for vehicles. The MPC controller has been defined using the
aforementioned structures plus the time step duration and the prediction (15) and control (2) horizons.

The flowchart of the simulation has been developed in Simulink. A step input with a magnitude of 2 has
been used as the reference for the vertical position of the vehicle (Y).

Figure 4 Simulink model of the MPC controller

The response of the system is illustrated as below.

Figure 5 The response of the system with default weights

The system has controlled the Y position of the vehicle with acceptable accuracy in 5 seconds. This
response is derived using the default weights for the MPC controller.

7
Table 1 Default MPC weights in simulation

Manipulated Variable [0, 0]

Manipulated Variable Rate [0.1, 0.1]

Output Variable [1 1 1 1]

Since the most important variable is the Y position of the vehicle, the weight for this output has been
enhanced. The corresponding response is as below.

Output variable = [ 1 1 20 1] 8

Figure 6 The response of the system with manipulated weights

This change has decreased the overshoot of the system dramatically and also the response of the system
became faster.

The diagram of the yaw angle and yaw angle rate of the vehicle is illustrated as below:

Figure 7 Left: The variation of yaw angle of the vehicle. Right: The diagram of the yaw angle rat of the vehicle

8
The behavior of the yaw angle and yaw angle rate of the system is logical since the yaw angle starts at
zero degree and then the vehicle turns to make the lane change. After that, the vehicle must turn the
other way and reaches the zero degree once again so that the vehicle could be aligned with the road
and continue its path in the new lane.

Figure 8 The variation of control signals (steering angles) of the system

The above diagram shows the variation of control signals (steering angles) of the system. As it can be
seen in the diagram, at the transient part of the maneuver the controller uses the maximum permissible
steering angles to reach the reference and after that these angles become smaller to compensate the
small misalignments.

The trajectory of the vehicle is as follows:

Figure 9 Trajectory of the vehicle in response to step input

Moreover, the response of the system to a sinusoidal input has been studied.

9
Figure 10 response of the system to a sinusoidal reference with 0.5 rad/s frequency

The system has been subjected to a sinusoidal input with 0.5 rad/s frequency and amplitude of 2. As we
can see in the above diagram, the controller is able to follow the reference with a small delay which
could be an acceptable response for a vehicle system.

10
Explicit MPC design

In MATLAB, an implicit MPC controller could be converted into an explicit MPC one. The benefit of
explicit MPC is reducing real-time calculation which is present in implicit MPC due to the optimization
process. On the other hand, explicit MPC requires more memory because it stores all pre-computed
regions and solutions for offline access.

Figure 11 Simulink block diagram for Explicit MPC controller

To generate the explicit MPC controller from the implicit controller, the range of the below variables
must be indicated. The ranges must contain the operating space of the variables during the run-time:

 States: Lateral slipping speed (𝑉𝑉𝑦𝑦 ), yaw angle rate (𝜓𝜓̇), vertical position of the vehicle (Y) and the yaw
angle of the vehicle (𝜓𝜓)

 Manipulated Variables: Front and rear steering angle (𝛿𝛿𝑓𝑓 & 𝛿𝛿𝑟𝑟 ),

 Reference: Reference signal for the lateral coordinate of the vehicle through lane-change

11
The response of the system to a step input with 2 meters amplitude is illustrated in the below diagram.

Figure 12 Performance of the Explicit MPC controller to the step input

The corresponding weights of the explicit MPC controller is as the table below.
Table 2 the corresponding weights of the explicit MPC

Manipulated Variable [0, 0]

Manipulated Variable Rate [0.1, 0.1]

Output Variable [1]

The below diagram shows the estimation of the system states during the vehicle’s maneuver.

Figure 13 The variation of 4 states of the system during the lane-change maneuver

12
Comparing the response of the explicit MPC controller to the implicit MPC, it can be inferred that the
performance of the implicit controller is slightly better regarding the settling time and overshoot
magnitude. This slight setback is the trade-off to the less computation load at run-time which is the main
benefit of the explicit MPC over implicit MPC.

The polyhedron regions of the explicit MPC controller are shown in the below figure.

Figure 14 Top-Left: Polyhedron regions of the Yaw angle vs Lateral coordinate, Top-Right: Polyhedron regions of the Lateral
coordinate vs lateral slipping velocity, Bottom-Left: Polyhedron regions of the lateral coordinate vs Yaw angle rate, Bottom-
Right: Polyhedron regions of the Yaw angle vs lateral slipping velocity

13
Conclusion
In this endeavor, first a mathematical model for bicycle model of a vehicle has been developed. In
development of this model, both front and rear steering has been taken into account. Subsequently, a
Model Predictive Controller (MPC) has been designed for regulation of a lane-change maneuver,
implemented within the Simulink environment. The controller's weights have been tuned in order to
make the response of the system faster and with lower deviation from the reference signal.
Furthermore, an Explicit Model Predictive Controller (MPC) has been devised for the vehicle's maneuver
control. While the response of the explicit controller exhibits a marginally inferior performance
compared to the implicit MPC, the former significantly reduces computational demands during runtime.

14
References
Dębowski, A. J. (2022). The bicycle model of a 4WS car lateral dynamics for lane change controller. IOP
Conference Series: Materials Science and Engineering.

He, S., Zeng, J., Zhang, B., & Sreenath, K. (2021). Rule-Based Safety-Critical Control Design using Control
Barrier Functions with Application to Autonomous Lane Change. 2021 American Control
Conference (ACC). New Orleans, LA, USA: IEEE.

Kekatos, N. D. (2018). Lane change maneuver for autonomous vehicles (Benchmark Proposal). ARCH@
ADHS.

Li, Z. J.-H. (2020). Automatic lane change maneuver in dynamic environment using model predictive
control method. IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS).

Mirosław Gidlewski, L. J. (2017). Simulation research on the process of lane change by a motor vehicle
steered in an open-and closed-loop system. XXIII, Urban Transport, 181.

Quan, Y. S. (2020). Quan, Ying Shuai, et al. "Multi-model recurrent neural network control for lane
change systems under speed variation. EEE 23rd International Conference on Intelligent
Transportation Systems (ITSC).

Sun, K., Zhao, X., Gong, S., & Wu, X. (2023). A Cooperative Lane Change Control Strategy for Connected
and Automated Vehicles by Considering Preceding Vehicle Switching. Applied Sciences.

Tao Peng, 1. L.-l.-w.-j.-k.-l. (2020). Lane-Change Model and Tracking Control for Autonomous Vehicles on
Curved Highway Sections in Rainy Weather. Journal of Advanced Transportation.

Wong, J. Y. (2001). Theory of ground vehicles. John Wiley & Sons.

15

You might also like