Keywords

1 Introduction

This paper presents the design of a safety-critical lane-keeping controller for passenger cars, which ensures that the vehicle is able to follow the lane center-line without leaving the lane boundaries. In order to stabilize the path following, a simple feedback controller can be set up that will aim to reduce the lateral position and yaw angle errors of the vehicle with respect to the lane center-line. However, to ensure that the path following can be achieved without the vehicle exiting the lane boundaries even in the presence of large initial deviations, the nominal controller has to be extended with some additional considerations.

In particular, we use a control barrier function (CBF) [1,2,3,4] to define a safety condition of the vehicle staying inside the lane boundaries. Based on this, a safe controller can be designed, which modifies the input of the nominal controller in a minimally-invasive fashion, in order to keep the system inside the safe set in state space, thereby ensuring safe lane-keeping of the vehicle.

The rest of the paper is organized as follows: in Sect. 2, the vehicle model and the nominal stabilizing controller are introduced. In Sect. 3, we present a brief overview of safe controller design using control barrier functions and define the safe set used for the lane-keeping problem. In Sect. 4, the resulting safe controller is analyzed using numerical simulations and phase portraits, highlighting the improvements over the case when only the nominal controller is used. Finally, Sect. 5 concludes the paper and gives an outlook for future research directions.

2 Vehicle Model and Nominal Controller

The kinematic bicycle model in Fig. 1 is applied in our analysis (see [5] for details), with the consideration of a straight-line reference path along the x-axis. The governing equations of the vehicle model are

$$\begin{aligned} \dot{x}_\textrm{R} = V \cos \psi \, , \quad \dot{y}_\textrm{R} = V \sin \psi \, , \quad \dot{\psi } = \frac{V}{l} \tan \delta _\textrm{s} \, , \end{aligned}$$
(1)

where the state vector \({x=\begin{bmatrix} x_\textrm{R} & y_\textrm{R} & \psi \end{bmatrix}^\top }\) includes the coordinates of the rear axle center point \(x_\textrm{R}\) and \(y_\textrm{R}\), and the yaw angle \(\psi \). The vehicle speed V is considered to be constant and l denotes the wheelbase. We use \({u=\tan \delta _\textrm{s}}\) as the control input, where \(\delta _\textrm{s}\) is the steering angle. This way the system can be written in the control affine form \({\dot{x}=f(x)+g(x)u}\).

Fig. 1.
figure 1

Kinematic bicycle model with a bounding box excluding the rear overhang.

We utilize a nominal steering controller of the form

$$\begin{aligned} u=k_\textrm{d}(x) = -P_y y_\textrm{R}-P_\psi \psi , \end{aligned}$$
(2)

to stabilize the path-following, where \(P_y\) and \(P_\psi \) are the control gains. To ensure that the vehicle does not leave the lane boundaries, the vehicle model is extended with the bounding box of width W and length L shown in Fig. 1. For simplicity, the bounding box includes the wheelbase and the front overhang of the vehicle, while the rear overhang is neglected. In the next section, we extend the nominal controller to guarantee that if the bounding box starts inside the lane boundaries then it stays inside those boundaries.

3 Safety Filter with Control Barrier Function

In this sections we briefly review the theory behind control barrier functions (CBFs) and then apply it to the lane-keeping problem.

3.1 Control Barrier Function Background

Following [4], we define a safe set \(\mathcal {S}\) in the state space \({\mathcal {X} = \mathbb {R}^2\times (-\pi ,\pi )}\) and define a control barrier function \({h: \mathcal {X}\rightarrow \mathbb {R}}\) such that it is non-negative on \(\mathcal {S}\):

$$\begin{aligned} \mathcal {S} = \{x \in \mathcal {X}: h(x)\ge 0 \}, \end{aligned}$$
(3)

