A method for UAV obstacle avoidance trajectory planning based on digital elevation maps
By using a digital elevation map-based obstacle avoidance trajectory planning method, the path planning problem of UAVs in complex obstacle and overlapping situations is solved, realizing the real-time performance and accuracy of UAV low-altitude flight, optimizing trajectory planning, and reducing computation and data transmission time.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AIR FORCE ENG UNIV OF PLA AIRCRAFT MAINTENACE MANAGEMENT SERGEANT SCHOOL
- Filing Date
- 2022-06-29
- Publication Date
- 2026-05-05
AI Technical Summary
Existing UAV path planning methods struggle to effectively plan paths when dealing with complex obstacles, overlapping obstacles, and reference nodes located within obstacle enclosures, resulting in insufficient real-time performance.
An obstacle avoidance trajectory planning method based on digital elevation maps is adopted. By loading the digital elevation map and converting it into an image, key nodes and paths are extracted from the skeleton map. The optimal trajectory is generated using the A* algorithm. The disjoint-set data structure is combined to determine the connected regions of obstacles, record the intersection points and add them as reference nodes, calculate the local path, and output the optimal obstacle avoidance trajectory.
Taking into account changes in terrain, enabling low-altitude flight of UAVs improves the real-time performance and accuracy of path planning, allows for rapid handling of complex obstacles and overlaps, optimizes flight paths, and reduces computational load and data transmission time.
Smart Images

