Unmanned aerial vehicle and geo-fencing area position determination and distance calculation system and method

The UAV and geographic fence area position determination system based on grid matching and ray method solves the problem of low efficiency in determining the position relationship between the UAV and the fence area, and achieves accurate distance calculation and efficient monitoring.

CN120651219APending Publication Date: 2025-09-16BEIJING SHUNTIAN BORUI TECHNOLOGY DEVELOPMENT CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510805910.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-17
Publication Date
2025-09-16

AI Technical Summary

Technical Problem

In the existing technology, the efficiency of determining the position relationship between the drone and the geographical fence area is low, and it is impossible to accurately determine the position relationship and distance between the drone and the fence area in real time, resulting in insufficient monitoring efficiency.

Method used

A drone and geo-fence area position determination and distance calculation system is used. By receiving drone position data, based on grid matching and indexing technology, the position relationship between the drone and the geo-fence area is determined, and the closest distance is calculated. The grid index and ray method are used for efficient judgment.

Benefits of technology

It achieves accurate calculation of the distance between the drone and the fence boundary, reduces the algorithm's time complexity, improves monitoring efficiency, and can process the position relationship determination of a large number of drones in real time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120651219A_ABST
    Figure CN120651219A_ABST
Patent Text Reader

Abstract

The invention discloses an unmanned aerial vehicle and geo-fencing area position judgment and distance calculation system and method in the technical field of unmanned aerial vehicle monitoring. The method comprises the following steps: receiving real-time unmanned aerial vehicle position data; matching is performed based on the unmanned aerial vehicle position data and the geo-fencing area, and the position relation between the unmanned aerial vehicle and the geo-fencing area is judged according to the matching result; when the current position of the unmanned aerial vehicle is in the boundary grid of the geo-fence area, further judging the position relationship between the unmanned aerial vehicle and the geo-fence area; when the current position of the unmanned aerial vehicle is in the geo-fencing area, calculating the nearest distance between the unmanned aerial vehicle and the fencing boundary; and comparing the nearest distance between the unmanned aerial vehicle and the fence boundary with a given threshold value, sending out alarm information when the nearest distance is smaller than the given threshold value, otherwise, not sending out the alarm information. According to the method, calculation of the distance between the unmanned aerial vehicle and the fence boundary and judgment of the position relation between points and polygons are achieved, the obtained nearest distance is an accurate value, and the algorithm time complexity is greatly reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a system and method for determining the positions of a drone and a geographic fence area and calculating the distance therebetween, and belongs to the technical field of drone monitoring. Background Art

[0002] In recent years, with the rapid development of the domestic low-altitude economy, the construction of drone safety monitoring platforms has been increasingly put on the agenda. The drone safety monitoring platform needs to maintain real-time monitoring of all drones over a designated area, and any abnormal drones need to be issued an alarm message and reported for processing.

[0003] In existing technologies, as the scope of surveillance expands, the number of vertices on the fence boundary increases. As the number of drones increases, traditional methods for determining the positional relationship between drones and the fenced area become inefficient, making it impossible to accurately determine the positional relationship between drones and the geo-fenced area in real time and calculate the distance between drones and the fence boundary. Summary of the Invention

[0004] The purpose of the present invention is to overcome the shortcomings of the existing technology and provide a system and method for determining the position and calculating the distance between a drone and a geographic fence area. The system realizes the calculation of the distance between the drone and the fence boundary and the determination of the position relationship between points and polygons. The obtained closest distance is an accurate value, which greatly reduces the time complexity of the algorithm.

[0005] To achieve the above object, the present invention is implemented by adopting the following technical solutions:

[0006] In a first aspect, the present invention provides a method for determining the position of a drone and a geo-fenced area and calculating the distance therebetween, comprising:

[0007] Receive real-time drone location data;

[0008] Based on the matching of the drone's location data with the geo-fenced area, the positional relationship between the drone and the geo-fenced area is determined according to the matching results;

[0009] In response to the current position of the drone being within a boundary grid of the geo-fenced area, further determining a positional relationship between the drone and the fenced area;

[0010] In response to the current position of the drone being within the geo-fenced area, calculating the closest distance between the drone and the fence boundary;

[0011] Compare the closest distance between the drone and the fence boundary with a given threshold. If the closest distance is less than the given threshold, an alarm message will be issued; otherwise, no alarm message will be issued.

[0012] In response to the drone's current location being outside the geo-fence area, an alarm message is issued.

[0013] Furthermore, the drone location data is matched with the geo-fenced area, and the positional relationship between the drone and the geo-fenced area is determined based on the matching result, including:

[0014] Get the drone's location;

[0015] Calculate the position of the drone in the grid set S according to the drone's position coordinates GRID The row and column indices in ;

[0016] Based on the UAV in the grid collection S GRID The row and column indexes in the grid set S are used to calculate the position of the drone. GRID The corresponding grid in is denoted as G P ;

[0017] In response to G P ∈S 1 GRID When , the current position of the drone is determined to be within the boundary grid of the geo-fenced area;

[0018] In response to G P ∈S 2 GRID When , it is determined that the current position of the drone is outside the geo-fence area;