while we require \({h(x)=0 \Rightarrow \nabla h(x) \ne 0}\). Then it can be proven that \(\mathcal {S}\) is forward invariant (i.e., \({\forall x(0)\in \mathcal {S} \Rightarrow x(t)\in \mathcal {S}, \forall t \ge 0 }\)), if there exist a class-\(\mathcal {K}\) function \({\alpha : \mathbb {R}_{\ge 0} \rightarrow \mathbb {R}_{\ge 0}}\) such that

$$\begin{aligned} \underset{u\in {U}}{\textrm{sup}}\, \underbrace{(\nabla h(x)f(x) + \nabla h(x) g(x) u)}_{\dot{h}(x,u)} \ge -\alpha (h(x)), \quad \forall x\in \mathcal {S}, \end{aligned}$$
(4)

where U denotes the set of available control inputs. To find a controller that deviates from the nominal controller \(k_\textrm{d}(x)\) as little as possible while still satisfying the safety condition (4), one may construct a quadratic program (QP):

$$\begin{aligned} k(x) = \underset{u \in U}{{\text {argmin}}} \; \Vert u - k_\textrm{d}(x) \Vert ^2 , \quad \text {s.t.} \quad \dot{h}(x,u) \ge - \alpha \big ( h(x) \big ). \end{aligned}$$
(5)

Considering a single unbounded input (as in (1) we have \({u\in \mathbb {R} \Leftrightarrow \delta _\textrm{s} \in (-\frac{\pi }{2},\frac{\pi }{2})}\)), one may obtain an analytical solution to the QP (5) as