Figure CN115097870B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of unmanned aerial vehicle (UAV) route planning technology, specifically to a UAV obstacle avoidance trajectory planning method based on digital elevation maps. Background Technology
[0002] With the development of drone technology, the application scenarios for drones are becoming increasingly widespread, such as aerial photography, airdropping supplies, urban firefighting, power line inspection, traffic rescue, and low-altitude penetration. In these application scenarios, in order to achieve autonomous flight of drones, it is often necessary to replan the drone's flight path in real time. This ensures that the drone and its crew can avoid obstacles during flight, safely reach the target location, and thus guarantee the smooth execution of subsequent tasks.
[0003] In the current field of path planning, there are generally two types of methods. The first type uses a static road network to find the shortest path. This type of method utilizes the grid storage method of digital maps and determines an evaluation function based on information such as the distance and threat level between nodes. After searching all nodes, it finally obtains an optimal flight route. However, this type of method has poor real-time performance, which is not ideal for flight missions with high real-time requirements. The second type starts from UAV obstacle avoidance, optimization, and target reachability. It designs path search methods based on a combination of global and local planning strategies. This mainly includes the representation of the environmental space, the generation of the initial elastic zone, the design of methods for the elastic zone to avoid obstacles, and the design of methods for releasing points on the elastic zone. The advantage of this type of method is that it is simple and feasible and can quickly plan a flight path. However, when the shape of the obstacle is relatively complex, it is difficult to find the vertices of the obstacle and it is difficult to handle the problem of obstacle overlap. If the added reference node is located within the encirclement of obstacles, a path cannot be planned. Summary of the Invention
[0004] In view of this, the present invention provides a UAV obstacle avoidance trajectory planning method based on digital elevation maps, which solves the technical problem that existing methods have difficulty in handling path planning in scenarios with complex obstacles, overlapping obstacles, and added reference nodes located within the obstacle enclosure.
[0005] To address the aforementioned technical problems, this invention provides a method for planning obstacle avoidance flight paths for unmanned aerial vehicles (UAVs) based on digital elevation maps, comprising the following steps:
[0006] S1. Load digital elevation map;
[0007] S2. Convert map data into images;
[0008] S3, Load initial waypoints;
[0009] S4. Extract key nodes and key paths from the skeleton diagram;
[0010] S5. Use the A* algorithm to generate the optimal trajectory;
[0011] S6. Determine whether there are obstacles or threat areas on the optimal track generated in step 5. If there are, proceed to step S7; otherwise, proceed to step S13.
[0012] S7. Connect all waypoints, use an algorithm based on the disjoint-set data structure to determine the connected regions of obstacles in the binary image, and extract the boundaries of the connected regions.
[0013] S8. Determine if the path intersects with an obstacle. If it does, proceed to step S9; otherwise, the starting point and the ending point are the path points, and proceed to step S13.
[0014] S9. Record the order and points of intersection with obstacles, and add a reference node between two adjacent obstacles;
[0015] S10, Calculate the local path;
[0016] S11. Determine whether the line connecting each pair of path points intersects with an obstacle. If they intersect, return to step S9; otherwise, generate a local path.
[0017] S12. Determine whether each local path has completed path planning. If all local paths have been calculated, proceed to step S13; otherwise, return to step S10.
[0018] S13. Delete redundant waypoints and output the obtained pathpoints in order.
[0019] S14, Output the optimal obstacle avoidance trajectory.
[0020] Furthermore, digital elevation maps are files stored in hgt format. Each file contains elevation data within a longitude and latitude range, with 1201*1201 sampling points. The file name represents the location information of the lower left corner of the data unit, and the data accuracy is 90 meters.
[0021] Furthermore, the map data is converted into *.bmp format images. The pixel values of the points in the BMP format image represent the data area of the image. The scanning method is from left to right and from top to bottom. This part records the color number corresponding to each pixel. The recording method also depends on the color mode. In a 2-color image, each point occupies 1 bit, and in a 16-color image, each point occupies 4 bits. 8 bits make up 1 byte. The size of the entire data area is related to the color of the image. The calculation formula is: Image data information size = (Image width * Image height * Number of bits for recording pixels) / 8. When storing digital maps, the terrain slope is converted into different color numbers and recorded in the image.
[0022] Furthermore, the digital map conversion method is as follows:
[0023] Step a: Calculate the gradient at each point to obtain a gradient map of the same size as the original digital map. The gradient represents the change in the height difference in the east-west and north-south directions of the surface surface, and is the first derivative of the data elevation model. Its calculation method is as follows:
[0024]
[0025] In the formula:
[0026] P – Topographic gradient;
[0027] f(x) — the rate of change of elevation in the x-direction;
[0028] f(y) — the rate of change of elevation in the y direction;
[0029] The calculation methods for f(x) and f(y) are as follows:
[0030] The third-order inverse distance squared weighted difference is used to calculate f(x) and f(y). The algorithm formula is as follows:
[0031]
[0032]
[0033] In the formula, (Z1,…,Z9) represents the elevation value of each vertex, and l represents the horizontal or vertical distance between grids;
[0034] Step b: Use a thresholding method to segment the gradient map. After segmentation, each point has a value of 0 or 1, resulting in a corresponding binary image. Points with a value of 1 represent valleys or relatively flat terrain, while points with a value of 0 represent steep ridges. The thresholding method is as follows:
[0035]
[0036] In the formula, (x,y) are the planar coordinates of the two-dimensional digital image, f(x,y) is the gray level of the pixel at coordinate point (x,y), and t is the separation threshold;
[0037] Step c: Remove noise points with a value of 1. Detect each point with a value of 1. If the point is in a connected region and the number of points with a value of 1 in the connected region is less than the constant a, then the connected region is considered to be a small flat area on a mountaintop or a small flat area on a ridge. The connected region where this point is located is noise, so it is directly deleted and its value is assigned to 0.
[0038] Step d: Use an iterative refinement algorithm that successively eliminates the target boundary points to perform skeletonization processing on the binary image.
[0039] Furthermore, the method for determining the separation threshold t is as follows:
[0040] b1: Initialize a threshold th to divide the image f(x,y) into two classes, A and B;
[0041] b2: Calculate the mean μ of the pixel sets A and B respectively. A μ B ;
[0042] b3: Calculate the inter-class variances of classes A and B;
[0043] b4: Loop th from 0 to 255 and calculate the inter-class variance for A and B respectively. When the inter-class variance is the largest, the corresponding th is the optimal separation threshold.
[0044] Furthermore, the iterative refinement algorithm is as follows:
[0045] d1: Loop through all points with a value of 1, and mark the pixels that meet the following conditions for deletion:
[0046] (1) 2≤N(P1)≤6;
[0047] (2) S(P1) = 1;
[0048] (3) P2*P4*P6=0;
[0049] (4) P4*P6*P8=0;
[0050] N(P1) represents the number of pixels with a value of 1 among the 8 pixels adjacent to P1, and S(P1) represents the cumulative number of times the value changes from 0 to 1 among the pixels from P2 to P9 to P2.
[0051] d2: Loop through all points with a value of 1, and mark the pixels that meet the following conditions for deletion:
[0052] (1) 2≤N(P1)≤6;
[0053] (2) S(P1) = 1;
[0054] (3) P2*P4*P8=0;
[0055] (4) P2*P6*P8=0;
[0056] Repeat the above two steps until no pixels are marked for deletion in either step. The output is the skeleton after the binary image has been thinned.
[0057] Furthermore, loading the initial waypoint involves reading the configuration file, manually selecting points on the map, and manually entering the initial waypoint information; the initial waypoint information includes waypoint number, longitude, latitude, and altitude.
[0058] Furthermore, the key nodes are the track points in the initial track information and the paths connecting those track points.
[0059] Furthermore, the obstacle can be any three-dimensional object, which includes longitude, latitude, width, and height information; the threat zone is a circular area, which includes the longitude of the center of the threat zone, the latitude of the center of the threat zone, and the radius of the threat zone.
[0060] Furthermore, the method for extracting the boundaries of connected components is as follows:
[0061] Step a: Initialize variable i = 1;
[0062] Step b: Find the position of the first pixel in the background in the binary image, and denote the corresponding equivalence class as the background equivalence class;
[0063] Step c: Traverse the (i+1)th position;
[0064] Step d: If it is located in the background, merge its corresponding equivalence class with the background equivalence class and jump to step i; otherwise, continue to step e.
[0065] Step e: If it is located in the foreground, then detect its four positions: top left, top right, top right, and left, which correspond to the labels of the equivalence classes: (left-top, top, right-top, left). In the corresponding foreground equivalence classes, select the corresponding equivalence class located in the foreground to form a set Clt, Ct, Crt, Cl.
[0066] Step f: If empty, skip to step i; otherwise, continue to step g.
[0067] Step g: Merge the equivalence classes in step e into a single foreground equivalence class, and label the boundary information of the corresponding connected regions starting from 1;
[0068] Step h: Merge all foreground equivalence classes and update the boundary information of the connected regions corresponding to the merged equivalence classes using the same method as in step g;
[0069] Step i: i = i + 1, k is the total number of vertices. If i <= k, then jump to step c; otherwise, the algorithm ends.
[0070] Furthermore, the method for calculating local paths includes the following steps:
[0071] Step a: Use template matching to extract the convex points of obstacles contained in each segment of the local path after segmentation as a vertex set;
[0072] Step b: Treat all points in the vertex set as city points, and use the elastic band formula to sort the vertices of the obstacles and their intersections with the initial path;
[0073] Step c: Perform the point removal operation, deleting points that are far from the city and points inside obstacles;
[0074] Step d: Starting from one intersection point, calculate the distance to the other intersection point in two different directions, and take the city point on the side with the shorter distance as the path point.
[0075] The UAV obstacle avoidance trajectory planning method disclosed in this invention pre-plans the trajectory by combining digital elevation maps and initial waypoint information, using the A* algorithm to plan the optimal path, and the output optimal path data is uploaded to the flight controller via UDP communication protocol to provide a flight route for the UAV.
[0076] The UAV obstacle avoidance trajectory planning method disclosed in this invention involves path replanning by adding obstacles and threat zones to the output of the pre-planned path. This corrects the optimal trajectory output by the pre-planned path, thereby obtaining an optimal trajectory that avoids obstacles and threat zones. Obstacles are any three-dimensional objects, containing longitude, latitude, width, and height information. Threat zones are circular areas, including the longitude, latitude, and radius of the threat zone center.
[0077] By employing the solution of this invention for obstacle avoidance trajectory planning of unmanned aerial vehicles (UAVs), the factors of terrain undulation changes can be fully considered when performing low-altitude flight missions to achieve the goal of flying close to the ground. At the same time, this solution first performs offline trajectory pre-planning and uploads the planned trajectory to the flight controller to provide flight guidance, which effectively solves the problem of low real-time performance. When obstacles or threat areas appear on the pre-planned trajectory, the method provided by this solution can find the vertices of obstacles when the shape of the obstacles is relatively complex, handle the problem of obstacle overlap, and thus quickly plan a flight path.
[0078] The beneficial effects of the above-described technical solution of the present invention are as follows:
[0079] (I) The method of the present invention is based on digital elevation maps for path planning, which fully considers the undulation and change of terrain. Under the specified flight altitude, it can realize low-altitude flight of UAVs.
[0080] (II) The method of the present invention performs binarization conversion, binary map denoising and binary map skeletonization on digital elevation maps, and extracts key nodes and key paths based on these, which greatly improves the real-time performance of existing path planning technology.
[0081] (III) The method of the present invention solves the problem that existing path planning technology only plans for a single scene. It can plan the optimal trajectory when there are no obstacles, and can also optimize and correct the current trajectory after obstacles are added, so as to achieve real-time replanning of the trajectory and thus achieve the purpose of avoiding obstacles or threat areas.
[0082] (IV) When performing local path calculation, the method of the present invention only takes the path on the side with the shorter distance. Compared with the existing technology that searches all local paths, the amount of calculation is reduced, which further improves the real-time performance of path planning.
[0083] (V) After generating the optimal path, the method of the present invention removes redundant waypoints based on the flight performance of the UAV and the distance information of each waypoint, ensuring that the output waypoints are not duplicated or too close together, while reducing the memory of the waypoint file and improving the data transmission rate.
[0084] (VI) The method of the present invention is simple and easy to implement, which can greatly save manpower and material resources. Attached Figure Description
[0085] Figure 1 This is the original digital elevation map of the present invention;
[0086] Figure 2 This is the digital elevation map after format conversion according to the present invention;
[0087] Figure 3 This is the 3x3 movable window of the present invention;
[0088] Figure 4 The digital map generated using terrain gradients according to the present invention;
[0089] Figure 5 This is a schematic diagram of the iterative refinement algorithm in this invention;
[0090] Figure 6 This is a schematic diagram of the skeleton generated in this invention;
[0091] Figure 7 This is a flowchart of the drone obstacle avoidance trajectory planning process of the present invention;
[0092] Figure 8 This is a diagram illustrating the effect of pre-planning the flight path according to the present invention.
[0093] Figure 9 This is a diagram showing the effect of trajectory replanning according to the present invention.
[0094] The labels in the attached diagram have the following meanings: 1-Route, 2-Waypoint, 3-Threat Zone, Z i, (i = 1, 2, ..., 9) represents the elevation of a 3x3 window with center point 5 as the grid points. Detailed Implementation
[0095] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will be described in conjunction with the accompanying drawings of the embodiments of the present invention. Figure 1-9 The technical solutions of the embodiments of the present invention will be clearly and completely described herein. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention are within the scope of protection of the present invention.
[0096] The reference numerals (such as 1, 2, 3...) in the figures in this application are based on the positional relationship of different figures. Different figures have different meanings, so they should not be interpreted as limitations on the scope of protection.
[0097] The drones described in this invention do not specifically refer to any particular model; therefore, any equivalent variations involving obstacle avoidance trajectory planning for unmanned aerial vehicles also fall within the protection scope of this invention.
[0098] In this invention, loading an initial track does not specifically refer to loading a fixed track file, manually selecting on a map, or manually entering initial track information. Any operation requiring the loading of an initial track file also falls within the scope of this invention.
[0099] In this invention, unless otherwise stated, the term "constant" and similar terms should be interpreted broadly. The value can be the constant suggested by this invention, a constant greater than the suggested constant, or a constant less than the suggested constant. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0100] like Figure 1-9 As shown: This embodiment provides a method for planning obstacle avoidance flight paths for unmanned aerial vehicles (UAVs) based on digital elevation maps, including the following steps:
[0101] S1. Load the *.hgt digital elevation map;
[0102] S2. Convert the *.hgt map data into *.bmp format images;
[0103] S3, Load initial waypoints;
[0104] S4. Extract key nodes and key paths from the skeleton diagram;
[0105] S5. Use the A* algorithm to generate the optimal trajectory;
[0106] S6. Determine whether there are obstacles or threat areas on the optimal track generated in step 5. If there are, proceed to step S7; otherwise, proceed to step S13.
[0107] S7. Connect all waypoints, use an algorithm based on the disjoint-set data structure to determine the connected regions of obstacles in the binary image, and extract the boundaries of the connected regions.
[0108] S8. Determine if the path intersects with an obstacle. If it does, proceed to step S9; otherwise, the starting point and the ending point are the path points, and proceed to step S13.
[0109] S9. Record the order and points of intersection with obstacles, and add a reference node between two adjacent obstacles;
[0110] S10, Calculate the local path;
[0111] S11. Determine whether the line connecting each pair of path points intersects with an obstacle. If they intersect, return to step S9; otherwise, generate a local path.
[0112] S12. Determine whether each local path has completed path planning. If all local paths have been calculated, proceed to step S13; otherwise, return to step S10.
[0113] S13. Delete redundant waypoints and output the obtained pathpoints in order.
[0114] S14, Output the optimal obstacle avoidance trajectory.
[0115] Digital elevation maps are files stored in hgt format. Each file contains elevation data within a longitude and latitude range, with 1201*1201 sampling points. The file name represents the location information of the lower left corner of the data unit, and the data accuracy is 90 meters.
[0116] In a BMP format image, the pixel values of each point represent the image's data area. The scanning method is from left to right and from top to bottom. This part records the color number corresponding to each pixel, and the recording method depends on the color mode. In a 2-color image, each point occupies 1 bit, and in a 16-color image, each point occupies 4 bits. 8 bits make up 1 byte. The size of the entire data area is related to the image's color and is calculated using the formula: Image data information size = (Image width * Image height * Number of bits for recording pixels) / 8. When storing digital maps, the terrain slope is converted into different color numbers and recorded in the image.
[0117] The digital map conversion method is as follows:
[0118] Step a: Calculate the gradient at each point to obtain a gradient map of the same size as the original digital map. The gradient represents the change in the height difference in the east-west and north-south directions of the surface surface, and is the first derivative of the data elevation model. Its calculation method is as follows:
[0119]
[0120] In the formula:
[0121] P – Topographic gradient;
[0122] f(x) — the rate of change of elevation in the x-direction;
[0123] f(y) — the rate of change of elevation in the y direction;
[0124] f(x) and f(y) do not necessarily have to be the difference in elevation in the east-west direction or the north-south direction. As long as the two directions they represent are perpendicular to each other, it is fine. For example, if you want to calculate the slope of the terrain at a certain point, you only need to solve f(x) and f(y).
[0125] The calculation methods for f(x) and f(y) are as follows:
[0126] Adopting such Figure 3 The 3x3 moving window shown is used to calculate f(x) and f(y) using the third-order inverse distance squared weighted difference. The algorithm formula is as follows:
[0127]
[0128]
[0129] In the formula, (Z1,…,Z9) represents the elevation value of each vertex, and l represents the horizontal or vertical distance between grids;
[0130] Step b: Use a thresholding method to segment the gradient map. After segmentation, each point has a value of 0 or 1, resulting in a corresponding binary image. Points with a value of 1 represent valleys or relatively flat terrain, while points with a value of 0 represent steep ridges. The thresholding method is as follows:
[0131]
[0132] In the formula, (x,y) are the planar coordinates of the two-dimensional digital image, f(x,y) is the gray level of the pixel at coordinate point (x,y), and t is the separation threshold.
[0133] Step c: Remove noise points with a value of 1. Detect each point with a value of 1. If the point is in a connected region and the number of points with a value of 1 in the connected region is less than a constant a (the value of a is related to the size of the connected region, usually 1 / 3 of the total number of points in the connected region), then the connected region is considered to be a small flat area on a mountaintop or a small flat area on a ridge. The connected region where this point is located is noise, so it is directly deleted and its value is assigned to 0.
[0134] Step d: Use an iterative refinement algorithm that successively eliminates the target boundary points to perform skeletonization processing on the binary image.
[0135] Reason for noise reduction: The generated digital map shows many small gray flyable areas within the non-flyable areas (black areas). This is likely because when using terrain slope as the criterion for distinguishing between flyable and non-flyable areas, there are small, gentle slopes within these mountain ranges. If a drone wants to fly to these flyable areas, it must traverse mountains with steeper slopes, which is obviously impractical in actual flight. For the drone's flight safety and to prevent these small flyable areas from interfering with subsequent flight path planning, this noise needs to be removed.
[0136] Another point to note is the presence of small black patches within the flyable area. This may be due to prominent mountain ranges in the plains. Drones cannot directly traverse such terrain during low-altitude flight. Therefore, these small black patches are points that the planning algorithm needs to avoid and should not be eliminated.
[0137] The method for determining the separation threshold t is as follows:
[0138] b1: Initialize a threshold th to divide the image f(x,y) into two classes, A and B;
[0139] b2: Calculate the mean μ of the pixel sets A and B respectively. A μ B ;
[0140] b3: Calculate the inter-class variances of classes A and B;
[0141] b4: Loop th from 0 to 255 and calculate the inter-class variance for A and B respectively. When the inter-class variance is the largest, the corresponding th is the optimal separation threshold.
[0142] The iterative refinement algorithm is as follows:
[0143] d1: Loop through all points with a value of 1, such as Figure 5 As shown, pixels that meet the following conditions are marked for deletion:
[0144] (5) 2≤N(P1)≤6;
[0145] (6) S(P1) = 1;
[0146] (7) P2*P4*P6=0;
[0147] (8) P4*P6*P8=0;
[0148] N(P1) represents the number of pixels with a value of 1 among the 8 pixels adjacent to P1, and S(P1) represents the cumulative number of times the value changes from 0 to 1 among the pixels from P2 to P9 to P2.
[0149] d2: Loop through all points with a value of 1, and mark the pixels that meet the following conditions for deletion:
[0150] (5) 2≤N(P1)≤6;
[0151] (6) S(P1) = 1;
[0152] (7) P2*P4*P8=0;
[0153] (8) P2*P6*P8=0;
[0154] Repeat the above two steps until no pixels are marked for deletion in either step. The output is the skeleton after the binary image has been thinned.
[0155] Loading the initial waypoint involves reading configuration files in formats such as *.json, manually selecting points on the map, and manually entering initial waypoint information. The initial waypoint information includes waypoint number, longitude, latitude, and altitude.
[0156] The key nodes are the waypoints in the initial track information and the paths connecting the waypoints.
[0157] The obstacle can be any three-dimensional object, which includes longitude, latitude, width, and height information; the threat zone is a circular area, which includes the longitude of the center of the threat zone, the latitude of the center of the threat zone, and the radius of the threat zone.
[0158] The method for extracting the boundaries of connected components is as follows:
[0159] Step a: Initialize variable i = 1;
[0160] Step b: Find the position of the first pixel in the background in the binary image, and denote the corresponding equivalence class as the background equivalence class;
[0161] Step c: Traverse the (i+1)th position;
[0162] Step d: If it is located in the background, merge its corresponding equivalence class with the background equivalence class and jump to step i; otherwise, continue to step e.
[0163] Step e: If it is located in the foreground, then detect its four positions: top left, top right, top right, and left, which correspond to the labels of the equivalence classes: (left-top, top, right-top, left). In the corresponding foreground equivalence classes, select the corresponding equivalence class located in the foreground to form a set Clt, Ct, Crt, Cl.
[0164] Step f: If empty, skip to step i; otherwise, continue to step g.
[0165] Step g: Merge the equivalence classes in step e into a single foreground equivalence class, and label the boundary information of the corresponding connected regions starting from 1;
[0166] Step h: Merge all foreground equivalence classes and update the boundary information of the connected regions corresponding to the merged equivalence classes using the same method as in step g;
[0167] Step i: i = i + 1, k is the total number of vertices. If i <= k, then jump to step c; otherwise, the algorithm ends.
[0168] The method for calculating local paths includes the following steps:
[0169] Step a: Use template matching to extract the convex points of obstacles contained in each segment of the local path after segmentation as a vertex set;
[0170] Step b: Treat all points in the vertex set as city points, and use the elastic band formula to sort the vertices of the obstacles and their intersections with the initial path;
[0171] Step c: Perform the point removal operation, deleting points that are far from the city and points inside obstacles;
[0172] Step d: Starting from one intersection point, calculate the distance to the other intersection point in two different directions, and take the city point on the side with the shorter distance as the path point.
[0173] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for planning obstacle avoidance flight paths for unmanned aerial vehicles (UAVs) based on digital elevation maps, characterized in that: Includes the following steps: S1. Load digital elevation map; S2. Convert map data into images; S3, Load initial waypoints; S4. Extract key nodes and key paths from the skeleton diagram; S5. Use the A* algorithm to generate the optimal trajectory; S6. Determine whether there are obstacles or threat areas on the optimal track generated in step 5. If there are, proceed to step S7; otherwise, proceed to step S13. S7. Connect all waypoints, use an algorithm based on the disjoint-set data structure to determine the connected regions of obstacles in the binary image, and extract the boundaries of the connected regions. S8. Determine if the path intersects with an obstacle. If it does, proceed to step S9. Otherwise, the starting point and the ending point are the waypoints, and step S13 is executed; S9. Record the order and points of intersection with obstacles, and add a reference node between two adjacent obstacles; S10, Calculate the local path; S11. Determine whether the line connecting each pair of path points intersects with an obstacle. If they intersect, return to step S9; otherwise, generate a local path. S12. Determine whether each local path has completed path planning. If all local paths have been calculated, proceed to step S13. Otherwise, return to step S10; S13. Delete redundant waypoints and output the obtained pathpoints in order. S14, Output the optimal obstacle avoidance trajectory; The obstacle can be any three-dimensional object, which includes longitude, latitude, width, and height information; the threat zone is a circular area, which includes the longitude of the center of the threat zone, the latitude of the center of the threat zone, and the radius of the threat zone. Digital elevation maps are files stored in hgt format. Each file contains elevation data within a longitude and latitude range, with 1201*1201 sampling points. The file name represents the location information of the lower left corner of the data unit, and the data accuracy is 90 meters. Map data is converted into *.bmp format images. In a BMP image, the pixel values of points represent the image's data area. The scanning method is from left to right and top to bottom. This section records the color code corresponding to each pixel, and the recording method depends on the color mode. In a 2-color image, each point occupies 1 bit; in a 16-color image, each point occupies 4 bits. 8 bits constitute 1 byte. The size of the entire data area is related to the image's color, calculated using the formula: Image data size = (Image width * Image height * Number of bits for recording pixels) / 8. When storing digital maps, terrain slope is converted into different color codes and recorded in the image. The digital map conversion method is as follows: Step a: Calculate the gradient at each point to obtain a gradient map of the same size as the original digital map. The gradient represents the change in the height difference in the east-west and north-south directions of the surface surface, and is the first derivative of the data elevation model. Its calculation method is as follows: In the formula: P – Topographic gradient; — Rate of change of elevation in the x-direction; —Rate of elevation change in the y-direction; The calculation methods for f(x) and f(y) are as follows: The third-order inverse distance squared weighted difference is used to calculate f(x) and f(y). The algorithm formula is as follows: In the formula, This represents the elevation value of each vertex. Indicates the horizontal or vertical distance between grid cells; Step b: Use a thresholding method to segment the gradient map. After segmentation, each point has a value of 0 or 1, resulting in a corresponding binary image. Points with a value of 1 represent valleys or relatively flat terrain, while points with a value of 0 represent steep ridges. The thresholding method is as follows: In the formula, For the two-dimensional digital image, the planar coordinates are... coordinate point The grayscale levels of the pixels on the screen The threshold value is used for separation. Step c: Remove noise points with a value of 1. Detect each point with a value of 1. If the point is in a connected region and the number of points with a value of 1 in the connected region is less than the constant a, then the connected region is considered to be a small flat area on a mountaintop or a small flat area on a ridge. The connected region where this point is located is noise, so it is directly deleted and its value is assigned to 0. Step d: Use an iterative refinement algorithm that successively eliminates the target boundary points to perform skeletonization processing on the binary image.
2. The UAV obstacle avoidance trajectory planning method based on digital elevation maps as described in claim 1, characterized in that: The separation threshold The method for determining it is as follows: b1: Initialize a threshold , will the image Divided into two categories, A and B; b2: Calculate the mean of the pixel sets A and B respectively. , ; b3: Calculate the inter-class variances of classes A and B; b4: will Iterate through the range 0-255, calculating the inter-class variances of A and B respectively. The value corresponding to the maximum inter-class variance is... This is the optimal separation threshold we are looking for.
3. The UAV obstacle avoidance trajectory planning method based on digital elevation maps as described in claim 2, characterized in that: The iterative refinement algorithm is as follows: d1: Loop through all points with a value of 1, and mark the pixels that meet the following conditions for deletion: (1) ; (2) ; (3) ; (4) ; The Indicates with The number of pixels with a value of 1 among 8 adjacent pixels. Indicates from ~ ~ The cumulative number of times a pixel changes from 0 to 1; d2: Loop through all points with a value of 1, and mark the pixels that meet the following conditions for deletion: (1) ; (2) ; (3) ; (4) ; Repeat the above two steps until no pixels are marked for deletion in either step. The output is the skeleton after the binary image has been thinned.
4. The UAV obstacle avoidance trajectory planning method based on digital elevation maps as described in claim 3, characterized in that: Loading the initial waypoint involves reading the configuration file, manually selecting a waypoint on the map, and manually entering the initial waypoint information. The initial waypoint information includes the waypoint number, longitude, latitude, and altitude.
5. The UAV obstacle avoidance trajectory planning method based on digital elevation maps as described in claim 4, characterized in that: The method for extracting the boundaries of connected components is as follows: Step a: Initialize variable i = 1; Step b: Find the position of the first pixel in the background in the binary image, and denote the corresponding equivalence class as the background equivalence class; Step c: Traverse the (i+1)th position; Step d: If it is located in the background, merge its corresponding equivalence class with the background equivalence class and jump to step i; otherwise, continue to step e. Step e: If it is located in the foreground, then detect its four positions: top left, top right, top right, and left, which correspond to the labels of the equivalence classes: (left-top, top, right-top, left). In the corresponding foreground equivalence classes, select the corresponding equivalence class located in the foreground to form a set Clt, Ct, Crt, Cl. Step f: If empty, skip to step i; Otherwise, continue to step g; Step g: Merge the equivalence classes in step e into a single foreground equivalence class, and label the boundary information of the corresponding connected regions starting from 1; Step h: Merge all foreground equivalence classes and update the boundary information of the connected regions corresponding to the merged equivalence classes using the same method as in step g; Step i: i = i + 1, k is the total number of vertices. If i <= k, then jump to step c; otherwise, the algorithm ends.
6. The UAV obstacle avoidance trajectory planning method based on digital elevation maps as described in claim 5, characterized in that: The method for calculating local paths includes the following steps: Step a: Use template matching to extract the convex points of obstacles contained in each segment of the local path after segmentation as a vertex set; Step b: Treat all points in the vertex set as city points, and use the elastic band formula to sort the vertices of the obstacles and their intersections with the initial path; Step c: Perform the point removal operation, deleting points that are far from the city and points inside obstacles; Step d: Starting from one intersection point, calculate the distance to the other intersection point in two different directions, and take the city point on the side with the shorter distance as the path point.
Citation Information
Patent Citations
Method for detecting and extracting correlation pixels in image and application thereof
CN101957995A
TF / TA2 track programming method based on skeleton drawing
CN105913469A
Black zone-introduced express unmanned aerial vehicle track planning method based on A<*> and ant colony hybrid algorithm
CN108932876A