[0019] In response to G P ∈S 3 GRID When , it is determined that the current position of the drone is within the geo-fenced area;

[0020] The S GRID is the complete set of all grids, the S 1 GRID is a set of grids near the fence polygon boundary line, the S 2 GRID is a set of grids completely outside the fence, the S 3 GRID is the set of grids completely inside the fence, and S GRID =S 1 GRID +S 2 GRID +S 3 GRID .

[0021] Furthermore, in response to the current position of the drone being within a boundary grid of the geo-fenced area, further determining the positional relationship between the drone and the fenced area includes:

[0022] Get the drone in the grid set S GRID Calculate the row and column indexes in the grid, and the start and end grid indexes;

[0023] Take out all grids from the starting grid index to the ending grid index one by one. If the grid stores information about boundary segments, store the index value of the boundary segment in a temporary array, which is recorded as: V S ; After processing all grids from the start grid index to the end grid index, V S Deduplication of index values ​​stored in ;

[0024] Take out V in sequence S The boundary line index value in the fence polygon boundary line L B Get the corresponding line segment coordinate information, recorded as: S AB ;

[0025] The right ray passing through the drone's position and S AB Perform intersection calculation and accumulate all intersection points;

[0026] In response to the number of all intersection points being an odd number, determining that the current position of the drone is within the geo-fenced area;

[0027] In response to the fact that the number of all intersection points is an even number, it is determined that the current position of the drone is outside the geo-fence area.

[0028] Furthermore, the calculation formulas for the starting grid index and the ending grid index are:

[0029] G S =Row*C MAX +Col;

[0030] G E =Row*C MAX +C MAX -1;

[0031] Where G S is the index of the grid where the drone is located; G E is the rightmost grid index in the same row as the drone; Row and Col are the index of the drone in the grid set S GRID The row and column indexes in C MAX is the grid set S GRID The maximum number of columns.

[0032] Furthermore, in response to the current position of the drone being within the geo-fenced area, calculating the closest distance between the drone and the fence boundary includes:

[0033] Determine whether the drone's location is perpendicular to the fence boundary segment;

[0034] In response to the fact that the position of the drone has a foot of a perpendicular to the boundary line segment of the fence, the closest distance between the drone and the boundary line segment of the fence is the distance between the position of the drone and the foot of the perpendicular to the boundary line segment of the fence;

[0035] In response to the UAV's position having a perpendicular foot to the fence boundary segment, the closest distance between the UAV and the fence boundary segment is the minimum distance between the UAV's position and each endpoint of the fence boundary segment;

[0036] After calculating the closest distances between all line segments and the drone, the minimum value is taken as the closest distance between the drone and the fence boundary.

[0037] Furthermore, the closest distance between the drone and the fence boundary is compared with a given threshold. When the closest distance is less than the given threshold, an alarm message is issued; otherwise, no alarm message is issued, including:

[0038] The closest distance between the drone and the fence boundary is compared to the fence threshold;

[0039] In response to the closest distance between the drone and the fence boundary being less than the fence threshold, an alarm message needs to be issued to the drone along with the closest distance between the drone and the fence boundary; otherwise, no alarm message needs to be issued to the drone.

[0040] Furthermore, the alarm information is aggregated and sent in real time via message middleware.

[0041] In a second aspect, the present invention provides a system for determining the position of a drone and a geo-fenced area and calculating the distance therebetween, comprising:

[0042] Data receiving module: receives real-time drone location data;

[0043] Position determination module: matches the drone's position data with the geo-fence area, and determines the positional relationship between the drone and the geo-fence area based on the matching results;

[0044] Deep judgment module: In response to the current position of the drone being within the boundary grid of the geo-fenced area, further judge the positional relationship between the drone and the fenced area;

[0045] Distance calculation module: in response to the current position of the drone being within the geo-fenced area, calculates the closest distance between the drone and the fence boundary;

[0046] Distance comparison module: compares the closest distance between the drone and the fence boundary with a given threshold. If the closest distance is less than the given threshold, an alarm message will be issued; otherwise, no alarm message will be issued.

[0047] Alarm sending module: sends an alarm message in response to the drone's current position being outside the geo-fence area.

[0048] In a third aspect, the present invention provides a device for determining the position of a drone and a geo-fenced area and calculating the distance therebetween, including a processor and a storage medium;

[0049] The storage medium is used to store instructions;

[0050] The processor is configured to operate according to the instructions to execute the steps of any of the above methods.

[0051] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of any of the above methods when executed by a processor.

[0052] Compared with the prior art, the present invention has the following beneficial effects:

[0053] First, this invention fully utilizes the characteristics of the fence grid and proposes a system and method for determining the position and calculating the distance between a drone and a geo-fenced area. This system matches the drone's position data with the geo-fenced area and then determines the positional relationship and distance between the drone and the geo-fenced area based on the matching results. This system calculates the distance between the drone and the fence boundary and determines the positional relationship between points and polygons. The obtained closest distance is an accurate value, significantly reducing the algorithm's time complexity.

