Obstacle Avoidance Path Planning Strategy for Autonomous Vehicles Based on Genetic Algorithm

In order to enhance the driving ability of autonomous vehicles on structured roads and enable them to plan safe and comfortable paths, we propose an obstacle avoidance path strategy for autonomous vehicles based on genetic algorithm. The use of Frenet-Serret enhances the adaptability of the algorithm in complex environments. In order to improve the generation and optimisation of obstacle avoidance trajectory, we establish an anti-collision model. When the vehicle faces a potential collision with an obstacle, the genetic algorithm quickly iterates and selects the first nine genes to generate the rough solution and convex space of the path. Combined with convex space, the quadratic programming method will numerically optimise the generated rough solution to generate an accurate path that satisfies the constraints. In addition, in order to ensure the safety and comfort in the process of obstacle avoidance, based on the dynamic constraints of the vehicle, the speed planning is used to determine the speed curve. We simulate in various scenarios involving moving obstacles. The real-time simulation based on the HIL platform proves that the proposed path planning strategy is effective in various driving scenarios.


INTRODUCTION
Currently, autonomous vehicle technology has garnered global attention from scholars.Research has demonstrated that driverless cars can significantly reduce the escalating number of traffic accidents [1][2][3].With the aid of high-performance chips, autonomous vehicle technology can make faster decisions and path planning, resulting in an improved driving and traffic safety [4].
Autonomous vehicle systems comprise three modules: perception, planning and control [5].The path planning module plays a crucial role in ensuring ride comfort, convenience and safety.Path planning is divided into two categories: global path planning and local path planning [6].While global path planning designs the path from the starting point to the endpoint based on the map, it cannot update the driving environment in real-time.Therefore, local path planning is necessary as an auxiliary to ensure the safe arrival of autonomous vehicles at the target point [7].
Obstacle avoidance has always posed a significant challenge in the local path planning of driverless cars [8,9].After identifying obstacles, driverless cars must make decisions and devise a suitable obstacle avoidance route to ensure their own safety.Currently, numerous obstacle avoidance planning algorithms have been tested on drones or robots, but there are still several unresolved issues when it comes to autonomous vehicles [10][11][12].
Most obstacle avoidance algorithms for autonomous vehicles can be categorised into two types.The first type is based on traditional obstacle avoidance path algorithms, such as the artificial potential field method (APF) and open space methods [13][14][15].The second type relies on intelligent bionic algorithms, including the whale algorithm, genetic algorithm and particle swarm algorithm.
The artificial potential field (APF) method, a traditional algorithm, draws inspiration from mechanics and generates a repulsion potential field for obstacles and an attraction potential field for the target [16].This enables the vehicle to avoid colliding with the obstacle boundary while driving towards the target [17].By combining the potential field function with the spatial sampling method and employing the Bessel curve for path point smoothing, Zheng et al. [18] achieved the ability for the vehicle to navigate towards the target while effectively avoiding collision with the obstacle boundary.They successfully used the potential field evaluation function to determine the optimal path curve.Yang et al. [19] improved the target point by including a certain range of multi-target points, which altered the direction of gravity and resolved the local minimum problem of the path.However, the APF algorithm may also be prone to falling into local minimums and traps, making it difficult to plan a suitable path in complex scenarios.
The genetic algorithm is a heuristic optimisation algorithm that simulates the natural evolution process and is commonly used to solve search and optimisation problems.Its design inspiration comes from the genetic and natural selection mechanisms in biology.The genetic algorithm searches for the optimal solution by simulating genetic, crossover and mutation operations in the evolution process.Through repeated iterations, the genetic algorithm can gradually optimise individuals in the population and ultimately find an individual or solution set close to or reaching the optimal solution.Rui et al. [20] proposed a hybrid genetic algorithm that transforms the local search process into a mutation operator.This approach not only has a simple structure but also guarantees real-time performance.Liu J et al. [21] proposed a fast path planning method based on an improved genetic algorithm according to the principle of hierarchical path planning.Simulation results show that the optimisation time is significantly shortened.Chen et al. [22] developed an improved genetic algorithm for the path planning of intelligent four-wheeled robots.The algorithm has better convergence speed and optimisation probability than the traditional genetic algorithm.Hou et al. [23] proposed an enhanced ant colony algorithm with a communication mechanism for path planning.Through direct communication between individuals, the integration of historical paths is accelerated, and the path selection rules and heuristic functions are improved to enhance the convergence speed and search efficiency of the algorithm.Liu et al. [24] proposed a path planning method based on an improved grey wolf algorithm, which introduced interference factors and dynamic weights based on the lion optimisation algorithm to avoid the loss of diversity.However, the ability to jump out of local optima needs to be strengthened.Kumar et al. [25] proposed a path planning method combining the artificial bee colony and evolutionary programming algorithm.The artificial bee colony algorithm is used to perform a preliminary search according to the improved strategy, and then the evolutionary algorithm is used to refine the feasible path to reduce the search cost.Xu et al. [26] introduced the disaster strategy and dynamic mutation operator embedded in the A* algorithm into the genetic algorithm to reduce the premature phenomenon and improve the local search ability of the algorithm in the later stage.At the same time, the fitness function with multiple constraints improves the smoothness of the planned path.However, each disaster initialises the population, which reduces computational efficiency.
Genetic algorithm has excellent search performance, can quickly iterate and find the optimal solution [27].Making full use of the suboptimal solution helps to obtain a safer and more reasonable planning trajectory.However, most of the research in this field mainly focuses on the application of mobile robots, and there is little research on obstacle avoidance path planning for autonomous vehicles.In addition, many related studies only consider two-lane, without considering the complex situation of obstacle avoidance in more lanes [28].This paper proposes an obstacle avoidance strategy for driverless cars based on a genetic algorithm.The obstacle avoidance trajectory planning for autonomous vehicles is divided into two modules: path planning and speed planning.The path planning module receives input from perceived obstacle information, global path information and vehicle status information.It consists of convex space, genetic algorithm, numerical optimisation and speed modules.The first three modules work together to solve and optimise a path that satisfies the given constraints, while the speed module adds speed information to the path, resulting in a complete set of path data.Finally, this data is input to the control module and also used as input for the next cycle of the path planning module.
The main contributions of this paper are as follow: 1) Genetic algorithm is used to assist autonomous cars to make light decisions.
2) Genetic algorithm is integrated into three-lane obstacle avoidance trajectory planning.
3) A new security obstacle avoidance strategy is proposed.

