3.1.1. Coordinate Transformation
In order to accurately represent the relative position relationship between the vehicle and the road, the authors of [
19] introduced the concept of the Frenet coordinate system into trajectory planning on structured roads in 2011. Unlike the Cartesian coordinate system, which uses orthogonal lines to construct the coordinate system, the Frenet coordinate system sets the road reference line (curve) as the
x-axis and the orthogonal direction of the road reference line as the
y-axis. The position and state information of the vehicle in both the Cartesian coordinate system and the Frenet coordinate system can be mutually transformed. The transformation principle is illustrated in
Figure 2. Given the known position and state variables of the vehicle in the Frenet coordinate system, represented as
, the corresponding position and state information of the vehicle in the Cartesian coordinate system
can be calculated using the following formulas:
where
is the longitudinal coordinate of the vehicle in the Frenet coordinate system.
is the derivative of the longitudinal coordinate with respect to time in the Frenet coordinate system, representing the velocity along the reference path.
is the second derivative of the longitudinal coordinate with respect to time in the Frenet coordinate system, representing the acceleration along the reference path.
is the lateral coordinate of the vehicle in the Frenet coordinate system.
is the derivative of the lateral coordinate with respect to time in the Frenet coordinate system, representing the lateral velocity.
is the second derivative of the lateral coordinate with respect to time in the Frenet coordinate system, representing the lateral acceleration.
is the derivative of the lateral coordinate with respect to the longitudinal coordinate s in the Frenet coordinate system.
is the second derivative of the lateral coordinate with respect to the longitudinal coordinate s in the Frenet coordinate system.
is the coordinates of the vehicle in the Cartesian coordinate system, represented as a vector
.
is the heading angle of the vehicle in the Cartesian coordinate system.
is the tangent angle of the projected point on the reference path in the Cartesian coordinate system.
is the actual curvature of the vehicle’s path in the Cartesian coordinate system.
is the curvature of the projected point
on the reference path in the Cartesian coordinate system.
is the vehicle speed in the Cartesian coordinate system,
.
is the acceleration in the Cartesian coordinate system,
.
Given the known position and state information of the vehicle in the Cartesian coordinate system
, the calculation of the vehicle’s position and state information in the Frenet coordinate system
can be performed using the following formulas:
When using Equations (1) and (2) for coordinate transformation, there are two possible scenarios where singularities can occur. However, in the rare event that singularities do occur, several approaches can be adopted to address the issue. One approach is to use offset or regularization techniques. By introducing a small offset or regularization term to the equations when such singularities are detected, we can ensure a continuous and well-defined transformation between the Cartesian and Frenet coordinate systems. Another approach is to implement numerical stability checks during the transformation process. By using these approaches, we can enhance the robustness and stability of the coordinate transformation process.
3.1.2. Lane-Changing Path Planning Based on B-Spline Curves
The lane-changing path is generated in the Frenet coordinate system and then transformed to the Cartesian coordinate system through the aforementioned coordinate transformation.
- (1)
Selection of a feasible area for the lane-changing endpoint
In the lane-changing scenario as shown in
Figure 3, the ego vehicle is denoted as
with a velocity of
. During the lane-changing process, the influences of three surrounding vehicles on the ego vehicle are considered. These vehicles are the front vehicle
in the current lane, the front vehicle
in the target lane, and the rear vehicle
in the target lane. Their speeds are denoted as
,
, and
, respectively. The starting time of the lane-changing is denoted as
, and the ending time is denoted as
.
The shape of the lane-changing endpoint distribution area is a rectangle [
28], as indicated by the dashed box in
Figure 4. Within this region, the red dots represent possible lane-changing endpoints. The boundary of this area is defined as follows:
The upper boundary along the direction of vehicle travel is denoted as
, and the lower boundary along the direction of vehicle travel is denoted as
. The upper boundary perpendicular to the lane marking is denoted as
, and the lower boundary perpendicular to the lane marking is denoted as
. The calculation formulas for each boundary are as follows:
where
and
are lane-changing path adjustment coefficients that are related to the driver’s style. The values are smaller for aggressive drivers compared to conservative drivers. Typically,
and
.
represents the minimum safe distance that the vehicle maintains with road boundaries and lane markers. Usually,
.
- (2)
Generation of candidate lane-changing paths
There are many types of geometric curves used to generate lane-changing paths. Different geometric curves require different input information and unknown parameters and result in different path qualities. In this paper, we adopt B-spline curves to generate lane-changing paths. The lane-changing paths generated using this method ensure curvature continuity, and the curvatures at the starting and ending points of the lane-changing match those of the reference path. Assuming we have
as a set of
control points that define the direction and bounds of the spline curve, the definition of a
-th B-spline curve is as follows:
where
represents the
-th
th-order B-spline basis function, corresponding to the control point
. Here,
, and
is the independent variable. The basis functions have the following recursive formula:
where
represents a set of continuously changing values known as the knot vector, which is a non-decreasing sequence. The initial and final values are typically defined as 0 and 1, respectively, that is,
and
. This sequence is denoted as
, and it satisfies
. To alter the shape of the B-spline curve, one or more control parameters can be modified, such as the position of control points, the location of knots, or the degree of the curve.
The 4th-order quasi-uniform B-spline curve is used in this paper to generate lane-changing paths, as shown in
Figure 5. By selecting six control points based on the lane-changing starting and ending points, a curvature-continuous lane-changing path can be generated, represented by points A, B, C, D, E, and F in
Figure 5. The initial position of the vehicle at the lane-changing starting point is defined as point A, while any sampled point within the feasible region in
Figure 4 can be chosen as the lane-changing endpoint, represented by point F. According to the characteristics of the quasi-uniform B-spline curve, when points A, B, and C, as well as D, E, and F, lie on the same line parallel to the lane centerline (i.e., ABC//DEF//lane centerline), it is possible to achieve zero curvature at the lane-changing starting and ending points. To ensure that the generated lane-changing path is symmetric about the centerline, it is required that ABC and DEF exhibit symmetric distributions. Therefore, by determining the positions of points B and C, a lane-changing path based on a 4th-order quasi-uniform B-spline curve can be generated. To ensure the optimality of the generated lane-changing path between the starting point A and the ending point F, this paper evaluates the quality of the lane-changing path using two metrics: path length and average curvature. Path length reflects the distance traveled during the lane-changing process, while average curvature represents the comfort of lateral vehicle control during the lane-changing process. By employing a multi-objective linear weighting approach, the lane-changing path evaluation function can be formulated as follows [
29]:
where
and
are the weighting coefficients of the sub-objective functions;
represents the distance between adjacent waypoints
and
in the lane-changing path;
denotes the curvature corresponding to waypoint i in the lane-changing path, which can be estimated assuming that three consecutive waypoints lie on the same circle; and
represents the number of waypoints included in the path.
By using a linear weighting approach, the combination of path length and average curvature is used as the optimization objective. Through an optimization algorithm, the positions of points B and C can be determined, thus selecting the six control points based on the lane-changing starting and ending points. Additionally, to simplify the optimization process and improve the efficiency of the path search, AB is set to be equal to AC, transforming the two-dimensional optimization problem into a one-dimensional optimization problem. Considering the differences in scale between path length and curvature, in the process of constructing the optimization objective, each of them is normalized and then combined through weighted summation to obtain the comprehensive optimization objective function.
Figure 6 shows the optimization results of lane-changing path control points under different weight distributions. It can be observed that with different weights, different path control points can be obtained, thereby affecting the shape of the generated lane-changing path when the starting and ending points of the lane-changing path are the same. When
and
, the optimal path control points correspond to
and
. When
and
, the optimal path control points correspond to
and
. When
and
, the optimal path control points correspond to
and
.
By using equidistant sampling within the possible region of lane-changing endpoints, multiple lane-changing target endpoints can be generated. Similarly, using the same approach, the candidate lane-changing paths can be generated, as shown by the solid red lines in
Figure 4.
- (3)
Collision checking for static obstacle
In this paper, the vehicle collision checking is performed using the dynamic circle envelope method.
circles with the same radius are uniformly placed to cover the minimum bounding rectangle of the vehicle contour. The radius of the envelope circle is equal to half of the vehicle width.
represents the envelope circle corresponding to the rear position of the vehicle, while
represents the envelope circle corresponding to the front position of the vehicle. The center coordinates of
and
can be calculated based on the vehicle’s centroid position obtained from the vehicle positioning system and the vehicle’s size information. Let the center coordinates of
and
be denoted as
and
, respectively. The calculation formula for the center coordinates of any envelope circle
of the vehicle is as follows:
where
is the independent variable defined on the interval
, and it is an integer.
The collision detection between two vehicles based on dynamic circular envelopes can be transformed into determining whether there is an overlapping region between any envelope circle covering the ego vehicle and any envelope circle covering the surrounding vehicles. The existence of overlap between two circles can be determined based on the distance between their centers. Therefore, in the scenario depicted in
Figure 7, the collision detection condition between vehicle 1 and vehicle 2 can be represented as follows:
where
and
represent the S-axis coordinates of the centers of any enveloping circles for vehicle 1 and vehicle 2, respectively.
and
represent the L-axis coordinates of the centers of any enveloping circles for vehicle 1 and vehicle 2, respectively.
and
represent the radii of the envelope circles for vehicle 1 and vehicle 2, respectively, which are equal to half of the corresponding vehicle’s width.
Additionally, it is necessary to ensure that the vehicle remains within the boundaries of the road while driving along the planned waypoints. This can be achieved by checking whether there is an intersection between any envelope circle covering the vehicle and the lane boundaries.
3.1.3. Velocity Planning Using DP and QP
The task of velocity planning is to assign time-related information, such as speed, acceleration, etc., to the lane-changing waypoints, thereby completing the trajectory planning task.
- (1)
Establishment of temporal and spatial graphs
- 1.
Trajectory prediction of surrounding vehicles
For lane-changing scenarios, considering that lane-changings typically occur over a short duration, a constant acceleration (CA) model in the Frenet coordinate system is often chosen to predict the motion trajectory of surrounding vehicles. In this model, the state variables of a vehicle include the longitudinal coordinate
, lateral coordinate
, heading angle
(counterclockwise as positive) with respect to the S-axis, velocity
, and acceleration
, denoted as follows:
If the sampling period is denoted as ∆
T, then the vehicle state transition equation for the constant acceleration model can be expressed as follows:
According to this state transition equation, if the initial states of surrounding vehicles at the beginning of the lane-changing are known, the CA model can be used to obtain the predicted trajectories of surrounding vehicles within the prediction time domain.
- 2.
Potential conflict detection for a lane-changing path
Based on whether there is an overlap between the predicted trajectories of surrounding vehicles and the candidate lane-changing paths generated in the previous steps, the potential conflict risk of the lane-changing path is determined. If there is no overlap between the predicted trajectories of surrounding vehicles and the lane-changing path, the velocity planning task does not need to consider the influence of that vehicle. However, if there is an overlap, it is necessary to conduct velocity planning for the lane-changing path to avoid the risk of collision with that vehicle. The method for assessing the potential conflict between the lane-changing path and surrounding vehicle A is as follows:
where
represents the coordinates of the center of any enveloping circle of surrounding vehicle A in the Frenet coordinate system, and
represents the coordinates of any point on the lane-changing path in the Frenet coordinate system.
and
, respectively, represent the radii of the enveloping circle of the ego vehicle and vehicle A, which are equal to half of the corresponding vehicle’s width.
If for any waypoint on the predicted trajectory of surrounding vehicle A and any point on the lane-changing path, the equation mentioned above is satisfied, there is no potential conflict between surrounding vehicle A and the ego vehicle. Conversely, if the equation is not satisfied, there is a potential conflict between surrounding vehicle A and the ego vehicle, and the velocity planning task needs to consider the influence of that vehicle, as shown in
Figure 8a.
According to the aforementioned steps, the potential conflicts between the vehicle
, vehicle
, and vehicle
with the ego vehicle are determined. The surrounding vehicles with conflicts are selected, and the starting time
and ending time
of the conflicts, as well as the coordinates of the corresponding roadway points in the Frenet coordinate system, are recorded. Any moment with a potential conflict is denoted as
. The set of waypoints where the candidate lane-changing path and surrounding vehicles have potential conflicts is defined as the potential conflict zone
. All waypoints within the potential conflict zone at any moment of potential conflict are plotted in a coordinate system with time t as the horizontal axis and coordinate
S in the Frenet coordinate system as the vertical axis, forming a temporal and spatial graph as shown in
Figure 8b, commonly referred to as the ST graph. The slope of the curves in the ST graph can be used to determine the velocity trend: the steeper the slope, the faster the corresponding velocity. In
Figure 8b, the solid red line represents the vehicle’s acceleration process, and the dashed blue line represents the vehicle driving at constant speed.
- 3.
Discretization of the temporal and spatial graph
To employ DP for velocity planning, the ST graph needs to be discretized. Based on calculation efficiency, planning time domain, and path length, an appropriate sampling interval is chosen to discretize the ST graph uniformly, as shown in
Figure 9. It should be noted that the speed varies between cells but remains constant within each cell. The blue-shaded area in
Figure 9 represents the potential conflict zone between the surrounding vehicle and the ego vehicle along the planned path in
Figure 8a. Both the solid red line (vehicle acceleration for overtaking) and the dashed blue line (vehicle driving at a constant speed) overlap with the potential conflict zone, indicating unsafe velocity planning. The solid green line in the figure represents a velocity planning scheme that involves deceleration to avoid collisions with surrounding vehicles, meeting safety requirements.
- (2)
Velocity generation and smoothing
The velocity planning process involves two steps: initial velocity generation and velocity smoothing.
- 1.
Velocity generation based on DP
The initial velocity generation method based on DP transforms the velocity planning problem into a multi-stage decision optimization problem using the discretized ST graph.
In each stage, the selectable S-axis coordinate position is related to the adjacent previous stage’s vehicle position, velocity, and maximum acceleration. In the discretized ST graph shown in
Figure 9, the time series obtained by discretizing the horizontal axis with an equal interval
are denoted as
, where
is the end time of the lane-changing. The mileage sequence obtained by discretizing the vertical axis with equal intervals
is denoted as
, where
corresponds to the end point coordinate
of the lane-changing. To evaluate the cost of the state transition, the velocity
, acceleration
, and jerk corresponding to state
at stage
are calculated according to the following formulas:
The optimization objective function for initial velocity generation using DP is defined as follows:
where
,
, and
represent the weights of each sub-objective function. The first term of the objective function guarantees that the generated velocity is sufficiently smooth. The second term primarily aims to improve the efficiency of the lane-changing process, ensuring that the vehicle reaches the destination of the lane-changing as quickly as possible. The third term is mainly used to evaluate the distance between the ego vehicle and surrounding obstacle vehicles, ensuring safety.
The specific form of the objective function for smoothness, which is the first term, is as follows:
The specific form of the objective function for efficiency, which is the second term, is as follows:
The specific form of the objective function for obstacle avoidance, which is the third term, is as follows:
where
represents the relative distance between the ego vehicle and surrounding obstacle vehicles.
is the minimum safe distance between the ego vehicle and the rear vehicle in the target lane during the overtaking process. It depends on the ego vehicle’s velocity and mass, and a recommended range is 50–100 m.
is the minimum safe distance between the ego vehicle and the front vehicle in the target lane during the following process. It also depends on the ego vehicle’s velocity and mass, and a recommended range is 50–100 m.
and
represent the minimum and maximum values of the potential conflict region between the ego vehicle and surrounding obstacle vehicles at stage
on the ST graph.
To improve the efficiency of velocity generation using DP, the state variable
at stage
during the search process can be constrained by the following conditions:
The first constraint ensures that the vehicle can only move forward and is not allowed to move backward. The second constraint states that the generated velocity must be lower than the vehicle’s maximum designed speed . The third constraint specifies that the vehicle’s acceleration cannot exceed the maximum acceleration capability of the vehicle.
The velocity generated through DP is optimal, but due to the discretization process, the resulting ST curve is represented as a piecewise linear curve, as shown by the solid green line in
Figure 10. The slope of this curve represents the velocity, but the slope is not continuous. Therefore, further smoothing is required for the ST curve.
- 2.
Velocity smoothing based on QP
To generate a smooth velocity profile, a fifth-degree polynomial is used to connect adjacent state
and
obtained from the ST curve generated using DP. For the discrete ST curve composed of
states, the smoothed ST curve is formed by connecting the
segments of fifth-degree polynomial curves. The expression for each segment of the polynomial curve is as follows:
The definition of the objective function for smoothing the ST curve includes three aspects: acceleration, jerk, and position error.
where
,
, and
represent the weight coefficients of the sub-objective functions.
and
represent the start and end times of the
i-th segment of the fifth-degree polynomial curve. Since the ST curve generated through DP in the previous steps is uniformly sampled in the time dimension, the time period of each polynomial curve segment is equal, that is,
.
The vehicle velocity smoothing problem based on QP includes three types of equality or inequality constraints, as described below.
First, there are equality constraints for the position, velocity, and acceleration at the connecting points between adjacent polynomial curves.
Second, the first segment of the polynomial curve should satisfy the equality constraints for the starting position, velocity, and acceleration of the original ST curve.
Finally, all position points need to satisfy the corresponding maximum limit constraints for position, velocity, and acceleration.
By combining the objective functions and constraints mentioned above, solving the QP problem will yield a smooth ST curve, which corresponds to a smooth velocity planning result. As shown in
Figure 10, the red dashed line represents the ST curve obtained after smoothing.
- (3)
Curvature checking of a lane-changing trajectory
The curvature check considers the minimum turning radius and prevents the vehicle from experiencing side slip during the turning process. First, the radius corresponding to the maximum curvature
of the trajectory should be greater than the vehicle’s minimum turning radius
. Second, to prevent side slip during the turning process, the lateral force during steering should not exceed the maximum available tire grip. Considering vehicle stability, the absolute value of the maximum lateral acceleration should be less than 0.4 g. Based on these considerations, the following constraint relationship between the trajectory curvature radius
ρ and the planned vehicle speed
can be derived as follows:
By performing curvature checking on the lane-changing trajectory, candidate feasible lane-changing trajectories can be generated that satisfy the constraints of the minimum turning radius and prevent lateral slip from occurring.