[0054] Second, this solution directly uses the pre-stored boundary segment index of the grid where the drone is located. It only calculates the associated boundary distance, avoiding redundant calculations of massive segments and achieving precise matching of grid-associated boundaries. Furthermore, this solution first filters out external drones through grid-based position determination, then performs precise distance calculations on internal drones, achieving intelligent allocation of computing resources and hierarchical distance determination.

[0055] Third, this solution deeply integrates GIS grid spatial indexing with traditional computer graphics algorithms, achieving an order-of-magnitude performance leap while maintaining the mathematical rigor of the algorithms. This fusion of spatial indexing and algorithms is achieved. Furthermore, a three-tiered computational design, encompassing grid indexing, boundary aggregation, and precise calculations, ensures that every calculation is both necessary and minimized. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] The accompanying drawings, which constitute part of the present invention, are intended to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are intended to explain the present invention and do not constitute an undue limitation of the present invention. In the accompanying drawings:

[0057] Figure 1 A geo-fence grid diagram for the method for determining the position of a drone and a geo-fence area and calculating the distance provided in the first embodiment of the present invention;

[0058] Figure 2A fence grid classification identification diagram for the method for determining the position of a drone and a geo-fence area and calculating the distance provided in the first embodiment of the present invention;

[0059] Figure 3 An eight-adjacent grid diagram for the method for determining the position and calculating the distance between a drone and a geo-fenced area provided in Example 1 of the present invention;

[0060] Figure 4 A drone grid matching diagram for the method for determining the position of a drone and a geo-fenced area and calculating the distance provided in the first embodiment of the present invention;

[0061] Figure 5 A diagram showing the relationship between the ray method determination points and polygons used in the method for determining the position and calculating the distance between a drone and a geo-fenced area provided in the first embodiment of the present invention;

[0062] Figure 6 A diagram showing the relationship between the position of a drone and a geo-fenced area in the method for determining the position of a drone and a geo-fenced area and calculating the distance provided in the first embodiment of the present invention;

[0063] Figure 7 This is a diagram showing the distance calculation between a drone and a geo-fenced area according to the method for determining the position and calculating the distance between the drone and the geo-fenced area provided in the first embodiment of the present invention. DETAILED DESCRIPTION

[0064] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that, in the absence of conflict, the embodiments and features of the embodiments of the present invention can be combined with each other.

[0065] The following detailed description is an exemplary description and is intended to provide further detailed description of the present invention. Unless otherwise indicated, all technical terms used in the present invention have the same meaning as those generally understood by those skilled in the art to which the present invention belongs. The terms used in the present invention are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present invention.

[0066] Example 1:

[0067] This embodiment provides a method for determining the position and calculating the distance between a drone and a geo-fence area. First, the geo-fence is converted into a fence grid, and the width of the grid is given by the fence threshold. Then, the fence boundary line and the fence grid are subjected to intersection matching processing, and the grids that intersect with the boundary line are subjected to corresponding identification processing. Next, the fence grid is classified and identified, and all grids are identified into three types of attributes: internal, boundary, and external. Next, real-time drone position data is received, and the corresponding grid is matched according to the drone position, and the attributes of the grid (i.e., internal, boundary, and external attributes) are obtained. For drones that fall on the boundary grid, the positional relationship between the drone and the fence area is further determined; for drones that fall inside the fence area, the closest distance between the drone and the fence boundary is calculated. Finally, the final determination result of the drone and the geo-fence is returned. If the drone falls outside the geo-fence or the distance from the boundary is less than a given threshold, the corresponding alarm information is transmitted through the message middleware. Specifically including the following contents:

[0068] 1. Geofence area polygon reading

[0069] There are generally two ways to set up geofences on the drone security monitoring platform: one is to automatically read the geofence file of the specified location when the software starts, including the vertex latitude and longitude coordinates of the fence polygon boundary line, the upper and lower limit heights of the fence, and the fence buffer threshold (denoted as: D TH , the same below). Another method is to receive geofence data from other business platforms through message middleware. If the security monitoring platform has already read the geofence file when it starts up, and then receives new geofence data through the message middleware, the new data will overwrite the previous settings. Generally, frequent changes to geofence data are not recommended; set it once after the monitoring platform starts up.

[0070] 2. Geofencing Grid

[0071] The geofence gridding process is divided into: (1) generating a fence grid from the fence; (2) intersecting and matching the fence polygon boundary line with the fence grid. The polygon corresponding to the geofence is denoted as Z. GEO , the fence threshold is D TH , the fence polygon boundary line is L B The specific steps for fence gridding are as follows:

[0072] ① First, calculate the rectangular range of the entire fence based on the longitude and latitude coordinates of the fence polygon, and record it as R. TH The expansion of the distance, the expanded rectangular range is still recorded as R;

[0073] ② Divide R into a grid, and set the length and width of the grid to D TH , that is, each grid has a side length of DTH The width and height of R are D W 、D H , then the corresponding number of grid rows and columns is N ROW 、N COL They are:

[0074] N ROW =INT(D H / D TH )+1;

[0075] N COL =INT(D W / D TH )+1;

[0076] The grid division starts from the upper left corner of R, and the generated grid set is recorded as: S GRID ;

