Autonomous navigation method of robot, storage medium and processor
By improving the A* algorithm and optimizing the genetic algorithm, the robot can replan its path from its current position when facing unknown obstacles, solving the problem of increased energy consumption in existing technologies and achieving efficient and energy-saving autonomous navigation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2026-03-10
AI Technical Summary
The existing A* algorithm needs to return to the starting point and replan the path when faced with new obstacles, which leads to increased energy consumption.
The improved A* algorithm takes the robot's current position as the starting point, replans the path based on the updated environment map, and combines a genetic algorithm to optimize the path planning, ensuring the shortest path and smoothness.
It enables efficient navigation of robots in unknown environments, reduces energy consumption and computing resource waste, and avoids robots going back and forth on detours.
Smart Images

Figure CN121635294A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of intelligent robot navigation, and particularly relates to a robot autonomous navigation method, a storage medium and a processor. BACKGROUND
[0002] Path planning and obstacle avoidance are key technologies for realizing autonomous navigation of mobile robots. Mobile robot path planning includes three contents: environment representation, planning algorithm and path execution. The evaluation criteria for path planning algorithm mainly include shortest path, least energy consumption and fastest speed. In the process of autonomous navigation, the mobile robot also needs to take measures to avoid obstacles according to the sensor information. According to different environmental information, the path planning algorithm can be divided into two categories: the first category is the global path planning algorithm in known environment; the second category is the local path planning algorithm in unknown environment
[39] . The first category of algorithm is to plan the optimal path for all obstacle information in the existing global map, but it cannot update the path in real time for unknown obstacles. The second category of algorithm dynamically plans a local path through the sensor to obtain local obstacle information, so that the mobile robot has dynamic obstacle avoidance capability, but it is easy to fall into local minimum value point.
[0003] A* algorithm is one of the most widely used complete path planning algorithms at present. Its goal is to find a feasible path from the starting point to the ending point as quickly as possible, so the path planning efficiency is high. However, in A* algorithm, the planned path is composed of particles, which cannot directly consider the shape and size of the moving object, and there is a problem that the obtained path is close to the obstacle.
[0004] At the same time, A* algorithm belongs to global path planning algorithm, which plans the path based on the global map of known environment. If there is an unknown obstacle in the known environment, it will not appear in the environment map at first time, so that in the process of path execution of the foot-wearing building robot, the new obstacle detected may appear on the originally planned path, which will make the robot retreat to the starting point and re-plan a new path, resulting in increased energy consumption of the robot. The prior art has defects. SUMMARY
[0005] The present application aims to provide a robot autonomous navigation method, a storage medium and a processor, which aims to solve the technical problem of increased energy consumption caused by the need for A* algorithm in the prior art to return to the starting point and run new path planning when facing new obstacles.
[0006] In one aspect, the present application provides a robot autonomous navigation method, which comprises the following steps:
[0007] s1. discretize the environment into a two-dimensional map of a regular arrangement of unit grids, each grid is assigned a color, black color represents that the grid has an obstacle, the obstacle has the property of occlusion in the two-dimensional plane; white color represents that the grid is passable;
[0008] s2. the first grid in the lower left corner of the map is numbered 1, the number increases to the right, and when the map boundary is encountered, the number continues to increase from the left side of the last row;
[0009] s3. a white grid on the map is set as the terminal point, the round dot of the robot is used to explore the obstacle near the grid where the round dot is located, and the path planning to the terminal point after avoiding the obstacle based on A* algorithm is performed;
[0010] s4. when the robot advances along the path planning, the grid where the robot is located is taken as the latest starting point, the obstacle is re-explored, and the latest path planning to the terminal point based on A* algorithm is performed;
[0011] s5. repeat step s4 until the round dot coincides with the terminal point.
[0012] In another aspect, the application also provides a computer storage medium, which stores a program file capable of realizing the autonomous navigation method of the robot.
[0013] In another aspect, the application also provides a processor for running a program, wherein the program performs the autonomous navigation method of the robot when running.
[0014] The application is aimed at the complex and changeable construction site environment, in addition to known static obstacles such as walls in the working environment, there are also unknown dynamic obstacles such as building materials that may be transported. The application makes certain improvements to the A* algorithm which belongs to the global path planning algorithm. When a new obstacle is encountered and path planning needs to be performed again, the starting point is changed to the current position of the robot, and a new shortest path from the current position of the robot to the target position is planned according to the updated environment map. On the basis of ensuring as little running time and computing resources as possible, the navigation of the robot in the unknown environment is realized. BRIEF DESCRIPTION OF DRAWINGS
[0015] Figure 1 is a schematic diagram of the robot using the existing A* algorithm for path planning when encountering unknown obstacles;
[0016] Figure 2 is a schematic diagram of the improved A* algorithm for new path planning;
[0017] Figure 3is a schematic diagram of a passable situation in a grid map based on the width of a robot;
[0018] Figure 4 is a flow diagram of a genetic algorithm path planning process;
[0019] Figure 5 is a schematic diagram of a grid map in a simulation environment;
[0020] Figure 6 is a schematic diagram of an optimal path planning obtained by an A* algorithm in a simulation environment;
[0021] Figure 7 is a schematic diagram of a path planning after optimizing an A* algorithm using a genetic algorithm in a simulation environment;
[0022] Figure 8 is a schematic diagram of a comparison of three distance calculation methods in a grid map;
[0023] Figure 9 is a flow diagram of an initialization of a single individual in a genetic algorithm;
[0024] Figure 10 is a flow diagram of a crossover operation in a genetic algorithm;
[0025] Figure 11 is a flow diagram of a mutation operation in a genetic algorithm;
[0026] Figure 12 is a main flow chart of a self-navigation method of a robot according to the present application. DETAILED DESCRIPTION
[0027] In order to make the objects, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.
[0028] The specific implementation of the present application is described in detail below in conjunction with specific embodiments:
[0029] Example One:
[0030] Figure 1 The deficiencies of the existing A* algorithm in planning a path on a map with dynamic obstacles are shown.
[0031] The implementation process of the self-navigation method of the robot provided in the first embodiment of the present application is described in detail as follows:
[0032] As shown in the accompanying Figure 12 The present application provides a self-navigation method of a robot, which comprises the following steps:
[0033] s1. Discretize the environment into a two-dimensional map with regularly arranged cell grids. Each cell is assigned a color: black indicates that there is an obstacle in the cell, and the obstacle has the property of occlusion on the two-dimensional plane; white indicates that the cell is passable.
[0034] s2. The first grid cell in the lower left corner of the map is numbered 1, and the numbers increase to the right. When the map boundary is reached, the numbers continue to increase from the left side of the previous row.
[0035] Specifically, when creating a raster map, the grid starts with the first grid cell from the bottom left corner, numbered 1, and increments to the right. When encountering a map boundary, the increment continues from the left of the previous row. Therefore, the grid coordinates (x, y) for grid cell number N are calculated as follows:
[0036] x=(int)(N / G size );
[0037] y = N%G size ;
[0038] Among them, G size The number of grid cells in each row; (int) is the integer operation; % is the modulo operation.
[0039] The accuracy of environmental representation depends on the size of the cell grid. In a certain area, the smaller the grid, the more grids there are. At this time, the higher the map resolution, the more accurate the map. When the accuracy of the grid map is high enough, the pathfinding algorithm can find a good path in a dense obstacle environment.
[0040] s3. Set a white grid on the map as the endpoint, representing the robot's dot exploring obstacles near the grid where the dot is located, and plan a path to the endpoint after bypassing the obstacles based on the A* algorithm;
[0041] s4. When the robot moves along the planned path, it uses its current grid as the latest starting point, re-explores obstacles, and plans the latest path to the destination based on the A* algorithm;
[0042] s5. Repeat step s4 until the dot coincides with the endpoint.
[0043] This application improves the traditional A* algorithm path planning method by recalculating from a new starting point when an obstacle node appears, thus avoiding collision time loss during robot navigation and transforming navigation from a known environment to an unknown environment.
[0044] As attached Figure 2 As shown, step s4 specifically includes:
[0045] s41. Based on the latest starting point, detect the surrounding environment, and when a new obstacle is detected, project it onto the map;
[0046] s42. If the new obstacle overlaps with the original path plan, the A* algorithm is used again to re-plan the path according to the latest map; if the new obstacle does not overlap with the original path plan, the robot continues to move along the original path plan.
[0047] In practical implementation, for the A* algorithm to be used for navigation in unknown environments, continuous path planning is required during the (construction) robot's path execution. However, continuous path planning during movement significantly increases storage space and computational resources, placing high demands on memory. Therefore, a further improvement to the A* algorithm is to first perform global path planning using the A* algorithm based on a known map. The robot then moves according to the globally planned path and continues to explore the surrounding environment. When an unknown obstacle is detected at the construction site, it is projected onto the environmental map (grid map). If the detected obstacle overlaps with the path, the A* algorithm is used again for path planning based on the latest environmental map; if the detected obstacle does not overlap with the path, the legged construction robot continues to move along the original route.
[0048] Secondly, path planning needs to be recalculated using the robot's current position as the starting point. This is because the A* algorithm calculates the shortest path based on the starting and target points of known environmental information. Figure 1 The dotted line on the left side of the image shows the footed construction robot... Figure 1 When the initial path moves from the starting position to position M, an unknown obstacle is detected that overlaps with the path. If the A* algorithm is used to replan the path based on the updated environment map, the shortest path obtained is as follows: Figure 1 The path shown in the right-hand diagram is Path 1. However, the robot will first return from its current position M to the starting position P, and then move according to Path 1.
[0049] This significantly increases the robot's energy consumption, violating the evaluation criteria for path planning algorithms. Therefore, the improved method for the A* algorithm is to change the starting point to the current position of the legged construction robot when path planning is performed again, and to re-plan the shortest path from the current position of the legged construction robot to the target position based on the updated environment map.
[0050] The improved A* algorithm achieves navigation in unknown environments while minimizing computational resource consumption. Although it does not plan a path from the starting point to the target point on the global map, it avoids the legged construction robot from wandering around and reduces energy consumption.
[0051] Furthermore, in step s1, the cell grid is set as a square, the side length of which is greater than or equal to the robot's passage width.
[0052] Furthermore, in step s1, when the distance between two obstacles is less than the robot's passage width, the distance between the two obstacles is assigned black.
[0053] In specific implementation, see attached Figure 3 As shown, the distance between obstacles A and B is less than the robot's width W, while the distance between obstacles C and D is greater than W. According to the A* algorithm, the area between obstacles A and B is considered passable, and the planned path might pass through this gap. However, the construction robot is large enough that it cannot actually pass through the gap between obstacles A and B. Therefore, the obstacle node area on the grid map is indirectly expanded by a radius, such as... Figure 3 As shown by the dashed box, the area between obstacles A and B becomes impassable, while the area between obstacles C and D remains passable. The value of this expansion radius is related to the size of the robot. This ensures a safe distance between the robot and obstacles, thus enabling global obstacle avoidance for the robot using the improved A* algorithm.
[0054] Furthermore, in step s1, a certain value is assigned between adjacent grid cells, and the difference in value represents the distance between the two points.
[0055] Furthermore, in step s3, the evaluation function of the A* algorithm adopts one of Euclidean distance, Manhattan distance, and diagonal distance.
[0056] Specifically, (1) Manhattan is far from
[0057] The sum of the absolute values of the x and y coordinates between two points in a standard coordinate system is called the Manhattan distance, and its expression is shown in formula (3-3):
[0058] H(n) = |x n -x goal |+|y n -y goal | (3-3);
[0059] Where n is the current node; x n y is the x-coordinate of the current node n; n x is the y-coordinate of the current node; goal y is the x-coordinate of the target node n; goal y is the ordinate of the target node.
[0060] (2) Diagonal distance
[0061] The diagonal distance calculation method is based on the Manhattan distance calculation method, but adds a method for calculating the distance along the line connecting the center points of two diagonally adjacent grid cells. Its expression is shown in formula (3-4):
[0062]
[0063] (3) Euclidean distance
[0064] Euclidean distance can generally represent the true distance between any two points in a standard coordinate system, and its expression is shown in formula (3-5):
[0065]
[0066] Appendix Figure 8 This diagram compares three distance calculation methods. As shown, Manhattan distance is suitable for movement in four directions: up, down, left, and right. Diagonal distance allows movement in eight directions, adding diagonal movement compared to Manhattan distance. Euclidean distance has no such restrictions and allows movement in any direction. However, Euclidean distance is not suitable for some practical situations. This application uses a raster method for representing the environmental map, which is not suitable for movement in any direction. Therefore, Euclidean distance has a relatively large error when used in the A* algorithm of this application for estimation.
[0067] In the applied environment map, the estimated value obtained by the diagonal distance is closer to the true value than the Manhattan distance, which is the shortest distance from the current point to the target point. This allows the algorithm to search for a better path. Therefore, the diagonal distance is the preferred evaluation function of the A* algorithm in this application.
[0068] As attached Figure 4 As shown, step s3 further includes optimizing the path plan calculated by the A* algorithm using a genetic algorithm; including the following steps:
[0069] y1. Define individuals to initialize a certain number of populations. A single individual is a feasible solution to the objective function. In the path planning, a single individual is a feasible path.
[0070] y2. Define the fitness function, which depends on the objective function of the algorithm. For example, in path planning, the fitness of an individual can be defined by the shortest path or the optimal energy consumption.
[0071] y3. Define the rules for selection, crossover, and mutation; this step is set according to requirements and specific problems;
[0072] y4. Define the environment and convergence rules. For example, in path planning, the environment corresponds to map information, and the convergence rules can be selected from one or more of the following: inheritance to a specified generation, fitness, and the objective function reaching a specified threshold.
[0073] y5. After defining these rules, individuals in the population can be selected and evolved generation by generation until the optimal solution is obtained through convergence.
[0074] Among various path planning algorithms, A*, as a global path planning algorithm, can usually obtain the shortest optimal path, while genetic algorithm, as a kind of intelligent path planning algorithm, has good flexibility and scalability. Therefore, this application combines the two to achieve both flexible optimization objectives and fast convergence speed.
[0075] Furthermore, the individual initialization method in step y1 includes:
[0076] y11. Generate a discontinuous but obstacle-free shortest path;
[0077] y12. After obtaining the shortest path, convert the discontinuous path into a continuous path by adding grid numbers.
[0078] For details, see attached. Figure 9 As shown, in step y1, the population is the foundation for the genetic algorithm to obtain the optimal solution. The size and quality of the initial population greatly affect the convergence speed of the algorithm. Individuals are the foundation of the population, and a reasonable definition of individuals will make it easier for the algorithm to obtain the global optimum.
[0079] In this path planning, a grid map is used; therefore, the definition of an individual is closely related to the grid. This application proposes the following rules for defining individuals:
[0080] Each individual is represented by an array of raster numbers. The first number in the array corresponds to the starting point, and the last number corresponds to the ending point. The definition of the numbers is flexible, but this application adopts a rule that the numbers start from 0 at the bottom left corner of the raster map and gradually increase to the right, continuing to increase from the leftmost end of the top row at the map boundary. Each value in the individual's array can be considered a gene, representing the path that corresponds to that individual, starting from the starting point, passing through each raster point, and finally reaching the ending point. Therefore, if the numbers in the array do not conform to a certain rule, such as the presence of impassable obstacles in the raster numbers, or the non-contiguous grid numbers between adjacent numbers, then the individual corresponding to that array is not considered to have a feasible path.
[0081] Initializing the population requires a large number of individuals with feasible paths and randomness. However, if a large number of individuals are generated randomly, as defined above, many of them will not be actually feasible, which will seriously affect the subsequent fitness calculation and genetic process of the algorithm. Therefore, this application proposes the following feasible individual initialization method, which consists of two steps:
[0082] 1) Generate a discontinuous but obstacle-free shortest path. Since the path from the starting point to the ending point must cross a certain number of rows in the raster map (rows are used as an example here, and columns are similar and will not be repeated here), the corresponding feasible path index array must also contain at least one index from each of these rows. Therefore, this application filters non-obstacle passable nodes from each of the crossed rows, randomly selects one from each row, connects the randomly selected passable points in each row together, and adds the starting point and ending point indices to the beginning and end points respectively, thus forming a discontinuous but obstacle-free shortest path.
[0083] 2) After obtaining the shortest path, the second step is to convert the discontinuous path into a continuous path by adding grid numbers.
[0084] The specific addition method is to start from the first element of the individual index array, and then add two adjacent grid indices N in the array. i and N i+1 This determines whether the corresponding grid cells are continuous. The method for determining whether grid cells are continuous is shown in Formula 3-6:
[0085] D = max{|x i+1 -x i |,|y i+1 -y i |} (3-6)
[0086] Where, x i y i x i+1 y i+1 They are respectively the serial number N i and N i+1 The coordinates correspond to the center Cartesian coordinates of the grid, with Max representing the maximum value. I represents the current index, and i+1 represents the next index. The incrementing method starts from the first element of the individual index array and increments by taking the indexes N of two adjacent grid cells. i and N i+1 Determine if the corresponding grid cells are continuous. If D equals 1, it means the two indices N are consecutive. i and N i+1Continuous, otherwise discontinuous. For discontinuous numbers, a continuous path is found through a search. A binary search approach is used here: first, the midpoint M of two discontinuous numbers is found. If the midpoint M corresponds to a non-obstacle in the grid, it is directly inserted into the corresponding position of the original individual. The grid coordinates of M are calculated using the following formula 3-7:
[0087]
[0088] Conversely, if the grid corresponding to the midpoint M is an obstacle and impassable, then the adjacent grids in the four directions above, below, left, and right of point M are explored in sequence. If no point satisfies the conditions after exploring all four directions, the path is deleted. If a passable grid is encountered that does not have the same sequence number as the preceding and following grids in the path (i.e., to avoid spinning in place), the grid number is inserted into the corresponding position in the path. The above steps are repeated until all adjacent grids in the individual are consecutive, thus successfully obtaining a continuous and feasible path, achieving the initialization of a random individual.
[0089] In step y2, fitness determines the direction of individual evolution in the population and must be related to the objective function of the algorithm. In path planning, many algorithms can only plan paths with a single optimization objective; for example, the A* algorithm can only find shorter paths with path length as the optimization objective. A major advantage of genetic algorithms is that the objective function corresponding to fitness can be defined with degrees of freedom. Because (construction) robots are large, energy consumption should be minimized during movement. Therefore, the number of turns during robot movement should not be too many, and a relatively smooth route also facilitates robot movement. The planned path has a smoothness requirement. Therefore, this paper considers path length and smoothness together as the objective function and defines fitness based on this.
[0090] This paper divides the fitness function into two parts, which are used to calculate the path length and smoothness respectively. The fitness function is defined as shown in formula (3-8):
[0091] f(p)=w1fit1(p)+w2fit2(p) (3-8)
[0092] Where p represents the individual whose fitness needs to be calculated; fit1(p) represents the partial fitness determined by path length, and fit2(p) represents the partial fitness determined by smoothness; w1 and w2 represent the weights of path length and smoothness, respectively.
[0093] Since the shorter the planned path length, the better, the fitness fit1(p) with respect to the path length is defined as the reciprocal of the total path length corresponding to the individual. The total length here is obtained by calculating and summing the distances between each pair of adjacent grid cells corresponding to the individual, as shown in equation (3-9):
[0094]
[0095] Similar to path length, this application defines a penalty function for non-smoothness. It calculates the angle formed by the centers of three adjacent grid points within an individual. When the angle is 180°, the path is straight and no penalty is needed. When the angle is 135°, the path is relatively smooth, and the penalty function value is increased by a small value, such as 3. When the angle is 90°, the path is not very smooth, and the penalty function is increased by a slightly larger value, such as 10. When the angle is 45°, the path smoothness is poor, and the penalty function is increased by a relatively large value, such as 25, to prevent individuals in the population from containing such angles. The total penalty function for an individual is the sum of the penalty values corresponding to the angles formed by the grid points corresponding to the individual's grid points. Since a smoother path is better, the final smoothness fitness fit2(p) is the reciprocal of the total penalty function for the individual.
[0096] After defining the two fitness components, w1 and w2 can control the proportion of each fitness component. Similarly, when there are other optimization objectives, the same method can be used to incorporate the overall fitness to obtain a more comprehensive and feasible path.
[0097] The selection operation in step y3 is an important step in simulating the survival of the fittest in organisms. A simple selection method can directly select some individuals with high fitness, but this will bring some problems. For example, some individuals may have low overall fitness, but they may carry some gene segments that are better than those of individuals with high overall fitness. If such individuals are eliminated early due to their low overall fitness, the algorithm may miss the global optimum and get stuck in a local optimum.
[0098] Therefore, this application adopts a probability-based roulette wheel selection method. The steps are as follows:
[0099] (1) Calculate the fitness of all individuals in the population and process them into probability values that sum to 1. The selection probability corresponding to the i-th individual is P. i The calculation method is as follows: formula (3-10);
[0100]
[0101] (2) Based on the selection probability of all individuals, calculate the cumulative probability of individuals in the original order. The cumulative probability of the i-th individual is equal to the sum of the selection probabilities of the first i-1 individuals. The cumulative probability is an array with values gradually increasing from 0 to 1. Each value corresponds to an individual in the original population, but it is not sorted by fitness.
[0102] (3) Randomly generate N random numbers between 0 and 1, where N is the number of individuals to be selected. Arrange these N random numbers in ascending order. Then, starting from the first random value after sorting, determine whether the first value of the cumulative probability array obtained in step 2 is greater than the random value. If it is greater, add the individual corresponding to the cumulative probability to the new population and consider it as selected; if the cumulative probability is not greater than the random value, eliminate the individual and determine whether the next cumulative probability meets the selection condition. After comparing all random numbers with the cumulative probability values, the selection process is complete.
[0103] As can be seen from the above process, the roulette wheel method generally follows the rule that individuals with higher fitness have a greater probability of being selected, but retains some individuals that are not currently the best, effectively avoiding the algorithm from getting stuck in local optima.
[0104] The crossover operation in step y3 is also a crucial step in the genetic algorithm, allowing offspring to inherit superior gene segments from both parents. Based on the characteristics of this individual—that each gene segment corresponds to a continuous, walkable path—these continuous gene segments cannot be arbitrarily disrupted during crossover. Therefore, this application adopts the following rules for the crossover operation:
[0105] (1) Randomly select a pair of parent individuals in the population, and randomly generate a random number R between 0 and 1. If R is greater than the predetermined crossover probability Pc, skip this pair of parents; otherwise, if R is less than or equal to Pc, start the crossover operation as follows.
[0106] (2) Find the intersection point of the parent individuals except the first and last ones. The intersection point is the number that appears in the sequence number of the parent individuals. If the parent has no such intersection point, skip the parent pair; otherwise, find all the intersection points and randomly select one as the intersection point. Swap the part of the parent sequence number array after the intersection point. This completes the crossover operation.
[0107] The specific cross-process flowchart is attached. Figure 10 As shown.
[0108] The mutation operation in step y3 is similar to the crossover operation, but its function is different. It introduces gene fragments into the population that are not limited to the initial individuals. Appropriate mutation can effectively help the algorithm find the global optimum. In the path planning of this application, similar to the crossover operation, it is essential to ensure that the continuity and traversability of the original individuals are not disrupted during mutation. Therefore, this application adopts the following mutation method:
[0109] (1) Take an individual in the population and randomly generate a random number R between 0 and 1. If R is greater than the preset mutation probability Pm, skip this individual and do not mutate it; otherwise, if R is less than or equal to Pm, perform the following mutation operation.
[0110] (2) From the individual's sequence number array, excluding the first and last two numbers, randomly select two numbers as the start and end points of the mutated gene segment. Delete the numbers in the middle of this gene segment, and using the steps of connecting discontinuous paths, generate a completely new gene segment with the mutation start and end points as its starting and ending points. Replace the original gene segment in the original individual, creating the new mutated individual, thus completing the mutation. A flowchart of the specific method is attached. Figure 11 As shown.
[0111] Example Two:
[0112] On the other hand, this application also provides a computer storage medium storing program files capable of implementing the above-described autonomous navigation method for a robot.
[0113] Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as ROM / RAM, disk, optical disk, etc.
[0114] Example Three:
[0115] On the other hand, this application also provides a processor for running a program, wherein the program executes the above-described autonomous navigation method for a robot when it runs.
[0116] In the embodiments of this application, the autonomous navigation method of the robot can be implemented by corresponding hardware or software units. Each unit can be an independent hardware or software unit, or it can be integrated into a single hardware or software unit, which is not intended to limit this application. The specific implementation methods of each unit can be referred to the description of Embodiment 1, and will not be repeated here.
[0117] Example Four:
[0118] In practical implementation, the autonomous navigation method of this application solves the technical problems of the A* algorithm's inability to identify obstacles and passages in grid maps, and the need to return to the starting point and start navigation again when encountering new obstacles that block the original path planning. This achieves the technical effect of relatively fast autonomous navigation to the destination in a construction site environment. The following detailed simulation verification process will illustrate this in more detail.
[0119] The following was built in Matlab. Figure 5The grid simulation environment shown has white grids representing passable areas and black grids representing inflated obstacle areas. The robot can move in eight directions between the grids: up, down, left, right, upper left, lower left, upper right, and lower right. Assume the robot's initial position is at the lower left corner (grid coordinates (1, 1), and the path planning target is the upper right corner (grid coordinates (20, 20)). The grid side length is one unit.
[0120] A* Path Planning
[0121] Based on the aforementioned A* algorithm principle, by continuously traversing the grid in the graph, the robot's path planning from the starting point to the destination was finally achieved. The planned route is shown in the attached figure. Figure 6 As shown by the red line in the image.
[0122] The A* algorithm successfully planned the shortest feasible path, with a total path length of 14 + 12 × √2 = 30.97, in units of grid side length. Although the path is the shortest, it is clear from the graph that the path is not smooth. If the robot travels along this path, it will make multiple turns, increasing its energy consumption.
[0123] Genetic Algorithm Path Planning
[0124] The simulation was performed in the Matlab environment.
[0125] First, individuals are encoded. To facilitate subsequent crossover, mutation, and other operations, as described in Example 1, the two-dimensional horizontal and vertical coordinates of the raster map are converted into one-dimensional indices, starting from 0 at the bottom left corner and gradually increasing to the right and upwards, ending at 399 at the top right corner. Each individual in the genetic population is represented by an index sequence starting with 0 and ending with 399, for example, an individual represented as [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,39,59,79,99,119,139,159,179,199,219,239,259,279,299,319,339,359,379,399].
[0126] After completing the individual encoding, the method for initializing a single individual also needs to be designed. Since some grids corresponding to certain numbers are obstacles and cannot be directly used as path numbers in an individual, nor can they be traversed by the paths formed by the individual, if the initial individuals are generated randomly within the range as in most genetic algorithms, then many individuals will actually be infeasible paths and cannot be further inherited.
[0127] Therefore, this application employs the population initialization method described above to obtain a certain number of feasible paths as the initial population. See attached [document / document]. Figure 4In the process, the fitness of all individuals in each generation is calculated first, and selection is made based on the fitness. Individuals with higher fitness are more likely to be retained. Then, crossover and mutation are performed to try to produce better offspring. To speed up the convergence, this method adopts an elite strategy, that is, the best individual in each generation is retained to avoid being eliminated.
[0128] First, to compare with the path planning results of the A* algorithm, we only use the path index as the fitness index of an individual. The objective function of the genetic algorithm is the path length corresponding to the individual. Therefore, the fitness value is set as the reciprocal of the path length. The shorter the path corresponding to the individual, the smaller the objective function value, and the higher the fitness of the individual, the easier it is to be left behind. The initial population is set to 200 and the number of generations is 100.
[0129] The objective function value corresponding to the best individual in the population converges to 30.97 grid side lengths in the 71st generation. The path is slightly different, but the length is the same as the result obtained by the A* algorithm.
[0130] The path planning algorithm, which uses only the shortest path as the objective function and designs a fitness level, yielded an optimal path, but its smoothness was still not high. Therefore, this application designed an objective function that uses both path length and smoothness as influencing indicators. Specifically, the objective function value is half the sum of the path length and smoothness. When the path is both short and smooth, the smaller the objective function, the higher the fitness. Similarly, the initial population was set to 200, and the number of generations was set to 100. After convergence, the algorithm converged in the 66th generation. The optimal path obtained is shown in the attached figure. Figure 7 As shown.
[0131] The path length is also 30.97 grid squares, but the smoothness of the path is greatly increased. The entire path only has two turns, and walking along this path will effectively reduce energy consumption compared to the previous two turns.
[0132] Compared to the A* algorithm, the genetic algorithm can flexibly set fitness to plan a more suitable route, but its convergence speed is slower, only reaching convergence around the 70th generation. Therefore, this study uses the shortest path obtained by the A* algorithm as elite individuals and adds them to the initial population of the genetic algorithm. Path length and smoothness are optimized simultaneously. The objective function converges in the 20th generation, and the optimal path is the same as the optimal path of the genetic algorithm without A* elite individuals, but the convergence speed is more than three times that of the previous method. It can be seen that combining A* and genetic algorithms, using the shortest path planned by A* as the initial individuals of the genetic algorithm and performing comprehensive optimization, can greatly improve the convergence speed of the genetic algorithm.
[0133] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. An autonomous navigation method of a robot, characterized by, The method comprises the following steps: s1. discretizing the environment into a two-dimensional map of regularly arranged unit grids, each grid being assigned a color, black indicating that the grid has an obstacle, the obstacle having an occlusion property in the two-dimensional plane; white indicating that the grid is passable; s2. the first grid in the lower left corner of the map is assigned a serial number of 1, the serial number being incremented to the right, and if the map boundary is encountered, the serial number is continued to be incremented from the left side of the previous row; s3. setting a white grid on the map as a terminal point, representing a robot dot, exploring the obstacle adjacent to the dot grid, and planning a path to the terminal point after bypassing the obstacle based on an A* algorithm; s4. when the robot advances along the path planning, taking the grid where the robot is located as a new starting point, reexploring the obstacle, and planning a new path to the terminal point based on the A* algorithm; s5. repeating step s4 until the dot coincides with the terminal point.
2. The method of claim 1, wherein, The step s4 specifically comprises: s41. detecting the surrounding environment based on the new starting point, and projecting a new obstacle to the map when the new obstacle is detected; s42. if the new obstacle overlaps with the path planning, reusing the A* algorithm for path planning according to the new map; if the new obstacle does not overlap with the original path planning, the robot still moves along the original path planning.
3. The method of claim 1, wherein, In the step s1, the unit grid is set as a square, and the side length of the square is greater than or equal to the passable width of the robot.
4. The method of claim 1, wherein, In the step s1, when the distance between two obstacles is less than the passable width of the robot, the interval between the two obstacles is assigned a black color.
5. The method of claim 1, wherein, In the step s1, a certain heuristic value is assigned between adjacent grids, and the heuristic value difference represents the distance between two points.
6. The method of claim 1, wherein, In the step s3, the evaluation function of the A* algorithm adopts one of Euclidean distance, Manhattan distance and diagonal distance.
7. The method of claim 1, wherein, In the step s3, the path planning calculated by the A* algorithm is optimized by using a genetic algorithm. The method comprises the following steps: y1. defining an individual to initialize a certain number of populations, and a single individual being a feasible solution of an objective function; in the path planning, a single individual is a feasible path; y2. defining a fitness function; depending on the objective function of the A* algorithm, the shortest path or the optimal energy consumption is used to define the fitness of the single individual in the path planning; y3. defining the rules of selection, crossover and mutation; y4. defining the environment and convergence rules; in the path planning, the environment corresponds to the map information, and the convergence rules select one or more of the following: genetic to a specified number of generations, fitness and objective function reaching a specified threshold; y5. after the rules are defined, the individuals in the population are screened and evolved generation by generation until the optimal solution is obtained.
8. The method of claim 7, wherein, The individual initialization method in the step y1 comprises: y11. generating a shortest path without discontinuity but without obstacles; y12. after the shortest path is obtained, the discontinuous path is converted into a continuous path by increasing the grid serial number.
9. A computer storage medium, characterized in that The computer storage medium stores a program file capable of implementing the autonomous navigation method of the robot in any one of claims 1 to 8.
10. A processor, comprising: The processor is configured to run a program, and the program is configured to implement the autonomous navigation method of the robot in any one of claims 1 to 8.