MODELLING 2.1 Frenet-Serret
Compared with the traditional coordinate system, the Frenet-Serret can more intuitively represent and understand the position and direction of the vehicle on the curved road.Using Frenet-Serret for path planning will be simpler, more efficient and easier to implement.Suppose that the vehicle is in A (x s ,y s ), Point B (x e ,y e ) is the projection point of the vehicle on the reference line.θ e is its tangent vector angle.
The vehicle heading angle and path curvature can be written in the following form:

Anti-collision model
The anti-collision model is established to ensure that the driverless vehicle has sufficient response distance to deal with emergencies.It can ensure that the driverless car has sufficient ride comfort and safety when performing obstacle avoidance.

Longitudinal anti-collision distance
Based on the Frenet-Serret, the deceleration ability of the autonomous vehicle and the obstacle information, the longitudinal anti-collision distance is established in this paper.

S S S br m
= + (3) where S br is the linear braking reserve distance of the autonomous vehicle.S m is the safe driving distance that needs to be maintained between the front and rear vehicles.S br and S m can be expressed as follows: .
where t 1 sets aside running time for the algorithm, which takes 0.1 seconds here.t 2 represents the time delay of the brake, t 2 = 0.4s.represents the speed of the vehicle.a D_max represents the maximum braking deceleration.The minimum safe stopping distance d D_min = 3.5 .
S m represents the safety distance between the front and rear vehicles.According to Equation 4, it shows a correlation with road adhesion coefficient and vehicle speed.k represents the safety factor, f represents the adhesion coefficient of the ground and the coefficient constant g = 0.3.It is concluded that the safety distance S m between the front and rear vehicles will increase in muddy roads, while when the road is dry, it will decrease.v r represents the relative speed of the two vehicles, which is the absolute value of the speed difference between the two vehicles.

Lateral anti-collision distance
The lateral anti-collision distance of the driverless car is related to whether the driverless car will obliquely collide or rub with the obstacle vehicle during obstacle avoidance.Assuming that the length of all vehicles in this paper is l and the width is w, in order to reduce the amount of calculation for the subsequent algorithm, the lateral safety distance is taken as a fixed value.