[0077] ③ Take out L segment by segment B The boundary segment S AB and S GRID The grid in the grid is intersected and judged by the line segment S AB For example:

[0078] S1. Get line segment S AB The range rectangle Bound;

[0079] S2. Get all grids that intersect with Bound and record them as grid set B GRID ;

[0080] S3, take out B one by one GRID Each grid in is denoted as G, and for G and line segment S AB Make an intersection judgment;

[0081] S4. If point A or B falls in grid G, then grid G ​​and line segment S AB intersect;

[0082] S5. If the line segment S AB and the four boundary segments of G, then the grid G ​​and the line segment S AB They also intersect;

[0083] S6. If S4 and S5 are not satisfied, then the grid G ​​and line segment S AB do not intersect;

[0084] If a grid and S AB If there is an intersection, save S in the grid AB The index value (ie S AB In L B The line segment index in , and the grid is assigned to a temporary grid set, denoted as: S TGRID , that is, S T GRID ∈S GRID ;

[0085] ④The algorithm ends.

[0086] Fence area polygons (ABCDEFA) are meshed, with a mesh width of one D TH , the bounding rectangle of polygon (ABCDEFA) is: R(P LT ,P RT ,P RB ,P LB ), double D for R TH The distance is expanded, that is, Figure 1 The collection of grids shown. Figure 1 The grid set with the dotted line is S T GRID .

[0087] 3. Fence Grid Marking

[0088] After fence gridding, two fence grid sets are formed: S T GRID and S GRID , and S T GRID ∈S GRID , S T GRID All grids that intersect with the fence polygon boundary line are stored in S GRID is the complete set of all grids. In the fence grid marking module, we will GRID Perform grid classification, and the S GRID will be split into three mutually disjoint subsets, namely: S 1 GRID 、S 2 GRID 、S 3 GRID , where S 1 GRID is the set of grids near the fence polygon boundary line, S 2 GRID It is a set of grids that are completely outside the fence (the closest distance to the boundary line is greater than D TH ), S 3 GRID It is a set of grids that are completely inside the fence (the closest distance to the boundary line is greater than D TH ), namely S GRID =S 1 GRID +S 2 GRID +S3 GRID After such classification, it will greatly facilitate the subsequent judgment of the relationship between the real-time position of the drone and the fence.

[0089] The grid marking algorithm process is as follows:

[0090] ① Take out S in sequence T GRID Each grid in is denoted as: G C , calculate and obtain G C The other eight directly adjacent grids are denoted as: G i , i∈[1,8]. C The boundary line segment index value stored in is assigned to each G i , if G i If the same index value has been saved in G, there is no need to add it again to avoid storing duplicate boundary line segment index values ​​in the grid. C The boundary index value saved in is assigned to each G around it i ,Purpose Each boundary grid needs to record the index value of the boundary line segments near it in order to ,perform high-performance distance calculation and point and fence position relationship determination ,later;G i The reason for deduplication of boundary segment indexes is to avoid the same boundary segment index being recorded multiple times in the same grid;

[0091] like Then G i Join S 1 GRID Finally, put G C Also joined S 1 GRID Until S is processed T GRID All grids in ;

[0092] ② For S 1 GRID Mark all grids in as boundary grid attributes and clear S T GRID , waiting for subsequent backup;

[0093] ③Since we are generating S GRID 2 times D TH Distance expansion can ensure S GRID The upper left corner of grid G LT Definitely not in S 1 GRID Middle, that is, G LT Not the boundary grid, put G LT Join S T GRID middle;

[0094] ④ Take out S in sequence T GRID Each grid in is denoted as G T , get and G T The other directly adjacent grids (number <= 8, denoted as: K) are denoted as: G i , i∈[1,K]. i Judge one by one: If G i Not a boundary grid (i.e. ),and Then G i Join S 2 GRID In the meantime, G i Append to S T GRID In the process, after processing the adjacent grid, finally G T Also joined S 2 GRID and from S T GRID Delete G T ;

[0095] ⑤Cyclic call ④Process S T GRID All grids in , up to S T GRID All the grids in are deleted and the loop ends;

[0096] ⑥To S 2 GRID Mark all meshes in as external mesh attributes;

[0097] ⑦ Put S GRID All unmarked grids in the grid are marked as internal grid attributes and grouped into S 3 GRID In, S 3 GRID That is, the set of grids that are completely inside the fence;

[0098] ⑧The algorithm ends.

[0099] like Figure 2 As shown, the grid with the dotted line is the fence boundary grid set S 1 GRID , S 1 GRID The blank grid outside the fence is the external grid set S 2 GRID , S 1 GRIDThe internal blank grid is the fence internal grid set S 3 GRID . Figure 3 Shown G C The 8 adjacent grids G i , i∈[1,8].

[0100] 4. UAV real-time location data reception

[0101] Drone safety monitoring platforms typically use message-based middleware to continuously obtain real-time drone location data. This includes key information such as the drone's ID, latitude and longitude, heading, pitch, and speed. The latest location data automatically overwrites the previously acquired location data. The drone safety monitoring platform regularly obtains the latest drone location information within the monitoring area and simultaneously transmits this location data to various monitoring algorithms for evaluation and calculation. Different monitoring algorithms are responsible for generating corresponding drone alerts. Finally, the safety monitoring platform aggregates these different alerts and sends them externally via the message-based middleware.

[0102] 5. UAV Mesh Matching

[0103] After completing the above preparations, we can then perform grid matching on the real-time received drone position data. The algorithm process is relatively simple. UAV , the algorithm is as follows:

[0104] ①According to P UAV Coordinate calculation of drone in S GRID The row and column indices in are calculated as follows:

[0105] Row=INT((P UAV .yR.top) / (-D TH ))

[0106] Col=INT((P UAV .xR.left) / D TH )

[0107] Among them, P UAV .y is P UAV The latitude value, P UAV .x is P UAV Longitude value, R.top is S GRID The upper boundary value of the envelope rectangle R, R.left is the left boundary value of R.

[0108] ② According to the row and column index values ​​Row and Col obtained in ① above, calculate and obtain P UAV In S GRID The corresponding grid in is denoted as GP , if G P ∈S 2 GRID or G P ∈S 3 GRID , then you can immediately end the P UAV If G P ∈S 2 GRID , it means that the current position of the drone has gone beyond the fence boundary, and an alarm message can be given; if G P ∈S 3 GRID , it means that the current position of the drone is inside the fence, and the distance between the drone and the fence boundary is greater than D TH , it is a safe flight and no warning is required. End the detection of the drone;

[0109] ③If G P ∈S 1 GRID , then P UAV Near the fence polygon boundary line, further judgment is needed UAV Inside or outside the fence;

[0110] ④The algorithm ends.

[0111] like Figure 4 As shown, P 1 UAV ,P 2 UAV ,P 3 UAV ,P 4 UAV ,P 5 UAV The real-time positions of different drones are matched with the corresponding grid attributes: P 2 UAV , P 4 UAV is the boundary grid, P 1 UAV , P 5 UAV is the internal grid, P 3 UAV is the external grid. From this, we can directly end the 1 UAV , P 3 UAV , P 5 UAV The remaining P 2 UAV , P 4 UAVFurther identification is required. In fact, for geofenced areas within prefecture-level cities, after gridding, the majority of the grids have internal attributes, leaving relatively few boundary and external grids. Assuming the distribution of real-time drones within the fenced area is uniform, we can identify most drones by matching the internal, external, and boundary grids. This process is virtually time-saving, significantly improving identification efficiency.

[0112] 6. Determining the Positional Relationship Between the Drone and the Fence Area

[0113] The drone that falls within the boundary grid needs to be further determined whether it falls inside or outside the fence. Figure 4 P shown 2 UAV , P 4 UAV If the drone falls outside the fence area, the judgment of the drone can be ended and an alarm message indicating that the drone has flown out of the fence can be output. Figure 1 P shown 4 UAV If the drone lands inside the fence, the closest distance between the drone and the fence boundary must be accurately calculated. This determination can be translated into a computer graphics algorithm: determining whether a point is inside a polygon. The most commonly used algorithm for determining whether a point is inside a polygon is the ray method.

[0114] like Figure 5 As shown in the figure, polygon (ABCDEFA), P1, P2, P3 are test points, with P1, P2, P3 as the starting point, horizontal rays are drawn to the right, P1P1 R There are two intersection points with the polygon, namely P4 and P5; P2P2 R There is one intersection point with the polygon, namely P6; P3P3 R There are two intersection points with the polygon, P7 and P8, where P7 and P3 coincide. Generally, when the number of intersection points is even, the point is considered outside the polygon, as in the figure at point P1; when the number of intersection points is odd, the point is considered inside the polygon, as in the figure at point P2. If the test point coincides with the first intersection point (the distance between the two points is within a very small threshold range), the point is considered on the polygon boundary, as in the figure at point P3, which coincides with the first intersection point, P7.

[0115] In principle, during the ray method's determination process, the ray needs to be calculated and compared with each boundary segment of the polygon. The algorithm's time complexity is O(n), where n is the number of vertices of the polygon. For application scenarios with a large number of polygon vertices and high real-time requirements for the algorithm, there will be serious performance issues. For example, the fence polygons we deal with are often the boundaries of a prefecture-level city area, with a number of vertices generally around a few thousand. The ultimate processing requirement of the security monitoring platform is to be able to respond to millions of drones in real time. With a one-second response processing capability, this calculation alone would require billions of comparison calculations, which is obviously too expensive and unfeasible. This solution fully utilizes the fact that the fence boundary has been gridded and adopts a clever idea to achieve an efficient ray method to determine the relationship between drones and fence areas. The algorithm's time complexity is reduced to O(1), which is independent of the number of fence boundary vertices. In this way, even if millions of drones are calculated in real time, theoretically only millions of calculations and determinations are required, and real-time response can be easily achieved.

[0116] Obtain the drone P by calculation UAV In the grid set S GRID The row and column indexes in are: Row, Col, and the grid set S GRID The maximum number of rows and columns are: R MAX 、C MAX The algorithm is as follows:

[0117] ① Calculate the starting grid index and the ending grid index using the following formula:

[0118] G S =Row*C MAX +Col;

[0119] G E =Row*C MAX +C MAX -1;

[0120] Where G S It's a drone P UAV The index of the grid; G E Yes and P UAV The rightmost grid index in the same row. UAV Falling on the starting grid G S In the ray method, according to the processing requirements, P UAV Need to use P UAV As the starting point, draw a ray to the right. Since this right ray will only pass through the grids in the same line, we only need to compare and calculate the ray with the boundary segments in these grids in the same line, and there is no need to compare and calculate the ray with all other boundary segments.

[0121] ② Take out the starting grid G ​​one by oneS To the end grid G E All grids between (including G S and G E ), if the grid stores information about boundary segments, the index value of the boundary segment is stored in a temporary array, recorded as: V S The purpose is to combine all needs and P UAV The boundary segments of the right ray for intersection determination are found and put together for the convenience of the next step. After processing G S to G E After all the grids are S The index values ​​stored in the deduplicate process are removed to avoid repeated judgments in subsequent algorithms.

[0122] ③ Take out V in sequence S The boundary line index value in L B Get the corresponding line segment coordinate information, recorded as: S AB For example, if the fence boundary line segment AB corresponds to a stored index value of 0, the coordinates of AB can be found through the index value. If the index value is 1, it means that the boundary line segment is BC, and the coordinates of points B and C can be directly obtained through the fence boundary data. UAV and S AB Perform comparison calculation. The algorithm still uses the ray method to determine, let P UAV The right ray and S AB Perform intersection calculation, if there is an intersection, the number of intersections is accumulated. Finally, according to the parity judgment principle and boundary judgment principle of the final number of intersections, P is obtained. UAV and the final position relationship of the fenced area.

[0123] ④The algorithm ends.

[0124] like Figure 6 As shown, P 2 UAV The grid is G S , the last grid in the same row is G E , V S The index values ​​of the two boundary segments are retained, namely 0 and 1. The index value 0 is the segment AB, and the index value 1 is the segment BC. Let ray P 2 UAV P 2 R Intersection calculations are performed with AB and BC respectively, and the result is ray P 2 UAV P 2 R There is no intersection with AB, but there is an intersection with BC, which ultimately means that ray P 2 UAV P2 R There is only one intersection with the fence area, so determine P 2 UAV Inside the fence, the entire judgment only performs two ray and line segment intersection calculations. Similarly, for P 4 UAV , ray P 4 UAV P 4 R Only one intersection calculation is needed with line segment CD. The result is no intersection point. 4 UAV Outside the fence.

[0125] 7. Calculating the distance between the drone and the fence boundary

[0126] After the above steps are processed, if the drone is determined to be inside the fence, the final distance between the drone and the fence boundary needs to be calculated. This distance is the shortest distance between the drone and the fence boundary. In theory, it also faces the same relationship as the previous step 6 between the determination point and the fence area. It is necessary to calculate the distance between the drone position and all the fence boundary segments segment by segment to obtain the minimum distance. The time complexity of the algorithm is also O(N), which is proportional to the number of fence boundary segments. Since we have stored the associated boundary segment index information in the grid when we did the grid identification before (the grid matched by the drone is G D ), we make full use of this feature, when calculating the closest distance, we only need to take the drone position point and G D The distance calculation can be performed based on the boundary segments stored in .

[0127] If the distance between the drone and the fence boundary is less than D TH , then a warning message needs to be issued to the drone, and this warning message will contain the precise closest distance to the fence boundary; if the distance between the drone and the fence boundary is not less than D TH , it is considered normal flight.

[0128] The algorithm process is as follows:

[0129] ① Take out the grid G ​​matched by the drone one by one D The boundary line index value information stored in L B Get the corresponding line segment coordinate information, recorded as: S AB . S AB and P UAV Perform the shortest distance calculation. The algorithm for calculating the shortest distance between a point and a line segment is as follows:

[0130] Let A and B be the two vertices of the line segment, P UAVThe minimum distance to line segment AB is: D AB min First, determine P UAV Is there a perpendicular foot to line segment AB? If yes, then P UAV The distance to the foot of the perpendicular is D AB min ; No: then calculate P separately UAV The distance to point A and point B, the smaller distance is D AB min .

[0131] ②After calculating all line segments and P UAV After the minimum distance, take D min =Min{D AB min ,D CD min ,…D MN min};

[0132] ⑤Return the closest distance between the drone and the fence boundary: D min ;

[0133] ⑥The algorithm ends;

[0134] like Figure 7 As shown, P 1 UAV 、P 2 UAV Falling on the boundary grid G 1 D and G 2 D In the meantime, they are all inside the fence area, which requires the final boundary distance calculation. 1 D The boundary segments stored in are AB and BC, let P 1 UAV Calculate the closest distance with AB and BC respectively to get D AB min and D BC min , take D1 min =Min{D AB min ,D BC min}, D1 min P 1 UAV The closest distance to the fence boundary; due to G 2 D Only the information of the boundary line segment AB is stored in P 2 UAV The closest distance to the fence boundary only needs to calculate P2 UAV The shortest distance to AB is enough to get D2 min Finally, return to D1 min and D2 min .

[0135] Since D1 min ≥D TH , no need to P 1 UAV Issue warning information;

[0136] Since D2 min <D TH , need to P 2 UAV Issue an alarm message (with the value of the closest distance to the fence boundary);

[0137] 8. Summary of Geofence Security Testing Results

[0138] After the security monitoring platform has processed the aforementioned steps, it has detected all drones that require alerts. The monitoring platform is responsible for aggregating these alerts, classifying them according to their type, and finally sending them in real time through the messaging middleware.

[0139] Example 2:

[0140] The system for determining the position of a drone and a geo-fenced area and calculating the distance therebetween can implement the method for determining the position of a drone and a geo-fenced area and calculating the distance therebetween described in Example 1, including:

[0141] Data receiving module: receives real-time drone location data;

[0142] Position determination module: matches the drone's position data with the geo-fence area, and determines the positional relationship between the drone and the geo-fence area based on the matching results;

[0143] Deep judgment module: In response to the current position of the drone being within the boundary grid of the geo-fenced area, further judge the positional relationship between the drone and the fenced area;

[0144] Distance calculation module: in response to the current position of the drone being within the geo-fenced area, calculates the closest distance between the drone and the fence boundary;

[0145] Distance comparison module: compares the closest distance between the drone and the fence boundary with a given threshold. If the closest distance is less than the given threshold, an alarm message will be issued; otherwise, no alarm message will be issued.

[0146] Alarm sending module: sends an alarm message in response to the drone's current position being outside the geo-fence area.

[0147] Example 3:

[0148] The embodiment of the present invention further provides a device for determining the position of a drone and a geo-fenced area and calculating the distance therebetween, which can implement the method for determining the position of a drone and a geo-fenced area and calculating the distance therebetween described in the first embodiment, including a processor and a storage medium;

[0149] The storage medium is used to store instructions;

[0150] The processor is configured to operate according to the instructions to execute the steps of the following method:

[0151] Receive real-time drone location data;

[0152] Based on the matching of the drone's location data with the geo-fenced area, the positional relationship between the drone and the geo-fenced area is determined according to the matching results;

[0153] In response to the current position of the drone being within a boundary grid of the geo-fenced area, further determining a positional relationship between the drone and the fenced area;

[0154] In response to the current position of the drone being within the geo-fenced area, calculating the closest distance between the drone and the fence boundary;

[0155] Compare the closest distance between the drone and the fence boundary with a given threshold. If the closest distance is less than the given threshold, an alarm message will be issued; otherwise, no alarm message will be issued.

[0156] In response to the drone's current location being outside the geo-fence area, an alarm message is issued.

[0157] Example 4:

[0158] An embodiment of the present invention further provides a computer-readable storage medium that can implement the method for determining the position of a drone and a geo-fenced area and calculating the distance described in Example 1. The computer-readable storage medium stores a computer program that, when executed by a processor, implements the following steps:

[0159] Receive real-time drone location data;

[0160] Based on the matching of the drone's location data with the geo-fenced area, the positional relationship between the drone and the geo-fenced area is determined according to the matching results;

[0161] In response to the current position of the drone being within a boundary grid of the geo-fenced area, further determining a positional relationship between the drone and the fenced area;

[0162] In response to the current position of the drone being within the geo-fenced area, calculating the closest distance between the drone and the fence boundary;

[0163] Compare the closest distance between the drone and the fence boundary with a given threshold. If the closest distance is less than the given threshold, an alarm message will be issued; otherwise, no alarm message will be issued.

[0164] In response to the drone's current location being outside the geo-fence area, an alarm message is issued.

[0165] It is understood from common technical knowledge that the present invention may be implemented by other embodiments that do not depart from its spirit or essential features. Therefore, the embodiments disclosed above are, in all respects, merely illustrative and not exclusive. All modifications within the scope of the present invention or equivalent to the scope of the present invention are intended to be encompassed by the present invention.

[0166] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0167] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0168] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0169] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0170] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered by the scope of protection of the claims of the present invention.

