Path Planning of Mobile Robot Based on Improved Genetic Algorithm

With the continuous development of science and technology, mobile robots are gradually applied to people’s routine life. As one of the key technologies of mobile robots, the performance of path planning algorithms is a significant factor affecting its efficiency. On the basis of using a traditional Genetic Algorithm for path planning, combined with specific application scenarios, this paper proposes a new path planning algorithm for mobile robots. The path smoothness and the number of path corners are added to the fitness function to evaluate the path, so as to select a more superior path. Simulation experiments in MATLAB show the validity and feasibility of the modified method. By comparison to the traditional GA and other classical path planning algorithms, the optimal path selected has fewer turning angles under the same path length, which has a better application effect and greatly improves the working efficiency and stability.


Introduction
With the advent of the era of Industry 4.0 [1], it has become a general trend to use intelligent robots to replace manpower for logistics transportation and warehousing management. Among them, mobile robots are widely used due to their advantages of high-cost performance and strong environmental applicability. As a research hotspot of mobile robots, path planning determines the operation efficiency and application effect of mobile robots and is the key technology for mobile robots to achieve autonomous navigation [2]. Its task goal is to find a collision-free path from the start point to the endpoint in an environment with barriers [3], according to certain evaluation standards such as time, length and consumption of resources.
In order to detect the optimal path, many solutions have been proposed. Common path planning methods include the Dijkstra algorithm, A star algorithm and D star algorithm [4][5] [6] [7]. Dijkstra algorithm solves the shortest path by searching the global space, but its running process is long and it is difficult to meet the requirement of rapidity. The A star algorithm adds a heuristic function on its basis, which reduces the search space and the D star algorithm can use the information calculated by the A star to quickly update the trajectory after the map obstacle or the position of the robot changes. However, because the three search methods are based on the grid eight-neighborhood search method, the obtained paths have many turning points and poor smoothness, which is not suitable for robotic applications. Planning algorithms based on swarm intelligence optimization include Particle Swarm algorithm, Simulated Annealing algorithm, Genetic Algorithm, etc. ZHANG et al. [8]  Optimization (PSO) to improve motion efficiency. This algorithm can effectively optimize the path length, path smoothness and security, but the algorithm is prone to premature convergence. Simulated Annealing (SA) algorithm proposed by GONG et al. [9] can effectively avoid some path exposure problems in node layout. Genetic Algorithm [10] [11] is the most widely used optimal solution processing algorithm, however, the fitness function used in the traditional Genetic Algorithm only considers the length of the path. When specifically applied to mobile robots, there are problems such as not considering the actual constraints of the robot and unreasonable planning paths.
This paper proposes an improved Genetic Algorithm for mobile robots to address the problem. Firstly, by improving the fitness function used in the traditional Genetic Algorithm to make it more suitable for the actual task requirements, then establishing a grid model to simulate the specific application environment and then carrying out the selection, crossover and mutation operation of the Genetic Algorithm and iterate continuously, and calculate the path with short path length and few path corners. MATLAB software is used to verify the simulation experiment and make a comparison of its effect with the traditional Genetic Algorithm and other classical algorithms.

Path planning model
Before path planning, a specific map model needs to be established to represent the working environment of the mobile robot. In this paper, the grid method is an important method for modeling the environment. MATLAB software is used to model the environment map, and the specific model is shown in Figure 1, where the black part is the obstacle grid and the white part is the free grid.

Improved Genetic Algorithm
Genetic Algorithm (GA) was proposed in the 20th century and has been used to solve lots of practical problems. The content of traditional Genetic Algorithm includes population initialization, fitness function and genetic operation.

Population initialization
Population initialization [12][13] is the random generation of multiple initial individuals that can reach the goal. In this paper, initializing the population means randomly generating multiple feasible paths. The idea is that in initialization, one free grid is randomly selected in each row in order, and then all the selected free grids are connected into a continuous path as an initial individual.