Collision warning area
The longitudinal anti-collision distance and the lateral anti-collision distance are combined into a collision warning area.Once a driverless car enters this area, it means that the possibility of collision is greatly increased.
The anti-collision model of the moving obstacle and the collision warning area are shown in the yellow dotted line and the red dotted line respectively.The long axis will change according to the driving direction of the obstacle vehicle.Its expression can be written as follows: where a and b are the major axis of the left and right semi-ellipses, respectively, and c is the short half-axis.
M oving obstacle Static obstacle

Planning path points
Path planning based on genetic algorithm needs to generate path points on the road.The number and arrangement of path points will greatly affect the computational efficiency of the algorithm and the quality of the generated path.Through a large number of experiments, it is concluded that the effect of nine rows and six columns is better.Therefore, this paper chooses to create nine rows and six columns of path points for the vehicle in front of the vehicle.With the aim of covering the entire three-lane structured road, the distance between each line of path points is 0.5 meters.In order to ensure sufficient planning distance, the distance between each column is dynamically adjusted and will change with the speed of the vehicle.When the vehicle speed v e ≤ 10 m/s, the distance of S p =40m is always planned forward; when v e > 10 m/s, the representation of the longitudinal distance for forward planning is as follows: Path planning requires sufficient distance to avoid obstacles.However, planning too far away is meaningless and will increase the amount of calculation.So this paper chooses t 0 =4s.

Encoding
In this paper, each chromosome O p is composed of multiple genes o i and each gene is composed of ).Where a i ,b i ,c i ,d i ,e i ,f i are randomly selected points in each column.Therefore, a gene can be regarded as a path.
Path encoding through path points a i ,b i ,c i ,d i ,e i ,f i (1 ≤ i ≤ 9) can quickly and clearly represent many paths.The specific expression for chromosome O p is as follows:

Initialisation
The generation of the population is related to whether the optimal solution can be quickly solved and whether it will fall into the local optimal solution.Randomly generated individuals will increase the scope of the search and make it easier to find the optimal solution.Due to the fact that excellent individual genes will be retained in the next generation to ensure continuous progress.Therefore, 70% of the individuals in the population will take randomly generated results, 20% of the individuals are obtained through the mutation of the best chromosome and 10% are inherited from the best chromosome of the previous generation.This can ensure that the overall adaptability of each iteration is increased, and 10% inheritance can also avoid the algorithm falling into the local optimal solution.

Selection
In this paper, two steps are taken to screen chromosomes.Each chromosome has its corresponding fitness function value, which is arranged from low to high and the top 10% of the excellent chromosomes are inherited and mutated.Mutation is to replace the three path nodes of the chromosome with an adjacent node.These three points adopt the principle of roulette, and the closer to the obstacle, the easier it is to be selected as the mutation point.The mutation method is not equal probability random, but there is a 60% probability of mutation into a point away from the obstacle and a 40% probability of mutation into a point near the obstacle.
where d i is the distance between the i th point on the gene and the obstacle, p is the probability of being selected according to the distance.k is the normalised coefficient, μ is the distance coefficient.

Mutation
The fitness function of obstacle avoidance needs to consider factors such as comfort, safety and path length [29,30].Therefore, this function consists of multiple parts.In terms of comfort, the lateral displacement and lateral acceleration of the path are limited to ensure that there is no large lateral acceleration.The security of the path will be ensured by the obstacle avoidance model.Once the path planning enters the obstacle avoidance warning area, the value of the cost function will change dramatically.
Cost function can be written as follows: where S lat is the difference between the maximum lateral displacement path point and the road centerline, which represents the lateral displacement cost of the obstacle avoidance path of the autonomous vehicle.
The cost of the lateral acceleration represented by C acc is calculated by the slope of the two points.C col represents the collision cost.If the driverless car enters the prohibited driving area, this cost function will be triggered, expressed as 1, otherwise 0. Generally speaking, the shorter the distance of obstacle avoidance path planning, the better.Therefore, C bk is used to represent the longitudinal distance between the starting point and the end point of obstacle avoidance, i.e. the distance cost.ω 1 , ω 2 , ω 3 , ω 4 are the cost coefficients of these costs, where ω 3 is set to be particularly large to prevent collisions.
Fitness function: Solving feasible convex space In this paper, nine genes after genetic algorithm iteration are selected as the basis for opening convex space.This can avoid ignoring safety due to the cost value, and will not let the autonomous car pursue the optimal fitness function too much.The number of iterations will greatly affect the real-time performance of the algorithm.After a large number of experiments, 60 iterations are selected to balance the quality of the rough solution and the amount of calculation.The points on the rough path are expressed as l i_center .Based on the points on the rough solution of the path, extend l i to both sides to form a passable convex space.The constraint condition of of convex space is as follows: where ∆s is the reserved distance for the convex space and the obstacle.∆θ is the angular difference between the orientation of the vehicle and that of the obstacle.