Claims

1. A method for determining the position of a drone and a geo-fenced area and calculating the distance therebetween, characterized in that: include: Receive real-time drone location data; Based on the matching of the drone's location data with the geo-fenced area, the positional relationship between the drone and the geo-fenced area is determined according to the matching results; In response to the current position of the drone being within a boundary grid of the geo-fenced area, further determining a positional relationship between the drone and the fenced area; In response to the current position of the drone being within the geo-fenced area, calculating the closest distance between the drone and the fence boundary; Compare the closest distance between the drone and the fence boundary with a given threshold. If the closest distance is less than the given threshold, an alarm message will be issued; otherwise, no alarm message will be issued. In response to the drone's current location being outside the geo-fence area, an alarm message is issued.

2. The method for determining the position and calculating the distance between a drone and a geo-fenced area according to claim 1, wherein: Based on the matching of the drone's location data with the geo-fenced area, the positional relationship between the drone and the geo-fenced area is determined based on the matching results, including: Get the drone's location; Calculate the position of the drone in the grid set S according to the drone's position coordinates GRID The row and column indices in ; Based on the UAV in the grid collection S GRID The row and column indexes in the grid set S are used to calculate the position of the drone. GRID The corresponding grid in is denoted as G P ; In response to G P ∈S 1 GRID When , the current position of the drone is determined to be within the boundary grid of the geo-fenced area; In response to G P ∈S 2 GRID When , it is determined that the current position of the drone is outside the geo-fence area; In response to G P ∈S 3 GRID When , it is determined that the current position of the drone is within the geo-fenced area; The S GRID is the complete set of all grids, the S 1 GRID is a set of grids near the fence polygon boundary line, the S 2 GRID is a set of grids completely outside the fence, the S 3 GRID is the set of grids completely inside the fence, and S GRID =S 1 GRID +S 2 GRID +S 3 GRID .

