Method and device for generating obstacle avoidance route of unmanned aerial vehicle and electronic equipment
By obtaining endpoint information and path planning algorithms for the no-fly zone segment, we automatically generate drone obstacle avoidance routes, solving the route omissions and obstacle avoidance problems in complex environments caused by manual planning in the existing technology, and achieving rapid and natural Route optimization.
Patent Information
- Application Number
- CN202411364766.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-01-10
AI Technical Summary
The existing drone route planning methods require manual operation, which can easily lead to omissions and it is difficult to avoid no-fly areas and dangerous areas in complex environments, resulting in accidents such as plane crashes and deaths.
By obtaining the endpoint information of the no-fly zone segment in the drone planned route, determining the location of the endpoint, and determining the passable and non-passable areas, using the path planning algorithm to generate obstacle avoidance routes, including deep reinforcement learning algorithms, A* path planning, etc. , automate the planning of routes.
It realizes rapid route updates and automated obstacle avoidance optimization in complex environments, avoiding plane crashes and deaths, and the generated routes are natural, smooth and smooth.
Smart Images

Figure CN119292301A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of unmanned aerial vehicles, and in particular to a method, a device and an electronic device for generating an obstacle avoidance route for a unmanned aerial vehicle. Background Art
[0002] Obstacle avoidance technology is an important branch of the field of autonomous navigation of unmanned systems. It involves autonomous robots such as drones and unmanned vehicles being able to sense obstacles in the surrounding environment when performing tasks, and planning a safe route to avoid obstacles in real time. This technology is crucial to ensure the safe operation of unmanned systems in complex environments, especially in application scenarios such as reconnaissance, search and rescue, agricultural plant protection, and logistics distribution.
[0003] The most commonly used route planning method is to manually plan the UAV mission route on a two-dimensional digital map in the UAV ground control station software. This route planning method requires manually setting the latitude and longitude coordinates of multiple waypoints, and then the UAV ground control station software automatically connects the waypoints to draw the UAV flight route. The planned route is then uploaded to the UAV via a data link, and the UAV begins to fly according to the planned route.
[0004] There are several ways to manually draw and plan routes:
[0005] 1) Manually add waypoints on the map with the mouse and draw the route independently.
[0006] 2) Manually add points of interest (such as reconnaissance target points) on the map using the mouse, and then automatically generate circular waypoints around the points of interest and connect them into routes.
[0007] However, due to the limitations of personnel's personal abilities, manually drawn routes are prone to omissions, and the planned routes often cross dangerous areas such as no-fly zones and areas with complex meteorological environments, which in turn lead to disasters such as aircraft crashes and fatalities. In addition, for some complex, dynamic, multi-constrained, and highly uncertain reconnaissance environments, the operators of the drone ground control station software cannot ensure that the planned routes can cope with various emergencies, and the planned routes will almost inevitably cross dangerous areas. Therefore, how to quickly and effectively automatically plan new routes to meet obstacle avoidance needs is a technical problem that needs to be solved urgently. Summary of the invention
[0008] In view of the above analysis, the embodiments of the present invention aim to provide a method, device and electronic device for generating an obstacle avoidance route for a drone, so as to solve the technical problem of how to quickly and effectively automatically plan a new route to meet the obstacle avoidance requirements.
[0009] In a first aspect, an embodiment of the present invention provides a method for generating an obstacle avoidance route for a drone, comprising the following steps:
[0010] Step S10: Obtaining the location information of the two end points of the flight segment that passes through the no-fly zone in the planned route of the drone;
[0011] Step S20: Determine whether the two endpoints of the flight segment passing through the no-fly zone are outside the no-fly zone. If so, proceed to step S30; otherwise, determine multiple interconnected flight segments whose two endpoints are both outside the no-fly zone from the planned route of the drone, and proceed to step S30; wherein the multiple interconnected flight segments include the flight segment passing through the no-fly zone;
[0012] Step S30: setting the two endpoints outside the no-fly zone as a starting point and an end point, and determining a passable area and a non-passable area according to the position information of the starting point, the end point and each vertex of the no-fly zone; and
[0013] Step S40: Generate an obstacle avoidance route from the starting point to the end point using a path planning algorithm based on the traversable area and the non-traversable area.
[0014] Based on a further improvement of the above generation method, determining whether the two endpoints of the flight segment passing through the no-fly zone are outside the no-fly zone includes:
[0015] Draw a ray from the endpoint in the direction of the target;
[0016] Whether the endpoint is outside the no-fly zone is determined according to the number of intersections between the ray and the line segments of the no-fly zone.
[0017] Based on a further improvement of the above generation method, judging whether the endpoint is outside the no-fly zone according to the number of intersections between the ray and the line segments of the no-fly zone includes:
[0018] Step 101: Determine whether the intersection point of the ray and the line segment of the no-fly zone contains the vertex of the no-fly zone. If so, and the number of intersection points that are the vertices of the no-fly zone is an odd number, proceed to step 102; otherwise, proceed to step 103;
[0019] Step 102: Determine whether the number of intersections between the ray and the line segment of the no-fly zone minus 1 is an odd number, if so, the endpoint is within the no-fly zone; otherwise, the endpoint is outside the no-fly zone;
[0020] Step 103: Determine whether the number of intersections between the ray and the line segments of the no-fly zone is an odd number. If so, the endpoint is within the no-fly zone; otherwise, the endpoint is outside the no-fly zone.
[0021] Based on further improvement of the above generation method, multiple interconnected flight segments whose two endpoints are both outside the no-fly zone are determined from the planned route of the drone, including:
[0022] If the starting point of the two endpoints of the flight segment passing through the no-fly zone is within the no-fly zone, then determine whether the waypoints adjacent to the starting point are outside the no-fly zone in turn along the upstream direction of the planned route of the drone, until the first waypoint that is not within the no-fly zone is found;
[0023] If the destination point of the two endpoints of the flight segment passing through the no-fly zone is within the no-fly zone, then the waypoints adjacent to the destination point are determined in sequence along the downstream direction of the planned route of the drone to determine whether they are outside the no-fly zone until the first waypoint that is not within the no-fly zone is found.
[0024] Based on the further improvement of the above generation method, judging whether the waypoints close to the departure point or the destination point are outside the no-fly zone includes:
[0025] Draw a ray from the endpoint in the direction of the target;
[0026] Whether the waypoint is outside the no-fly zone is determined according to the number of intersections between the ray and the line segments of the no-fly zone.
[0027] Based on the further improvement of the above generation method, according to the position information of the starting point, the end point and each vertex of the no-fly zone, determining the passable area and the non-passable area includes:
[0028] Determine a rectangular area according to the maximum longitude value, the minimum longitude value, the maximum latitude value, and the minimum latitude value of each vertex of the starting point, the end point, and the no-fly zone;
[0029] Dividing the rectangular area into grids according to a preset grid resolution;
[0030] It is determined whether each grid intersects or overlaps with the no-fly zone. If so, the grid is marked as a non-passable area; otherwise, the grid is marked as a passable area.
[0031] Based on a further improvement of the above generation method, the preset grid resolution is determined by the distance between the starting point and the end point.
[0032] Based on the further improvement of the above generation method, the path planning algorithm includes any one of the following:
[0033] Deep reinforcement learning algorithm, A* path planning algorithm, bidirectional A* path planning algorithm, Dijkstra algorithm.
[0034] Based on the further improvement of the above generation method, the obstacle avoidance route is a route interconnected by multiple grid center points in sequence, and the generation method further includes:
[0035] Using a first filtering algorithm to filter out waypoints at the same latitude in the obstacle avoidance route in the latitude direction, wherein the first filtering algorithm comprises the following steps:
[0036] Step S111: selecting three consecutive waypoints in the obstacle avoidance route and comparing the latitude values of the three consecutive waypoints;
[0037] Step S222: If the latitude values of the three consecutive waypoints are the same, then the middle waypoint among the three consecutive waypoints is discarded, otherwise the three consecutive waypoints are retained;
[0038] Using a second filtering algorithm to filter out waypoints with the same longitude in the obstacle avoidance route in the longitude direction, wherein the second filtering algorithm comprises the following steps:
[0039] Step S111: selecting three consecutive waypoints in the obstacle avoidance route and comparing the longitude values of the three consecutive waypoints;
[0040] Step S222: If the longitude values of the three consecutive waypoints are the same, the middle waypoint among the three consecutive waypoints is discarded, otherwise the three consecutive waypoints are retained.
[0041] In a second aspect, an embodiment of the present invention provides a device for generating an obstacle avoidance route for a drone, comprising:
[0042] An acquisition module is configured to acquire position information of two end points of a flight segment passing through a no-fly zone in a planned route of the drone;
[0043] The judging module is configured to judge whether the two endpoints of the flight segment passing through the no-fly zone are outside the no-fly zone, and if so, call the determining module; otherwise, determine multiple interconnected flight segments whose two endpoints are both outside the no-fly zone from the planned route of the drone, and call the determining module; wherein the multiple interconnected flight segments include the flight segment passing through the no-fly zone;
[0044] a determination module configured to set the two endpoints outside the no-fly zone as a starting point and an end point, and determine a passable area and a non-passable area according to the position information of the starting point, the end point and each vertex of the no-fly zone; and
[0045] The generation module is configured to generate an obstacle avoidance route from the starting point to the end point based on the passable area and the non-passable area using a path planning algorithm.
[0046] In a third aspect, an embodiment of the present invention provides an electronic device, including:
[0047] at least one processor; and
[0048] A memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for generating an obstacle avoidance route for a drone as described in any one of the first aspects of the present invention.
[0049] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:
[0050] 1. The scheme of the present invention can quickly update the route in a complex environment, realize automatic obstacle avoidance optimization of the route, and avoid catastrophic accidents such as aircraft crashes and deaths.
[0051] 2. The solution of the present invention adopts a path planning method based on a deep reinforcement learning algorithm, so that the updated obstacle avoidance route is more natural and smooth, and the route smoothness is better.
[0052] In the present invention, the above-mentioned technical solutions can also be combined with each other to achieve more preferred combination solutions. Other features and advantages of the present invention will be described in the subsequent description, and some advantages can become obvious from the description, or can be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained through the contents particularly pointed out in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The accompanying drawings are only used for the purpose of illustrating specific embodiments and are not to be considered as limiting the present invention. In the entire drawings, the same reference symbols represent the same components;
[0054] Figure 1 A schematic flow chart of a method for generating an obstacle avoidance route for a UAV according to an embodiment of the present invention is shown.
[0055] Figure 2 A conceptual schematic diagram of a UAV route planning in an embodiment of the present invention is shown.
[0056] Figure 3 An example of planning a route for a drone according to an embodiment of the present invention is shown.
[0057] Figure 4 An exemplary block diagram of a device for generating an obstacle avoidance route for a drone according to an embodiment of the present invention is shown.
[0058] Figure 5 A schematic block diagram of an example electronic device 500 that may be used to implement embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0059] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0060] Figure 1 FIG. 2 is a flow chart showing a method for generating a drone obstacle avoidance route according to an embodiment of the present invention. Figure 1 As shown, the method for generating the obstacle avoidance route of the UAV includes the following steps:
[0061] Step S10: Obtain the location information of the two end points of the flight segment that passes through the no-fly zone in the planned route of the drone.
[0062] The planned route of the drone in this embodiment can be a manually drawn route. In this embodiment, the manually drawn route data can be obtained through the imported route file. The route data here includes the latitude and longitude data of each waypoint in the route. Figure 2 FIG. 1 is a conceptual diagram showing a UAV route planning method in an embodiment of the present invention. Figure 2 As shown in the left figure, four waypoints can be marked on the two-dimensional map first ( Figure 2 Then, manually connect each waypoint in sequence along the flight direction to form a route. Figure 2 The right figure shows the route, such as Figure 2 As shown, the route includes three segments, each segment is interconnected in sequence, and each segment includes two waypoints. For example, the first segment includes waypoint 1 and waypoint 2.
[0063] In this embodiment, the no-fly zone drawn on the two-dimensional map can be obtained and the latitude and longitude data of the vertices can be extracted. The no-fly zone here can be a bad weather area (such as rain, snow, strong wind, and cloudy) that is currently unfavorable for flight and has been drawn on the two-dimensional map, or it can be a current enemy reconnaissance or dangerous area that has been drawn on the two-dimensional map. The "no-fly zone" is a closed area surrounded by multiple line segments, indicating an area where drones cannot pass.
[0064] In this embodiment, the flight segment that has been marked on the two-dimensional map and passes through the no-fly zone can be obtained and the longitude and latitude data of the two end points of the flight segment can be extracted. Figure 2 In the example of , the flight segment that passes through the no-fly zone is indicated in red, that is, the flight segment formed by waypoint 2 and waypoint 3. It should be noted that, unless otherwise specified, in this document, the terms "waypoint" and "endpoint of a flight segment" have the same meaning.
[0065] In this embodiment, a judgment can be made based on the range of the no-fly zone and the range of the two-dimensional map to calculate whether the no-fly zone is within the two-dimensional map, outside the two-dimensional map, or intersecting with the two-dimensional map. If it is within the two-dimensional map, the longitude and latitude values of each vertex of the no-fly zone can be directly obtained. If it is outside the range of the two-dimensional map, the no-fly zone can be set to be ineffective and not participate in subsequent calculations. If it intersects with the two-dimensional map, the intersection of the range of the no-fly zone and the range of the two-dimensional map can be calculated first, and then the no-fly zone can be divided according to the intersection, the part within the two-dimensional map is taken, and the no-fly zone vertices are reset. Finally, the longitude and latitude values of each vertex of the no-fly zone after the division can be obtained.
[0066] Step S20: Determine whether the two endpoints of the flight segment passing through the no-fly zone are outside the no-fly zone. If so, proceed to step S30; otherwise, determine multiple interconnected flight segments whose two endpoints are both outside the no-fly zone from the planned UAV route, and proceed to step S30.
[0067] In this embodiment, it is possible to determine whether a waypoint is outside the no-fly zone based on the latitude and longitude data of the endpoint of the flight segment that passes through the no-fly zone and the latitude and longitude data of the vertex of the no-fly zone. In some embodiments, the following method can be used to determine whether a waypoint of a flight segment that passes through the no-fly zone is outside the no-fly zone:
[0068] Step S1: Draw a ray from the endpoint along the target direction.
[0069] In some embodiments, a ray may be drawn from the end point of the flight segment that passes through the no-fly zone to the right along the longitude direction.
[0070] In this embodiment, the latitude and longitude values of the endpoint of the flight segment that passes through the no-fly zone can be represented by x and y values, respectively. x is a point on the horizontal axis X (longitude direction), y is a point on the vertical axis Y (latitude direction), and XOY constitutes the plane where the two-dimensional map is located (O is the origin). Make a ray to the right from the endpoint of the flight segment that passes through the no-fly zone. The mathematical model of the ray is expressed as: y=kx+b, where k=0, x>x1, and x1 is the longitude value of the endpoint. Then connect the vertices of the no-fly zone into line segments and intersect the ray with the edge of the no-fly zone, and calculate the number of intersections between the ray and the edge of the no-fly zone.
[0071] In some embodiments, a ray may be drawn along the longitude direction from the end point of the flight segment that passes through the no-fly zone to the left.
[0072] In this embodiment, the latitude and longitude values of the endpoint of the flight segment that passes through the no-fly zone can be represented by x and y values, respectively. x is a point on the horizontal axis X (longitude direction), y is a point on the vertical axis Y (latitude direction), and XOY constitutes the plane where the two-dimensional map is located (O is the origin). Make a ray from the endpoint of the flight segment that passes through the no-fly zone to the left, and the mathematical model of the ray is expressed as: y = kx + b, where k = 0, x < x1, and x1 is the longitude value of the endpoint. Then connect the vertices of the no-fly zone into line segments and intersect the ray with the edge of the no-fly zone, and calculate the number of intersections between the ray and the edge of the no-fly zone.
[0073] In some embodiments, a ray may be drawn upward along the latitude direction from the end point of the flight segment that passes through the no-fly zone.
[0074] In this embodiment, the latitude and longitude values of the endpoints of the flight segment that passes through the no-fly zone can be represented by x and y values, respectively. x is a point on the horizontal axis X (longitude direction), y is a point on the vertical axis Y (latitude direction), and XOY constitutes the plane where the two-dimensional map is located (O is the origin). Make a ray upward from the endpoint of the flight segment that passes through the no-fly zone. The mathematical model of the ray is expressed as: x = k'y + b', where k' = 0, y> y1, and y1 is the latitude value of the endpoint. Then connect the vertices of the no-fly zone into line segments and intersect the ray with the edge of the no-fly zone, and calculate the number of intersections between the ray and the edge of the no-fly zone.
[0075] In some embodiments, a ray may be drawn downward in the latitude direction from the end point of the flight segment that passes through the no-fly zone.
[0076] In this embodiment, the latitude and longitude values of the endpoints of the flight segment that passes through the no-fly zone can be represented by x and y values, respectively. x is a point on the horizontal axis X (longitude direction), y is a point on the vertical axis Y (latitude direction), and XOY constitutes the plane where the two-dimensional map is located (O is the origin). A ray is made downward from the endpoint of the flight segment that passes through the no-fly zone. The mathematical model of the ray is expressed as: x = k'y + b', where k' = 0, y> y1, and y1 is the latitude value of the endpoint. Then connect the vertices of the no-fly zone into line segments and intersect the ray with the edge of the no-fly zone, and calculate the number of intersections between the ray and the edge of the no-fly zone.
[0077] Step S2: judging whether the endpoint is outside the no-fly zone according to the number of intersections between the ray and the line segments of the no-fly zone.
[0078] In this embodiment, whether the waypoint is outside the no-fly zone can be determined based on the number of intersections between the ray and the edge of the no-fly zone.
[0079] In some embodiments, step S2 may include:
[0080] Step 101: Determine whether the intersection point of the ray and the line segment of the no-fly zone contains the vertex of the no-fly zone. If so and the number of intersection points that are the vertices of the no-fly zone is an odd number, proceed to step 102; otherwise, proceed to step 103.
[0081] Step 102: Determine whether the number of intersections between the ray and the line segments of the no-fly zone minus 1 is an odd number. If so, the endpoint is within the no-fly zone; otherwise, the endpoint is outside the no-fly zone.
[0082] Step 103: Determine whether the number of intersections between the ray and the line segments of the no-fly zone is an odd number. If so, the endpoint is within the no-fly zone; otherwise, the endpoint is outside the no-fly zone.
[0083] Specifically, it includes the following situations:
[0084] 1. If there is no vertex of the no-fly zone among the intersections of the waypoint's ray and the edge of the no-fly zone, the waypoint can be judged whether it is outside the no-fly zone based on the parity of the number of intersections between the waypoint's ray and the edge of the no-fly zone. Specifically, if the number of intersections between the waypoint's ray and the edge of the no-fly zone is even, the waypoint is outside the no-fly zone. If the number of intersections between the waypoint's ray and the edge of the no-fly zone is odd, the waypoint is inside the no-fly zone.
[0085] 2. If the intersection of the waypoint's ray and the edge of the no-fly zone contains a vertex of the no-fly zone, and the number of intersections that are vertices of the no-fly zone is even, then the waypoint can be judged whether it is outside the no-fly zone based on the parity of the number of intersections between the waypoint's ray and the edge of the no-fly zone. Specifically, if the number of intersections between the waypoint's ray and the edge of the no-fly zone is even, then the waypoint is outside the no-fly zone. If the number of intersections between the waypoint's ray and the edge of the no-fly zone is odd, then the waypoint is inside the no-fly zone.
[0086] 3. If the intersection of the waypoint's ray and the edge of the no-fly zone contains a vertex of the no-fly zone, and the number of intersections that are vertices of the no-fly zone is odd, then the waypoint can be judged to be outside the no-fly zone based on the parity of the number of intersections between the waypoint's ray and the edge of the no-fly zone minus 1. Specifically, if the number of intersections between the waypoint's ray and the edge of the no-fly zone minus 1 is an even number, then the waypoint is outside the no-fly zone. If the number of intersections between the waypoint's ray and the edge of the no-fly zone minus 1 is an odd number, then the waypoint is inside the no-fly zone.
[0087] In this embodiment, any of the above described embodiments can be used to determine whether the two endpoints of the flight segment that passes through the no-fly zone are outside the no-fly zone. If either of the two endpoints of the flight segment that passes through the no-fly zone is inside the no-fly zone, other waypoints outside the no-fly zone can be found from the planned route of the drone. In some embodiments, waypoints outside the no-fly zone can be found in the upstream adjacent waypoints and downstream adjacent waypoints of the flight segment that passes through the no-fly zone. The upstream and downstream here are relative to the flight direction of the drone. Figure 2 For example, if the flying direction of the drone is from left to right, the upstream adjacent waypoint of waypoint 2 is waypoint 1, and the downstream adjacent waypoint of waypoint 3 is waypoint 4. In this embodiment, any of the above-described embodiments can be used to determine whether the upstream waypoint or the downstream waypoint is outside the no-fly zone. Figure 3 An example of a UAV route planning according to an embodiment of the present invention is shown below. Figure 3 The process of searching for a waypoint outside the no-fly zone among the upstream waypoints and the downstream waypoints in this embodiment is described. Figure 3 As shown in the figure, the known flight segment that passes through the no-fly zone is indicated in red, namely the flight segment consisting of waypoints 2 and 3. Figure 3 It can be seen that both waypoints 2 and 3 are in the no-fly zone, so it is necessary to find other waypoints outside the no-fly zone on the route. First, for waypoint 2, its upstream adjacent waypoint is waypoint 1, so we can first determine whether waypoint 1 is outside the no-fly zone. The determination method can adopt any of the embodiments described above. Figure 3 In the example, waypoint 1 is outside the no-fly zone, so a waypoint outside the no-fly zone has been found in the upstream direction. Next, for waypoint 3, its downstream adjacent waypoint is waypoint 4, so we can first determine whether waypoint 4 is outside the no-fly zone. The determination method can adopt any of the embodiments described above. Figure 3 In the example, waypoint 4 is still in the no-fly zone, so it is necessary to continue to search for waypoints outside the no-fly zone in the downstream direction. Since the adjacent waypoint downstream of waypoint 4 is waypoint 5, it is possible to determine whether waypoint 5 is outside the no-fly zone. The determination method can adopt any of the embodiments described above. Figure 3 In the example, waypoint 5 is outside the no-fly zone, so a waypoint outside the no-fly zone has been found in the downstream direction. The route composed of waypoint 1 to waypoint 5 is a multi-segment interconnected flight segment in which both endpoints are outside the no-fly zone in this embodiment.
[0088] Step S30: setting the two endpoints outside the no-fly zone as a starting point and an end point respectively, and determining a passable area and a non-passable area according to the position information of the starting point, the end point and each vertex of the no-fly zone.
[0089] In this embodiment, after finding two waypoints outside the no-fly zone, the waypoint in the upstream direction can be set as the starting point, and the waypoint in the downstream direction can be set as the end point. Figure 3 In the example, waypoint 1 is the starting point and waypoint 5 is the end point. After that, you can traverse the starting point, end point, and all the no-fly zones, and select the maximum and minimum longitude values, as well as the maximum and minimum latitude values. A rectangular area can be enclosed according to the maximum longitude value, the minimum longitude value, the maximum latitude value, and the minimum latitude value. After that, the area occupied by the no-fly zone in the rectangular area can be set as an inaccessible area, and the other areas outside the no-fly zone can be set as a passable area.
[0090] In some embodiments, the rectangular area can be grid-divided according to a preset grid resolution. For example, a grid can be divided into 100 meters * 100 meters each, and the grid can completely cover the no-fly zone, the starting point, and the end point. After the grid is divided, each grid can be numbered, for example, (0,0) is used to represent the first grid in the lower left corner, and the grids are numbered with (0,1), (0,2), etc. to the right, and (1,0), (2,0), etc. to the top. The grid number and the longitude and latitude coordinate values of the four corners of the grid can be recorded simultaneously for each grid. Then, according to the longitude and latitude coordinate values of the starting point and the end point, the grid where the starting point and the end point are located are calculated and recorded as the starting point grid and the end point grid. After that, all grids can be traversed to calculate whether each grid coincides with or intersects with the no-fly zone. Shapely in the python toolbox can be used to quickly determine whether two polygons have overlapping areas or intersect. Finally, the grids that intersect or overlap with the no-fly zone are marked as 1 (indicating that there is an obstacle and it is not passable), otherwise the grids are marked as 0 (indicating that there is no obstacle and it is passable).
[0091] Step S40: Generate an obstacle avoidance route from the starting point to the end point using a path planning algorithm based on the traversable area and the non-traversable area.
[0092] In this embodiment, a path planning algorithm may be used to plan a path from a starting grid to an end grid, avoiding grids with obstacles, and passing through grids.
[0093] In some embodiments, a deep reinforcement learning (DRL) algorithm may be used for optimal path planning. Specifically, the DRL algorithm may be used to construct a deep Q-network (DQN). In order to prevent the DRL algorithm from oscillating infinitely and not converging during the calculation process, the present invention optimizes the DRL algorithm as follows:
[0094] 1. Dynamically adjust the grid resolution. First, you can calculate the distance from the start point to the end point. If the distance between the two waypoints is too large (for example, greater than or equal to 30 kilometers), in order to avoid the DRL algorithm not converging for a long time, you can divide the grid into 1 km * 1 km. If the distance between the two waypoints is less than the threshold (for example, 30 kilometers), you can divide the grid into 100 meters * 100 meters, thereby reducing the number of grids at large distances.
[0095] 2. Increase the number of neural network layers. In order to improve the optimization ability of the DRL algorithm, the number of DQN neural network layers can be increased from three to five, and the number of neurons can be increased.
[0096] In some embodiments, the path planning algorithm includes any one of the following: A* path planning algorithm, bidirectional A* path planning algorithm, Dijkstra algorithm.
[0097] In some embodiments, the obstacle avoidance route is a route consisting of a plurality of grid center points interconnected in sequence. Figure 1 The method also includes:
[0098] Using a first filtering algorithm to filter out waypoints at the same latitude in the obstacle avoidance route in the latitude direction, wherein the first filtering algorithm comprises the following steps:
[0099] Step S111: selecting three consecutive waypoints in the obstacle avoidance route and comparing the latitude values of the three consecutive waypoints;
[0100] Step S222: If the latitude values of the three consecutive waypoints are the same, then the middle waypoint among the three consecutive waypoints is discarded, otherwise the three consecutive waypoints are retained;
[0101] Using a second filtering algorithm to filter out waypoints with the same longitude in the obstacle avoidance route in the longitude direction, wherein the second filtering algorithm comprises the following steps:
[0102] Step S111: selecting three consecutive waypoints in the obstacle avoidance route and comparing the longitude values of the three consecutive waypoints;
[0103] Step S222: If the longitude values of the three consecutive waypoints are the same, the middle waypoint among the three consecutive waypoints is discarded, otherwise the three consecutive waypoints are retained.
[0104] In this embodiment, after the grid of the optimal path is calculated, the longitude and latitude of the center point of the grid can be calculated, respectively represented by x and y coordinates. First, the redundant points in the x-axis direction are filtered out. The filtering algorithm is as follows:
[0105] First select the first grid point and record it as (x1, y1), select the second point (x2, y2), select the third point (x3, y3), and compare these three points. If y1=y2=y3, filter out the second point, record the third point (x3, y3) as (x2, y2), then select the next grid point (x3, y3), and continue the loop calculation; if y1≠y2≠y3, or y1≠y2=y3, or y1=y2≠y3, then do not filter, record (x2, y2) as (x1, y1), (x3, y3) as (x2, y2), take the next point and record it as (x3, y3), and continue the loop calculation.
[0106] After all grids are filtered in the X-axis direction, the filtered grids are filtered in the Y-axis direction. The filtering algorithm is as follows:
[0107] Still select the first grid center point as (x1, y1), select the second point as (x2, y2), select the third point as (x3, y3), and compare these three points. If x1=x2=x3, filter out the second point, record the third point (x3, y3) as (x2, y2), select the next grid point coordinates (x3, y3), and continue the loop calculation; if x1≠x2≠x3, or x1≠x2=x3, or x1=x2≠x3, do not filter, record (x2, y2) as (x1, y1), (x3, y3) as (x2, y2), take the next point as (x3, y3), and continue the loop calculation.
[0108] Compared with the prior art, the embodiments of the present invention can achieve at least one of the following beneficial effects:
[0109] 1. The scheme of the present invention can quickly update the route in a complex environment, realize automatic obstacle avoidance optimization of the route, and avoid catastrophic accidents such as aircraft crashes and deaths.
[0110] 2. The solution of the present invention adopts a path planning method based on a deep reinforcement learning algorithm, so that the updated obstacle avoidance route is more natural and smooth, and the route smoothness is better.
[0111] Figure 4 FIG. 2 shows an exemplary block diagram of a device for generating an obstacle avoidance route for a drone according to an embodiment of the present invention. Figure 4As shown, the generation device 400 of the obstacle avoidance route of the unmanned aerial vehicle includes: an acquisition module 401, which is configured to obtain the position information of the two endpoints of the segment passing through the no-fly zone in the planned route of the unmanned aerial vehicle; a judgment module 402, which is configured to judge whether the two endpoints of the segment passing through the no-fly zone are outside the no-fly zone, and if so, call the determination module; otherwise, determine from the planned route of the unmanned aerial vehicle a plurality of interconnected segments whose two endpoints are both outside the no-fly zone, and call the determination module; wherein the plurality of interconnected segments include the segment passing through the no-fly zone; a determination module 403, which is configured to set the two endpoints outside the no-fly zone as the starting point and the end point, and determine the passable area and the non-passable area according to the position information of the starting point, the end point and each vertex of the no-fly zone; and a generation module 404, which is configured to generate an obstacle avoidance route from the starting point to the end point using a path planning algorithm based on the passable area and the non-passable area.
[0112] It should be understood that Figure 4 The various modules of the apparatus 400 shown in FIG. 4 can be used in conjunction with the reference Figure 1 The steps in the described method correspond to each other. Therefore, the operations, features and advantages described above for the method are also applicable to the device 400 and the modules included therein. For the sake of brevity, some operations, features and advantages are not repeated here.
[0113] Figure 5 Schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present disclosure is shown. Figure 5 , a structural block diagram of an electronic device 500 that can serve as a server or client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein. Figure 5As shown, the electronic device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 1008 into a random access memory (RAM) 503. In RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, ROM 502, and RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504. Multiple components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1009 allows the device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0114] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above, such as a method for generating a drone obstacle avoidance route. For example, in some embodiments, the method for generating a drone obstacle avoidance route may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 500 via the ROM 502 and / or the communication unit 1009. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the gift package recommendation method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to execute the method for generating a drone obstacle avoidance route in any other appropriate manner (e.g., by means of firmware).
[0115] Compared with the prior art, the embodiments of the present invention can achieve at least one of the following beneficial effects:
[0116] 1. The scheme of the present invention can quickly update the route in a complex environment, realize automatic obstacle avoidance optimization of the route, and avoid catastrophic accidents such as aircraft crashes and deaths.
[0117] 2. The solution of the present invention adopts a path planning method based on a deep reinforcement learning algorithm, so that the updated obstacle avoidance route is more natural and smooth, and the route smoothness is better.
[0118] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for generating an obstacle avoidance route for a drone, characterized in that: The following steps are involved: Step S10: Obtaining the location information of the two end points of the flight segment that passes through the no-fly zone in the planned route of the drone; Step S20: determining whether the two endpoints of the flight segment passing through the no-fly zone are outside the no-fly zone, if so, proceeding to step S30; Otherwise, determine multiple interconnected flight segments whose two endpoints are both outside the no-fly zone from the planned route of the drone, and enter step S30; wherein the multiple interconnected flight segments include the flight segment that passes through the no-fly zone; Step S30: setting the two endpoints outside the no-fly zone as a starting point and an end point, and determining a passable area and a non-passable area according to the position information of the starting point, the end point and each vertex of the no-fly zone; as well as Step S40: Generate an obstacle avoidance route from the starting point to the end point using a path planning algorithm based on the traversable area and the non-traversable area.
2. The generation method according to claim 1, characterized in that: Determining whether the two endpoints of the flight segment passing through the no-fly zone are outside the no-fly zone includes: Draw a ray from the endpoint in the direction of the target; Whether the endpoint is outside the no-fly zone is determined according to the number of intersections between the ray and the line segments of the no-fly zone.
3. The generation method according to claim 2, characterized in that: Judging whether the endpoint is outside the no-fly zone according to the number of intersections between the ray and the line segments of the no-fly zone includes: Step 101: Determine whether the intersection point of the ray and the line segment of the no-fly zone contains the vertex of the no-fly zone. If so, and the number of intersection points that are the vertices of the no-fly zone is an odd number, proceed to step 102; otherwise, proceed to step 103; Step 102: Determine whether the number of intersections between the ray and the line segment of the no-fly zone minus 1 is an odd number, if so, the endpoint is within the no-fly zone; otherwise, the endpoint is outside the no-fly zone; Step 103: Determine whether the number of intersections between the ray and the line segments of the no-fly zone is an odd number. If so, the endpoint is within the no-fly zone; otherwise, the endpoint is outside the no-fly zone.
4. The generation method according to claim 1, characterized in that: The multiple interconnected flight segments whose two endpoints are both outside the no-fly zone are determined from the planned flight path of the drone include: If the starting point of the two endpoints of the flight segment passing through the no-fly zone is within the no-fly zone, then determine whether the waypoints adjacent to the starting point are outside the no-fly zone in turn along the upstream direction of the planned route of the drone, until the first waypoint that is not within the no-fly zone is found; If the destination point of the two endpoints of the flight segment passing through the no-fly zone is within the no-fly zone, then the waypoints adjacent to the destination point are determined in sequence along the downstream direction of the planned route of the drone to determine whether they are outside the no-fly zone until the first waypoint that is not within the no-fly zone is found.
5. The generation method according to claim 4, characterized in that: Determining whether a waypoint close to the departure point or the destination point is outside the no-fly zone includes: Draw a ray from the endpoint in the direction of the target; Whether the waypoint is outside the no-fly zone is determined according to the number of intersections between the ray and the line segments of the no-fly zone.
6. The generation method according to claim 1, characterized in that: Determining the passable area and the non-passable area according to the position information of the starting point, the end point and each vertex of the no-fly zone includes: Determine a rectangular area according to the maximum longitude value, the minimum longitude value, the maximum latitude value, and the minimum latitude value of each vertex of the starting point, the end point, and the no-fly zone; Dividing the rectangular area into grids according to a preset grid resolution; It is determined whether each grid intersects or overlaps with the no-fly zone. If so, the grid is marked as a non-passable area; otherwise, the grid is marked as a passable area.
7. The generation method according to claim 6, characterized in that: The preset grid resolution is determined by the distance between the start point and the end point.
8. The generation method according to claim 1, characterized in that: The path planning algorithm includes any one of the following: Deep reinforcement learning algorithm, A* path planning algorithm, bidirectional A* path planning algorithm, Dijkstra algorithm.
9. The generation method according to claim 1, characterized in that: The obstacle avoidance route is a route that is sequentially interconnected by a plurality of grid center points, and the generation method further includes: Using a first filtering algorithm to filter out waypoints at the same latitude in the obstacle avoidance route in the latitude direction, wherein the first filtering algorithm comprises the following steps: Step S111: selecting three consecutive waypoints in the obstacle avoidance route and comparing the latitude values of the three consecutive waypoints; Step S222: If the latitude values of the three consecutive waypoints are the same, then the middle waypoint among the three consecutive waypoints is discarded, otherwise the three consecutive waypoints are retained; Using a second filtering algorithm to filter out waypoints with the same longitude in the obstacle avoidance route in the longitude direction, wherein the second filtering algorithm comprises the following steps: Step S111: selecting three consecutive waypoints in the obstacle avoidance route and comparing the longitude values of the three consecutive waypoints; Step S222: If the longitude values of the three consecutive waypoints are the same, the middle waypoint among the three consecutive waypoints is discarded, otherwise the three consecutive waypoints are retained.
10. A device for generating an obstacle avoidance route for a drone, characterized in that: include: An acquisition module is configured to acquire position information of two end points of a flight segment passing through a no-fly zone in a planned route of the drone; a judging module configured to judge whether two endpoints of the flight segment passing through the no-fly zone are outside the no-fly zone, and if so, call the determining module; Otherwise, determining multiple interconnected flight segments whose two endpoints are both outside the no-fly zone from the planned route of the drone, and calling a determination module; wherein the multiple interconnected flight segments include the flight segment passing through the no-fly zone; a determination module configured to set the two endpoints outside the no-fly zone as a starting point and an end point, and determine a passable area and a non-passable area according to the position information of the starting point, the end point and each vertex of the no-fly zone; and The generation module is configured to generate an obstacle avoidance route from the starting point to the end point based on the passable area and the non-passable area using a path planning algorithm.
11. An electronic device, comprising: at least one processor; as well as A memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for generating an obstacle avoidance route for a drone as described in any one of claims 1-9.
Citation Information
Cited By
Unmanned aerial vehicle route smoothing method and system facing grid path
CN121612316A
Grid path oriented drone route smoothing method and system
CN121612316B