Fitness function
In the process of biological genetic evolution, individuals with higher fitness are more likely to be inherited by the next generation [14]. The population probability of the next generation is determined by the fitness function of the parent generation. In the traditional path planning problem, the total length of the taken path is a very important indicator [15]. In this paper the path length is used as a component of the fitness function, which is calculated as: where n is the number of grids in the individual path, d is the length of the individual path. In general, the shorter the length means that the path is better. Therefore, the inverse proportional function is chosen as the fitness function, and its formula is: In practical applications, the time required for a robot to perform corner actions and the required operations are more complex than straight lines. This paper firstly judges whether all the adjacent 3 points in the path form an angle, and imposes a penalty if there is an angle. The basic logic is to find the sum of the distance between the first two points and the distance between the last two points as D1; the distance between the first point and the last point is D2, if D1= D2, it means that the three points do not form an angle, otherwise it proves that an angle is formed, and the sum of the corners is increased by 1. Its specific formula is: D1= (x 1 -x 2 ) 2 +(y 1 -y 2 ) 2 1/2 + (x 3 -x 2 ) 2 +(y 3 -y 2 ) 2 1/2 D2= (x 1 -x 3 ) 2 +(y 1 -y 3 ) 2 1/2 Among them, x , x , x , y , y and y represent the horizontal and vertical coordinates of the three points. A certain penalty can be imposed on the number of corners to plan a better path. The number of corners obtained by the path is sum. In this paper, a penalty of 100 is imposed on each additional angle in the path, and the reciprocal of the sum of all penalties is used as a component of the fitness function to optimize the final path. The calculation formula is: In actual operation, the angle of robot turns should not be too large to ensure speed and attitude stability. The smoother the path, the larger the angle formed by 3 adjacent points in the path, and the larger the angle the larger the distance between 3 adjacent points, so the distance of all adjacent 3 points in the path is added to the fitness function. Its specific formula is: In robot dynamics, the best smoothness is the straight angle, followed by the obtuse angle and right angle, while the case of acute angle does not satisfy the constraints of robot dynamics. We choose to penalize the remaining three cases except for the straight angle and add different penalty coefficients to each case to optimize the individuals that do not satisfy the constraint and obtain a better path. The penalty coefficients selected in this paper are 1, 10 and 1000. In this paper, the reciprocal of the sum of all penalties in the path is used as a component of the fitness function, which is calculated as follows: In the improved Genetic Algorithm proposed in this paper, the final fitness function consists of the path length, the number of corners and the smoothness of the path, with the following formula:

Genetic manipulation 3.3.1 Selection function
Selection function is used to apply the fitness function in the current population for evaluation to determine the probability of being selected for retention. In this paper, the roulette wheel [16] [17] approach is chosen as the selection function. When the population size is n, the probability of individual i being selected for an inheritance to the next generation is:

Crossover function and mutation function
The crossover function and mutation function [18] [19] are the way used to generate new individuals. The single-point crossover is used in this paper [20]. Firstly, we generate a random number between 0 and 1 and determine the crossover probability pc, then make a comparison of them. If the random number is smaller, it means that the crossover operation is performed and if the crossover operation is required, 2 individuals with common crossover points are selected as parents; then the grid paths after exchanging the crossover points of these 2 individuals form new individuals to join the population. Same as above, first the mutation probability pm is determined and a random number from 0 to 1 is generated, perform the mutation operation if the random number is smaller. The steps are: randomly select a feasible path, randomly select a grid on the path as the mutation grid according to the mutation probability, then mutate the mutation grid into any feasible non-repeating free grid in its surrounding upper, lower, left and right, and form a new feasible path as a new individual to join the population.

MATLAB simulation experiment
The initial starting point of the robot in the simulation experiment is set as (0, 0) and the endpoint is (20,20). The number of iterations of the algorithm is taken as 200, the number of populations n=300, the crossover probability pc=0.8 and the mutation probability pm=0.2. Simulation is performed by MATLAB, and the path of the traditional Genetic Algorithm is shown in Figure 2, and the iterative process of the algorithm is shown in Figure 3. The picture shows that the whole algorithm converges after about 45 iterations, and the optimal path length is 29.2132, and there are 14 corners in total. In particular, there is an acute angle in the path, which is to be avoided by the robot motion. In the simulation of this paper, the smoothness of the path and the number of path corners are added as an important evaluation index of the improved fitness function. The results of the improved Genetic Algorithm are shown in Figure 4, and the algorithm iterations are shown in Figure 5. We can see clearly from the figure that the algorithm has converged after about 20 iterations and the optimal path length is 29.2132, while there are only 8 corners in the whole path. It is obvious to see that the number of path corners is less and no small-angle turns in the path if we make a comparison of the effect of the two Genetic algorithms.  Figure 4. Improved Genetic Algorithm path Figure 5. Improved Genetic Algorithm iteration To further verify the superiority of the improved algorithm, simulation experiments of the problem are performed on the MATLAB platform using the classical A star algorithm and D star algorithm. The effect of the A star algorithm simulation is shown in Figure 6 and the effect of the D star algorithm simulation is shown in Figure 7. The effects of the traditional Genetic Algorithm, the improved GA, the A star and D star algorithm are compared on the basis of optimal path length and the average number of corners respectively, and the comparison of the algorithm effects are shown in Table 1. It is obvious to see that the algorithm we improved has better performance.

Conclusion
In this paper, we propose a path planning algorithm for mobile robots. On the basis of the traditional Genetic Algorithm, the path smoothness and the number of path corners are added to the fitness function as other evaluation indicators of the fitness function, achieve the goal of selecting a smoother path with fewer corners, and improve the use efficiency of mobile robots in the application process. In MATLAB, the simulation experiment effect of the improved algorithm and other classical path planning algorithms are compared. The comparison conclusion shows that the improved Genetic Algorithm proposed in this paper generated a path with fewer corners and has a better effect under the condition of the same shortest length. In the future mobile robot path planning algorithm design, it will be a trend to add better algorithms for optimization or advanced technical means such as deep learning and reinforcement learning technology to make them more intelligent and efficient on the current basis, and this paper will further expand the research in this direction in the future work.