3. The method for determining the position and calculating the distance between a drone and a geo-fenced area according to claim 2, wherein: In response to the current position of the drone being within a boundary grid of the geo-fenced area, further determining a positional relationship between the drone and the fenced area includes: Get the drone in the grid set S GRID Calculate the row and column indexes in the grid, and the start and end grid indexes; Take out all grids from the starting grid index to the ending grid index one by one. If the grid stores information about boundary segments, store the index value of the boundary segment in a temporary array, which is recorded as: V S ; After processing all grids from the start grid index to the end grid index, V S Deduplication of index values ​​stored in ; Take out V in sequence S The boundary line index value in the fence polygon boundary line L B Get the corresponding line segment coordinate information, recorded as: S AB ; The right ray passing through the drone's position and S AB Perform intersection calculation and accumulate all intersection points; In response to the number of all intersection points being an odd number, determining that the current position of the drone is within the geo-fenced area; In response to the fact that the number of all intersection points is an even number, it is determined that the current position of the drone is outside the geo-fence area.

4. The method for determining the position and calculating the distance between a drone and a geo-fenced area according to claim 3, wherein: The calculation formulas for the starting grid index and the ending grid index are: G S =Row*C MAX +Col; G E =Row*C MAX +C MAX -1; Where G S is the index of the grid where the drone is located; G E is the rightmost grid index in the same row as the drone; Row and Col are the index of the drone in the grid set S GRID The row and column indexes in C MAX is the grid set S GRID The maximum number of columns.