$$\begin{aligned} k(x) = {\left\{ \begin{array}{ll} \textrm{min} \{k_\textrm{d}(x), k_\textrm{s}(x)\}, & \text {if} \quad \nabla h(x) g(x) < 0, \\ k_\textrm{d}(x), & \text {if} \quad \nabla h(x) g(x) = 0, \\ \textrm{max} \{k_\textrm{d}(x), k_\textrm{s}(x)\}, & \text {if} \quad \nabla h(x) g(x) > 0, \end{array}\right. } \end{aligned}$$
(6)

where

$$\begin{aligned} k_\textrm{s}(x)=-\frac{\nabla h(x) f(x) + \alpha (h(x))}{\nabla h(x) g(x)}. \end{aligned}$$
(7)

This is often referred to as a safety filter.

Fig. 2.
figure 2

Safe set in the plane of the yaw angle and lateral position.

3.2 Safe Boundary

In order to define the safe set for the lane-keeping scenario, we start by considering lateral position and yaw angle combinations for which the (bounding box of the) vehicle does not cross the lane boundaries. If we denote the half-width of the lane with \(y_\textrm{max}\) and assume that the yaw angle does not exceed \(\pm \frac{\pi }{2}\) (i.e., the vehicle is moving to the positive x direction), then the conditions for the front left and front right corners of the bounding box to stay inside the lane are

$$\begin{aligned} y_\textrm{R} + L \sin \psi \pm \frac{W}{2} \cos \psi \lessgtr \pm y_\textrm{max}, \end{aligned}$$
(8)

where \(+y_\textrm{max}\) denotes the y coordinate of the left boundary of the lane, while \(-y_\textrm{max}\) corresponds to the right boundary of the lane. Similarly, the rear left and rear right corners of the bounding box stay inside the lane if

$$\begin{aligned} y_\textrm{R} \pm \frac{W}{2} \cos \psi \lessgtr \pm y_\textrm{max}. \end{aligned}$$
(9)

We remark that for the kinematic bicycle model (1) without rear overhang, if the vehicle starts within the lane boundaries, then the condition (9) can only be violated after the condition (8) has already been violated. Nevertheless, (9) is still important to ensure that initially the vehicle is located between the lane boundaries. The contour lines corresponding to the four corners of the bounding box touching the lane boundaries are plotted in black in Fig. 2 and the safe set is the area encapsulated by these curves.

However, the non-smooth corners of the resulting safe set make it not suitable for direct safety filter design. In order to define a smooth CBF over the safe set, we first linearize the inequalities in (8) and (9) around \({\psi =0}\). This way the safe set is approximated with a parallelogram in the phase plane, see the blue parallelogram in Fig. 2. Then we define the safe set to be used for the construction of the safety filter as the largest ellipse that can be inscribed in this parallelogram (shown in green in Fig. 2), resulting in a smooth inner approximation of the exact safe set.

It can be shown that the largest ellipse inscribed in a parallelogram touches the parallelogram at the midpoints of its edges. This ellipse can be written as

$$\begin{aligned} F(\psi , y_\textrm{R}) = a \psi ^2 + b \psi y_\textrm{R} + c y_\textrm{R}^2 + d, \end{aligned}$$
(10)

where the parameters a, b, c and d are

$$\begin{aligned} a = -\frac{(W - 2 \, y_\textrm{max})^2}{4} , \quad b = -\frac{(W - 2 \, y_\textrm{max})^2 }{2 \, L } , \end{aligned}$$
(11)
$$\begin{aligned} c = -\frac{(W - 2 \, y_\textrm{max})^2 }{2 \, L^2 } , \quad d = \frac{ (W - 2 \, y_\textrm{max})^4 }{16 \, L^2 }. \end{aligned}$$
(12)

Based on this approximation, the safe set for the design of the safety filter is defined as

$$\begin{aligned} \mathcal {S} = \{y_\textrm{R} \in \mathbb {R}, \, \psi \in (-\pi ,\pi ) : F(\psi ,y_\textrm{R}) > 0 \}, \end{aligned}$$
(13)

and the corresponding CBF is

$$\begin{aligned} h(x) = F(\psi ,y_\textrm{R}). \end{aligned}$$
(14)

Using h(x) in (14) and the linear class-\(\mathcal {K}\) function \({\alpha (r)=\gamma r}\), the safety filter can be calculated according to (7).

Fig. 3.
figure 3

Phase portraits of the controlled vehicle using (a) the nominal controller without the safety filter and (b) the safety-critical controller.

4 Results and Discussion

Figure 3 shows multiple trajectories starting from different initial conditions in the \({(\psi ,y_\textrm{R})}\) plane (without and with the safety filter), for parameter values \({l=2.7}\,\)m, \({L=3.6}\,\)m, \({W=1.8}\,\)m, \({y_\textrm{max}=1.75}\,\)m and \({V=20}\,\)m/s. The control parameters are \({P_y=0.0068}\,\)m\(^{-1}\), \({P_\psi =0.27}\) and \({\gamma =5}\,\). Red dashed lines show the lane boundaries, while the safe set \({\mathcal {S}}\) is bounded by the green ellipse.

It can be seen in Fig. 3(b) that the controller with the safety filter is able to keep the vehicle within the safe set for all initial conditions that are already inside the safe set (see the trajectories in black). In addition, even for the trajectories starting outside of the safe set (colored in gray), the CBF controller greatly reduces the lateral displacement of the vehicle across the lane boundaries. The blue curves in Fig. 3(b) show the switching boundaries, where the controller switches over to the safety filter according to (6). It can be seen that using the selected control gains, the nominal controller in itself is able to keep a large part of the safe set forward invariant and the safety filter is only required near the boundaries of the safe set.

Fig. 4.
figure 4

Numerical simulations (a) without and (b) with the safety filter enabled.

The benefits of the safety filter are further illustrated by the numerical simulations in Fig. 4(a) and (b) (the corresponding red and green trajectories are highlighted in Fig. 3), where the nominal controller in itself violates the safety constraint (panel (a)), while when the safety filter is applied in panel (b), the vehicle is able to return to the center without crossing the lane boundaries.

5 Conclusion

A new approach to lane-keeping control by using a safety filter based on control barrier functions was presented to ensure that the vehicle does not cross the lane boundaries. A smooth and continuous CBF was derived using the kinematic bicycle model and the resulting controller was analyzed using numerical simulations and phase portraits. Phase portraits in the plane of the yaw angle and lateral displacement of the vehicle highlighted the improved dynamics of the controlled vehicle even for large initial conditions, thereby ensuring both stability and safety of lane-keeping.