Optimisation path based on quadratic programming
The rough solution of the path needs to be optimised.The quadratic optimisation is simple and efficient, and can search for the global optimal solution.Moreover, quadratic optimisation can use inequality to represent constraints.Combined with the feasible convex space solved above, this paper chooses sequential quadratic programming as the optimisation method.In the optimisation, we will pay attention to two aspects of safety and comfort.The expression function of the path is as follows: l a a s a s a s a s a s In this paper, the quintic polynomial is selected as the representation of the path to ensure that the planned path has continuous curvature.In order to simplify the calculation and increase the real-time performance of the algorithm, the path planning will be generated in the Frenet-Serret and then converted to the Cartesian coordinate system [31].The motion path point is defined as T i n =(s i ,l i ).In order to meet the safety and occupant comfort of the solution path, the designed cost function consists of the following items: The cost function consists of five parts.J lat is the cost incurred due to lateral displacement.J l_a is the cost associated with the rate of change of lateral displacement.J l_b is the lateral second derivative cost.J col Promet -Traffic&Transportation. 2024;36(4):733-748.
is the collision warning cost.And J lin is the path change cost.The lateral displacement cost is expressed as follows: where n is the overall count of planned path points.The establishment of the lateral displacement cost is to prevent excessive lateral displacement of the driverless car, so that the planning path can complete the target with a smaller lateral movement.However, the limitation of lateral displacement will increase the collision risk of autonomous vehicles, so the collision warning cost is established to maintain a reasonable distance between autonomous vehicles and obstacles.Combined with the above collision warning model, the collision warning cost function can be expressed as follows: where ∆d i represents the distance between the i th path point and the obstacle.σ is a parameter for smoothing the control cost function.Combined with the anti-collision model and collision warning model, the long axes a and b of the left and right semi-ellipses in the model are selected as the judgment conditions for the function to set zero.When G 1 (s i ,l i ) < 2a or G 2 (s i ,l i ) < 2b,it means that the vehicle enters the range of the obstacle avoidance model.At this time, the collision warning cost will generate the value of the corresponding point, limiting the autonomous vehicle to continue to approach the obstacle.Conversely, in other cases, J col = 0.This piecewise cost function helps to improve the security of the path.
The purpose of the collision avoidance warning cost is to prevent the collision between the driverless car and the obstacle.However, this can also lead to a larger lateral acceleration of the driverless car, which is fatal for comfort.Therefore, in order to limit the excessive curvature of the path, the lateral displacement change rate cost is added.The choice is made to employ the second derivative of the lateral displacement to characterise the rate of change of the lateral displacement.The expression is as follows: The lateral displacement changing rate and the second derivative of the lateral displacement of the vehicle can be expressed as follow: The path change cost J lin is used to limit the optimised path.The rough solution path obtained above has determined a better obstacle avoidance direction and path.The optimised path should be based on the direction of the original path (rough solution) and there should not be too many conflicts.
where l i_center is the path point of the rough solution.The difference between the corresponding path points represents the degree of deviation between the optimised path and the coarse solution path.
Thus, by utilising the quintic polynomial of the path to solve for the polynomial coefficients, the aforementioned cost function can be transformed into an expression involving s i .This objective function hopes that the path has smaller curvature and better security.Simultaneously, be-sides satisfying environmental constraints, the path must adhere to the kinematic constraints of the vehicle.To address this, the sequential quadratic programming algorithm is employed for problem resolution.The solution problem can be expressed as follows: : , , , min J a a a r l r l r l l r l e