5. The method for determining the position and calculating the distance between a drone and a geo-fenced area according to claim 1, wherein: In response to the drone's current location being within the geo-fence area, the closest distance between the drone and the fence boundary is calculated, including: Determine whether the drone's location is perpendicular to the fence boundary segment; In response to the fact that the position of the drone has a foot of a perpendicular to the boundary line segment of the fence, the closest distance between the drone and the boundary line segment of the fence is the distance between the position of the drone and the foot of the perpendicular to the boundary line segment of the fence; In response to the UAV's position having a perpendicular foot to the fence boundary segment, the closest distance between the UAV and the fence boundary segment is the minimum distance between the UAV's position and each endpoint of the fence boundary segment; After calculating the closest distances between all line segments and the drone, the minimum value is taken as the closest distance between the drone and the fence boundary.

6. The method for determining the position and calculating the distance between a drone and a geo-fenced area according to claim 1, wherein: Compare the closest distance between the drone and the fence boundary with a given threshold. If the closest distance is less than the given threshold, an alarm message will be issued. Otherwise, no alarm message will be issued. This includes: The closest distance between the drone and the fence boundary is compared to the fence threshold; In response to the closest distance between the drone and the fence boundary being less than the fence threshold, an alarm message needs to be issued to the drone along with the closest distance between the drone and the fence boundary; otherwise, no alarm message needs to be issued to the drone.