VELOCITY PLANNING
Speed planning adopts the interpolation method.The time of the discrete points on the path is obtained, and then the time corresponding to the other points on the path is obtained by the difference.The velocity curve can then also be obtained.
The lateral acceleration of the velocity curve must be limited because the friction between the tire and the road is not infinite, and the centrifugal force of the vehicle is provided by the tire.At the same time, excessive lateral acceleration will affect comfort, so the lateral acceleration is limited to obtain a better velocity curve.The restriction expression is as follows: Among them, k i and v i denote the curvature and velocity of the i th path point, respectively.μ represents the coefficient of friction of the road, while a y_m represents the maximum lateral acceleration permissible by the vehicle while ensuring comfort.Speed also needs to be limited to ensure passenger comfort.The speed limit expression is as follows: In reality, driving on the road often encounters road speed limit signs.Therefore, it also needs to be taken into account.Assuming that the maximum speed of the road is v r_m , the maximum speed v max can be expressed as follows: The discrete point velocity and acceleration can be represented by the corresponding time t i .
The distance, velocity and acceleration of adjacent discrete points satisfy the following relationship: .
In speed planning, jerk, excessive acceleration and speed (without obstacles) close to road constraints are three points to be considered.Therefore, the above three are used as optimisation objectives to construct the cost function of speed planning.The function can be expressed as follows: Among them, r acc , r jerk , r ref represent the weight coefficients of each cost respectively.Speed planning can be expressed in following forms: where v ref represents the road reference speed, a max , a min represent the maximum forward and backward acceleration.By transforming the speed planning into the above form to solve the optimisation problem, a more comfortable speed curve can be easily obtained.

SIMULATION RESULTS AND ANALYSIS
In this paper, the semi-physical simulation platform (HIL) is selected as the simulation equipment to verify the above planning strategy in real time.In order to verify the effectiveness of the strategy, three high-probability scenarios were selected, including straight and curved roads.The real-time simulation in this chapter uses a three-lane structured road.Self-driving cars need to determine the direction of lane change on their own.This helps to verify the security of our proposed obstacle avoidance strategy.In the figure, the black implementation represents the road boundary, and the black dotted line represents the lane boundary.The real-time simulation on the HIL platform will prove the effectiveness of the strategy on autonomous vehicles.
At the same time, in order to show the advantages of the strategy, it is compared with the artificial potential field method (APF) [16] and the dynamic programming algorithm (DPM) [32].Table 1 shows the parameters of the simulated vehicle.In the following multi-scene simulation, the generation interval of trajectory planning is 100 ms, while the trajectory tracking interval of autonomous vehicles is 10 ms.For Scenario 1 and Scenario 3, since the cost of avoiding obstacles from both directions is the same, it is assumed that obstacle avoidance will be performed from the left side of the self-driving car (the lane above the figure).Scenario 2 represents a complex three-lane scene, and the algorithm in this paper will choose a safer left side to avoid obstacles.Therefore, other algorithms are also set to avoid obstacles from the left to ensure the rationality of the comparison.The static obstacle avoidance test on the straight road uses a three-lane structural road and static obstacles to verify the most basic obstacle avoidance.The planning trajectories of these three algorithms are shown in Figure 6.Obviously, all algorithms can successfully avoid obstacles and ensure safe driving of autonomous vehicles.However, the algorithm proposed in this paper is the first algorithm to start obstacle avoidance, so there is enough distance to plan a more comfortable trajectory.It can be seen from Figure 7 that although APF can successfully avoid it, the comfort of its planned trajectory is relatively poor.As shown in Figure 7a-7b, the speed of the autonomous vehicle during obstacle avoidance is maintained between 39 and 48km/h, and the longitudinal acceleration is also between −1.7 and 1.3.Compared with the DPM algorithm, the algorithm proposed in this paper has less change in lateral and longitudinal acceleration.At the same time, the front wheel steering angle of the algorithm proposed in this paper is small, which means that the method proposed in this paper has certain advantages in comfort.Scenario 2 aims to simulate more complex scenes in real life.In Scenario 2, the autonomous vehicle needs to complete the test of avoiding multiple obstacles in the curve.Figure 8 shows that the algorithm proposed in this paper needs to select a safe path from nine paths after iteration.The black dotted line represents the path with the best adaptability, which means that after judging the cost function, it gets the highest eval-uation.However, the algorithm recognises that most path selections bypass obstacles on the left side, so it adopts a safer path, i.e. a third path.This is to not to give the algorithm too much insurance for the pursuit of adaptability and cost, only to make the path planned by the algorithm more secure and reliable, and refuse to bring too much stimulation and discomfort to passengers. Figure 9 shows the obstacle avoidance trajectories planned by the APF, the DPM and the algorithm proposed in this paper.It can be seen that the algorithm in this paper begins to perform obstacle avoidance action at a distance of 34 meters from the obstacle, while the DPM and the APF begin planning later.It can be seen from Figure 10 that the proposed algorithm is significantly better than the APF algorithm in terms of longitudinal velocity, longitudinal acceleration, lateral acceleration and front wheel angle.Compared to the DPM, the new algorithm proposed in this paper starts obstacle avoidance earlier, so it is better than the DPM in longitudinal velocity and longitudinal acceleration.This proves that the trajectory planned by the proposed algorithm has better comfort and safety.Scenario 3 tests the situation when the self-driving bike suddenly begins to slow down when it encounters the vehicle in front.Autonomous vehicles need to perform dynamic trajectory planning to bypass the decelerating obstacle vehicles.Moving obstacle vehicles will increase the time and distance required for planning.Figure 11 shows the trajectories planned by the three algorithms.From the diagram, it can be seen that the algorithm proposed in this paper begins to deviate from the lane centre line at a distance of 32 meters from the obstacle, while the APF and the DPM begin to perform obstacle avoidance later.The late lane change time means that a larger steering is needed.This is not only detrimental to safety, but also causes greater lateral acceleration.As shown in Figures 12b and 12d, it can be seen that the proposed algorithm has the smallest change in the front wheel angle and lateral acceleration.In the whole obstacle avoidance process, the velocity difference between the DPM and the APF is 10km/h and 15km/h respectively, which exceeds the new algorithm proposed in this paper.Furthermore, the new algorithm is superior to the other two in the front wheel angle.Therefore, the trajectory planned by the new algorithm has better comfort and fluency than the APF and the DPM.