7. The method for determining the position and calculating the distance between a drone and a geo-fenced area according to claim 1, wherein: The alarm information is aggregated and sent in real time via the message middleware.

8. A system for determining the position and calculating the distance between a drone and a geo-fenced area, characterized by: include: Data receiving module: receives real-time drone location data; Position determination module: matches the drone's position data with the geo-fence area, and determines the positional relationship between the drone and the geo-fence area based on the matching results; Deep judgment module: In response to the current position of the drone being within the boundary grid of the geo-fenced area, further judge the positional relationship between the drone and the fenced area; Distance calculation module: in response to the current position of the drone being within the geo-fenced area, calculates the closest distance between the drone and the fence boundary; Distance comparison module: compares the closest distance between the drone and the fence boundary with a given threshold. If the closest distance is less than the given threshold, an alarm message will be issued; otherwise, no alarm message will be issued. Alarm sending module: sends an alarm message in response to the drone's current position being outside the geo-fence area.

9. A device for determining the position of a drone and a geo-fenced area and calculating the distance therebetween, characterized in that: including processors and storage media; The storage medium is used to store instructions; The processor is configured to operate according to the instructions to execute the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Method and device for marking aerial video in real time

    CN121661551A

  • A method and device for real-time labeling of aerial video

    CN121661551B