CONCLUSION
This paper proposes an obstacle avoidance trajectory planning strategy for autonomous vehicles based on genetic algorithm.The new strategy uses the genetic algorithm to quickly iterate to obtain a rough path and to complete the soft decision of the lane change direction.Based on the rough path, the convex space is opened up and the optimisation boundary is limited to reduce the amount of calculation and increase the real-time performance.The quadratic optimisation based on convex space will optimise the coarse solution path and generate a path that satisfies the constraint conditions.Finally, speed planning will give speed information to the path and generate a complete, comfortable and safe obstacle avoidance trajectory.Then, the real-time simulation verification of the new strategy is carried out on the HIL platform.Different from the two-lane road, the three-lane structured road is selected as the simulation experiment section.Scenarios 1 and 3 show the ability of the new strategy in obstacle avoidance trajectory planning on straight roads.Due to the existence of soft decision, and the fact that the cost of lane changing direction is consistent, it is assumed that the lane changing goes from the left side.Scenario 2 selects a three-lane curved road section with multiple obstacles as a simulation scene to simulate a complex scene in reality.Real-time simulation proves that the proposed new strategy will pay more attention to security rather than the cost.On the basis of ensuring sufficient safety, the planned trajectory has certain advantages over the APF and the DPM.Future work will focus on the application of the new strategy in more complex scenarios, and it is planned to deploy it to real vehicles in experiments for wider verification and use.

Figure 1 -
Figure 1 -Structure diagram of the obstacle avoidance strategy

d 1 ,
d 2 represent the half focal length of the left and right ellipses, respectively.The expressions for the major and minor axes of the collision warning area are as follows:

Figure 3 -
Figure 3 -Moving and static obstacle collision warning area

Figure 4 -
Figure 4 -Creating path points S S S S S S S S S S S S S6 ) l max , l min represents the upper and lower bounds of horizontal coordinates.Based on the location of obstacles and the anti-collision distance model, l max , l min can be expressed as follows:

Figure 11 -Figure 12 -
Figure 11 -Comparison of dynamic obstacle avoidance path planning

Table 1 -
Simulation of vehicle parameters