Unmanned aerial vehicle operation trajectory dynamic optimization method and system based on neural network

By setting reference points on the UAV to construct convex polygons and using neural networks to optimize trajectory control, the problem of insufficient trajectory adaptability of traditional methods in urban canyon power line inspection is solved, and the UAV can achieve accurate tracking and high-quality inspection in complex trajectories.

CN121500783BActive Publication Date: 2026-04-17XIAMEN ZHIXIANG INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-13
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Traditional trajectory tracking methods cannot effectively adapt to the curvature changes of complex trajectories in urban canyon power line inspection scenarios, leading to increased fluctuations in UAV tracking errors and affecting inspection results.

Method used

By setting three reference points, a convex polygon is constructed and shape fit features are extracted. Combined with a neural network model, the trajectory control of the UAV is optimized, and flight parameters are adjusted in real time to adapt to complex trajectories.

Benefits of technology

It effectively reduces the lateral tracking error of drones during complex trajectory tracking, ensuring that drones accurately follow the preset trajectory to complete inspections, and improving the integrity and accuracy of inspection data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121500783B_ABST
    Figure CN121500783B_ABST
Patent Text Reader

Abstract

This invention provides a method and system for dynamic optimization of UAV flight trajectories based on neural networks, belonging to the field of data processing technology. The method includes: calculating the geometric moments of a two-dimensional contour; obtaining the central moment of the contour based on the geometric moments; normalizing the central moment and extracting Hu invariant moment features; combining shape fit features and Hu invariant moment features to form a digital environment feature vector; processing the digital environment feature vector with pose state information and a preset desired trajectory; fusing the results through a neural network model to obtain control parameter adjustment instructions; and, based on the control parameter adjustment instructions, real-time correcting of the UAV flight controller parameters to generate control signals driving the UAV actuators, thereby achieving dynamic tracking of the desired trajectory. This invention enables accurate dynamic tracking of complex trajectories by UAVs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a method and system for dynamic optimization of UAV flight trajectories based on neural networks. Background Technology

[0002] In the scenario of UAVs performing power line inspections in urban canyons, automatic tracking of preset trajectories is one of the core elements for achieving autonomous operation. Accuracy, smoothness, and dynamic adaptability are usually key indicators for measuring trajectory tracking performance. Preset trajectories in this scenario often have significant complex geometric features. Specifically, to complete the inspection of power transmission lines arranged along the edges of buildings in urban canyons, the preset trajectory needs to avoid tall buildings on both sides, forming a continuous curve trajectory with varying curvature. In addition, some sections may experience sudden changes in curvature due to changes in the route. At the same time, there may also be potential environmental interference factors such as local wind shear in urban canyons. These characteristics all place high demands on the dynamic adaptability of the UAV trajectory tracking system. At present, traditional methods based on PID control and pure geometric path tracking (such as pure tracking method, vector field method, etc.) have been widely used in low-dynamic, simple trajectory scenarios (such as straight paths in open areas and gentle trajectories with small curvature) and can meet the tracking needs of basic operations to a certain extent. However, in the specific scenario of power line inspection in urban canyons, the tracking performance of some traditional methods is prone to degradation, and there is obvious room for optimization.

[0003] Specifically, the core logic of traditional trajectory tracking methods often relies on direct error feedback between the current UAV pose and a reference point on the desired trajectory. They often fail to fully utilize the instantaneous geometric depth of the trajectory (such as curvature magnitude, rate of curvature change, and abrupt changes in trajectory tangent direction). This problem is particularly prominent in the trajectory tracking of power line inspections in urban canyons with continuously varying curvature. Taking the pure tracking method, widely used in pure geometric path tracking, as an example, although it introduces a pre-aiming mechanism to improve tracking stability, the pre-aiming distance is mostly a fixed value, making it difficult to flexibly match different curvature road segments. The tracking requirements are insufficient. In the continuous variable curvature trajectory section of power line inspection in urban canyons, when the trajectory curvature is small, a fixed pre-aiming distance may lead to over-aiming, increasing unnecessary attitude adjustment costs. When the trajectory curvature changes abruptly due to avoiding buildings, a fixed pre-aiming distance may result in pre-aiming lag, failing to capture the trajectory turning trend in time. This insufficient adaptation to real-time changes in trajectory curvature may lead to increased lateral tracking error fluctuations during UAV tracking. Although it may not completely exceed the allowable range, it may approach the error threshold, affecting the inspection effect of key parts of the transmission line. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide a method and system for dynamic optimization of UAV flight trajectory based on neural network, which can realize the accurate dynamic tracking of UAVs on complex trajectories.

[0005] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:

[0006] Firstly, a method for dynamic optimization of UAV flight trajectories based on neural networks, the method comprising:

[0007] Step 1: Obtain the UAV pose status information and the preset desired trajectory. The pose status information includes position and heading, and the desired trajectory includes curvature features.

[0008] Step 2: Based on the pose status information and the preset desired trajectory, set three reference points in the space; the first reference point is located on the desired trajectory at a pre-aiming distance in front of the UAV, the second reference point is located in the direction of trajectory extension in front of the first reference point, and the third reference point is located at the lateral offset position determined according to the direction of trajectory curvature.

[0009] Step 3: Construct a first convex polygon based on the spatial coordinates of the three reference points, generate a second convex polygon based on the curvature features, calculate the area of ​​the intersection of the first and second convex polygons as the shape fit feature, and construct a two-dimensional contour based on the spatial coordinates of the three reference points.

[0010] Step 4: Calculate the geometric moments of the two-dimensional contour, obtain the central moment of the contour based on the geometric moments, normalize the central moment and extract the Hu invariant moment features, and combine the shape fit features with the Hu invariant moment features to form a digital environment feature vector.

[0011] Step 5: Process the digital environment feature vector, pose state information, and preset desired trajectory, and fuse them through a neural network model to obtain control parameter adjustment instructions;

[0012] Step 6: According to the control parameter adjustment instructions, the parameters of the UAV flight controller are corrected in real time, and control signals are generated to drive the UAV actuators to achieve dynamic tracking of the desired trajectory.

[0013] Secondly, a neural network-based dynamic optimization system for UAV trajectory includes:

[0014] The acquisition module is used to acquire the UAV's pose status information and the preset expected trajectory. The pose status information includes position and heading, and the expected trajectory includes curvature features.

[0015] The positioning module is used to set three reference points in space based on the pose status information and the preset desired trajectory. The first reference point is located on the desired trajectory at a pre-aiming distance in front of the UAV, the second reference point is located in the direction of the trajectory extension in front of the first reference point, and the third reference point is located at the lateral offset position determined according to the direction of trajectory curvature.

[0016] The calculation module is used to construct a first convex polygon based on the spatial coordinates of three reference points, generate a second convex polygon based on curvature features, calculate the area of ​​the intersection of the first and second convex polygons as the shape fit feature, and construct a two-dimensional contour based on the spatial coordinates of three reference points.

[0017] The processing module is used to calculate the geometric moments of the two-dimensional contour, obtain the central moment of the contour based on the geometric moments, normalize the central moment and extract the Hu invariant moment features, and combine the shape fit features with the Hu invariant moment features to form a digital environment feature vector.

[0018] The fusion module is used to process the digital environment feature vectors, pose state information, and preset desired trajectories, and fuse them through a neural network model to obtain control parameter adjustment instructions.

[0019] The control module is used to adjust the parameters of the UAV flight controller in real time according to the control parameter adjustment instructions, generate control signals to drive the UAV actuators, and realize dynamic tracking of the desired trajectory.

[0020] Thirdly, a computing device includes:

[0021] One or more processors;

[0022] A storage device for storing one or more programs that, when executed by one or more processors, cause the one or more processors to implement the method.

[0023] Fourthly, a computer-readable storage medium storing a program that, when executed by a processor, implements the method.

[0024] The above-described solution of the present invention has at least the following beneficial effects:

[0025] This invention establishes three reference points, including the pre-aiming direction and the lateral offset position of curvature, constructs a convex polygon based on trajectory curvature features, extracts shape fit features, and obtains Hu invariant moment features through geometric moment calculation. The resulting digital environment feature vector can comprehensively and accurately characterize the deep geometric information such as the instantaneous curvature and extension trend of the desired trajectory, effectively solving the problem of insufficient mining and utilization of deep geometric information in trajectory tracking methods. This invention can effectively reduce the lateral tracking error fluctuation of UAVs in complex trajectory tracking processes, reduce the risk of errors approaching or exceeding the threshold, and ensure that UAVs can accurately fit the preset trajectory to complete the inspection of key parts of transmission lines in urban canyon power line inspection scenarios, improving the integrity and accuracy of inspection data and ensuring the quality of inspection operations. Attached Figure Description

[0026] Figure 1 This is a schematic diagram of the process of a method for dynamic optimization of UAV trajectory based on neural networks provided in an embodiment of the present invention.

[0027] Figure 2 This is a schematic diagram of a neural network-based dynamic optimization system for unmanned aerial vehicle (UAV) trajectories provided in an embodiment of the present invention. Detailed Implementation

[0028] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0029] like Figure 1 As shown, embodiments of the present invention propose a method for dynamic optimization of UAV flight trajectories based on neural networks, the method comprising the following steps:

[0030] Step 1: Obtain the UAV pose status information and the preset desired trajectory. The pose status information includes position and heading, and the desired trajectory includes curvature features.

[0031] Step 2: Based on the pose status information and the preset desired trajectory, set three reference points in the space; the first reference point is located on the desired trajectory at a pre-aiming distance in front of the UAV, the second reference point is located in the direction of trajectory extension in front of the first reference point, and the third reference point is located at the lateral offset position determined according to the direction of trajectory curvature.

[0032] Step 3: Construct a first convex polygon based on the spatial coordinates of the three reference points, generate a second convex polygon based on the curvature features, calculate the area of ​​the intersection of the first and second convex polygons as the shape fit feature, and construct a two-dimensional contour based on the spatial coordinates of the three reference points.

[0033] Step 4: Calculate the geometric moments of the two-dimensional contour, obtain the central moment of the contour based on the geometric moments, normalize the central moment and extract the Hu invariant moment features, and combine the shape fit features with the Hu invariant moment features to form a digital environment feature vector.

[0034] Step 5: Process the digital environment feature vector, pose state information, and preset desired trajectory, and fuse them through a neural network model to obtain control parameter adjustment instructions;

[0035] Step 6: According to the control parameter adjustment instructions, the parameters of the UAV flight controller are corrected in real time, and control signals are generated to drive the UAV actuators to achieve dynamic tracking of the desired trajectory.

[0036] In this embodiment of the invention, the invention sets three reference points including the pre-aiming direction and the curvature lateral offset position, constructs a convex polygon by combining trajectory curvature features and extracts shape fitting features, and obtains Hu invariant moment features through geometric moment calculation. The resulting digital environment feature vector can comprehensively and accurately characterize the deep geometric information such as the instantaneous curvature and extension trend of the desired trajectory, effectively solving the problem of insufficient mining and utilization of deep geometric information of the trajectory tracking method. The invention can effectively reduce the lateral tracking error fluctuation of UAVs in the process of complex trajectory tracking, reduce the risk of errors approaching or exceeding the threshold, and ensure that UAVs can accurately fit the preset trajectory to complete the inspection of key parts of the transmission line in urban canyon power inspection scenarios, improve the integrity and accuracy of inspection data, and ensure the quality of inspection operations.

[0037] In a preferred embodiment of the present invention, step 1 involves acquiring the pose state information of the UAV and a preset desired trajectory. The pose state information includes position and heading, and the desired trajectory includes curvature features. Specifically, this includes: acquiring data through a combination of a satellite positioning unit, an inertial measurement unit, and a visual sensor mounted on the UAV to obtain the UAV's pose state information; wherein, the position information is acquired in real time by the satellite positioning unit, which collects the current three-dimensional spatial coordinates of the UAV, specifically the X-axis, Y-axis, and Z-axis coordinates of the UAV in the Earth coordinate system; the heading information is acquired in real time by the inertial measurement unit, which collects the current flight information of the UAV. The heading angle, which is the angle between the UAV's fuselage axis and the due north direction of the geodetic coordinate system, ensures that the attitude information can accurately reflect the UAV's real-time flight attitude in the urban canyon power line inspection scenario. The preset expected trajectory is pre-planned and generated by combining the layout path of the power transmission lines in the urban canyon and the distribution of tall buildings on both sides. During the generation process, the curvature features of the expected trajectory are extracted simultaneously. The specific extraction method is to first set a fixed sampling interval, which is determined according to the accuracy requirements of the power transmission line inspection in the urban canyon. Then, the three-dimensional spatial coordinate information of multiple adjacent sampling points on the expected trajectory is continuously obtained according to the interval.

[0038] For every two adjacent sampling points, the X-axis difference is obtained by subtracting the X-axis coordinate of the previous sampling point from the X-axis coordinate of the subsequent sampling point, and the Y-axis difference is obtained by subtracting the Y-axis coordinate of the previous sampling point from the Y-axis coordinate of the subsequent sampling point. The quadrant of the connecting line is determined based on the signs of the X-axis and Y-axis differences. The angle between the connecting line and the positive direction of the X-axis of the geodetic coordinate system is determined by combining the absolute values ​​of the X-axis and Y-axis differences. This gives the direction angle of the connecting line between the two adjacent sampling points. Three consecutive sampling points are selected, and the direction angles of the connecting lines between the first two sampling points and the last two sampling points are calculated. The angle change between the first and last directions is obtained by subtracting the angle of the last direction from the angle of the first direction. Then, the straight-line distance between the two adjacent sampling points is calculated by summing the squares of the X-axis and Y-axis differences and taking the square root. Finally, the angle change between the two adjacent lines is divided by the straight-line distance between the two adjacent sampling points to obtain the curvature characteristic of the trajectory at each intermediate sampling point.

[0039] This embodiment ensures the real-time and accuracy of pose status information by combining multiple sensors, and at the same time, it captures the geometric properties of the desired trajectory completely through a precise curvature feature extraction process, providing reliable basic data for subsequent reference point setting and trajectory tracking control.

[0040] In a preferred embodiment of the present invention, step 2, based on the pose state information and the preset desired trajectory, sets three reference points in space; the first reference point is located on the desired trajectory at a pre-aiming distance in front of the UAV, the second reference point is located in the direction of trajectory extension in front of the first reference point, and the third reference point is located at a lateral offset position determined according to the trajectory curvature direction, which may include:

[0041] Step 201: Calculate the pre-aiming distance based on the UAV's pose state information and the curvature characteristics of the desired trajectory. Determine the spatial coordinates of the first reference point on the desired trajectory based on the pre-aiming distance. Specifically, this includes: combining the flight speed from the UAV's pose state information and the curvature characteristics of the desired trajectory to calculate an adaptive pre-aiming distance suitable for the current inspection segment. The specific calculation process involves pre-setting two fixed proportional coefficients: a speed correlation coefficient and a curvature correlation coefficient. The speed correlation coefficient is used to adjust the degree of influence of flight speed on the pre-aiming distance, and the curvature correlation coefficient is used to adjust the correction magnitude of the curvature characteristics on the pre-aiming distance. The speed correlation coefficient is directly multiplied by the current flight speed of the UAV to obtain the first intermediate result, which reflects the basic pre-aiming distance based on the flight speed. Then, the curvature correlation coefficient is multiplied by the square of the curvature feature of the current road segment extracted in step 1 to obtain the second intermediate result, which is used to correct the basic pre-aiming distance according to the curvature of the trajectory. Then, 1 is added to the second intermediate result to obtain the third intermediate result. This calculation realizes the rational constraint on the curvature correction range and avoids over-correction. Finally, the first intermediate result and the third intermediate result are directly multiplied to obtain the adaptive pre-aiming distance of the current road segment.

[0042] This calculation logic ensures that the greater the trajectory curvature, the larger the second intermediate result, the larger the third intermediate result, and the smaller the final aiming distance; conversely, the smaller the trajectory curvature, the smaller the second intermediate result, the closer the third intermediate result is to 1, and the closer the final aiming distance is to the base aiming distance, perfectly adapting to the inspection trajectory with continuously varying curvature in urban canyons. After calculating the aiming distance, starting from the current position of the UAV, a point-by-point path search is performed along the current heading direction collected by the inertial measurement unit on the desired trajectory preset in step 1. During the search, for each sampling point on the desired trajectory, the straight-line distance between the sampling point and the current position of the UAV is calculated. The calculation method is to sum the squares of the differences in the X-axis coordinates, the Y-axis coordinates, and the Z-axis coordinates of the two points and take the square root. Sampling points whose straight-line distance is equal to the calculated aiming distance are selected, and this point is the first reference point. Its spatial coordinates are accurately determined in the following way: first, retrieve the complete three-dimensional coordinate dataset of the desired trajectory, then substitute the current position coordinates of the UAV and the pre-aiming distance into the spatial distance formula, establish an equation and solve it to obtain the three-dimensional coordinates of the trajectory point that meets the distance conditions, which are the three-dimensional spatial coordinates of the first reference point.

[0043] Step 202: Based on the spatial coordinates of the first reference point, obtain the trajectory extension direction and curvature direction of the desired trajectory at the first reference point. Move along the trajectory extension direction by a preset extension step size to calculate the spatial coordinates of the second reference point. Combine the curvature direction with a preset lateral offset distance to calculate the lateral offset direction. Based on the lateral offset direction and the spatial coordinates of the first reference point, calculate the spatial coordinates of the third reference point. Specifically, this includes: determining the spatial coordinates of the first reference point, extracting the trajectory extension direction and curvature direction of the desired trajectory at that point; the trajectory extension direction is extracted by retrieving the coordinates of multiple adjacent sampling points on the desired trajectory, and selecting the coordinates of the first reference point. For the next sampling point adjacent to the reference point, calculate the difference in X-axis coordinates, Y-axis coordinates, and Z-axis coordinates between the sampling point and the first reference point. Construct a direction vector using these three differences. The direction corresponding to this direction vector is the trajectory extension direction at the first reference point. The curvature direction is extracted by determining the curvature orientation of the trajectory based on the positive or negative curvature feature at the first reference point calculated in step 1. In the urban canyon inspection scenario, if the curvature feature is positive, the trajectory bends towards the building on the left side of the transmission line, and the curvature direction is the left. If the curvature feature is negative, the trajectory bends towards the building on the right side of the transmission line, and the curvature direction is the right. This orientation is the side of the building that needs to be avoided.

[0044] After determining the trajectory extension direction, a fixed extension step size is preset. This step size is determined based on the sampling interval of the inspection trajectory and is not greater than the distance between adjacent sampling points. The extension step size is translated forward from the first reference point along the trajectory extension direction, and the spatial position after translation is the second reference point. Its spatial coordinates are calculated as follows: First, the extension step size is multiplied by the unit vector of the trajectory extension direction vector to obtain the components of the extension step size on the X, Y, and Z axes. Then, the X, Y, and Z coordinates of the first reference point are added to the corresponding components to obtain the three-dimensional spatial coordinates of the second reference point. Combined with the determined curvature direction and the preset lateral offset distance, the lateral offset direction is calculated, and the lateral offset direction maintains the curvature direction. Consistency, meaning the direction of deviation from the desired trajectory along the curvature direction is the lateral offset direction, and this direction is perpendicular to the trajectory extension direction; a fixed lateral offset distance is preset, which is determined according to the safe distance between buildings and power transmission lines in the urban canyon to ensure that the UAV has enough room to maneuver. The UAV is translated from the first reference point along the lateral offset direction by this lateral offset distance, and the spatial position after translation is the third reference point; its spatial coordinates are calculated as follows: first, the lateral offset distance is multiplied by the unit vector of the lateral offset direction vector to obtain the components of the lateral offset distance on the X-axis, Y-axis, and Z-axis; then, the X-axis coordinates, Y-axis coordinates, and Z-axis coordinates of the first reference point are added to the corresponding components to obtain the three-dimensional spatial coordinates of the third reference point.

[0045] In this embodiment, a second reference point is set by the trajectory extension direction to capture the trajectory forward trend, and a third reference point is set by the curvature direction to capture the trajectory bending and avoidance requirements. The spatial layout formed by the three reference points can accurately characterize the local trajectory geometric attributes of the current inspection section; it provides accurate spatial reference for subsequent construction of convex polygons and extraction of environmental feature vectors, effectively improving the adaptability of UAVs to curvature change sections and continuous curves in urban canyons.

[0046] In a preferred embodiment of the present invention, step 3, constructing a first convex polygon based on the spatial coordinates of three reference points, generating a second convex polygon based on curvature features, calculating the area of ​​the intersection of the first and second convex polygons as a shape fit feature, and constructing a two-dimensional contour based on the spatial coordinates of the three reference points, may include:

[0047] Step 301: Based on the spatial coordinates of the three reference points and the position in the UAV's pose information, construct a first convex polygon by connecting the three reference points and the UAV's position. This includes: determining the three-dimensional spatial coordinates of the three reference points, and retrieving the current position coordinates of the UAV obtained in Step 1. These four points are used as the core vertices for constructing the first convex polygon. Considering the dense distribution of buildings around the trajectory in the urban canyon power inspection scenario, first determine the spatial relationship of the four points to ensure that the constructed polygon can cover the key area around the current inspection trajectory. The specific construction process is to first use the current position of the UAV as the starting vertex, connect the first reference point, the second reference point, and the third reference point in sequence, and finally connect them back to the current position of the UAV to form a quadrilateral outline. Determine whether the quadrilateral is a convex polygon by calculating the angle of each interior angle of the quadrilateral. If all interior angles are less than 180 degrees, then the quadrilateral is the first convex polygon. If there are interior angles greater than or equal to 180 degrees, adjust the vertex connection order, adjust the vertices whose interior angles do not meet the requirements to adjacent vertices, reconnect them, and determine the interior angles again until all interior angles are less than 180 degrees, finally obtaining the first convex polygon that meets the requirements.

[0048] Step 302: Generate a second convex polygon based on the curvature features of the desired trajectory and the boundary vertex information of the first convex polygon; calculate the area of ​​the intersection region between the first and second convex polygons, and use the area of ​​the intersection region as the shape fit feature. Specifically, this includes: firstly, generating the second convex polygon by retrieving the curvature features of the desired trajectory extracted in step 1, and simultaneously retrieving the boundary vertex coordinate information of the first convex polygon constructed in step 301; adjusting the size of the second convex polygon according to the magnitude of the curvature features. The specific adjustment logic is that the larger the curvature features, the greater the curvature of the current trajectory, requiring more accurate trajectory fit judgment. At this time, each boundary vertex of the first convex polygon is shifted away from the desired trajectory by a preset first offset amount; The smaller the rate feature, the smoother the trajectory, and the more appropriate the fitting judgment range can be expanded. At this time, each boundary vertex of the first convex polygon is translated away from the desired trajectory by a preset second offset, where the second offset is greater than the first offset. After the translation is completed, the convex polygon is judged in step 301, the translated vertices are connected and the interior angles are judged to finally form the second convex polygon. The second step is to calculate the area of ​​the intersection region of the two convex polygons. The specific calculation process is to first extract all the boundary edges of the two convex polygons, and then judge whether each edge of the first convex polygon intersects with each edge of the second convex polygon. The judgment method is to calculate whether the extension lines of the two edges intersect and whether the intersection point falls within the line segment range of the two edges. If it exists, the coordinates of the intersection point are recorded.

[0049] Collect the coordinates of all intersection points and the coordinates of vertices that simultaneously belong to the interiors of two convex polygons. Sort these coordinates clockwise to form the polygonal outline of the intersection region. Divide the polygonal outline of the intersection region into multiple triangles. The division method is to use any vertex on the outline as a common vertex and connect the other non-adjacent vertices in sequence to form multiple non-overlapping triangles. The area of ​​each triangle is calculated by taking the coordinates of the three vertices of the triangle, multiplying the X-axis coordinate of the first vertex by the Y-axis coordinate of the second vertex, and adding the X-axis coordinate of the second vertex multiplied by the Y-axis coordinate of the third vertex. First, multiply the X-coordinate of the third vertex by the Y-coordinate of the first vertex to obtain the first sum. Then, multiply the Y-coordinate of the first vertex by the X-coordinate of the second vertex, add the Y-coordinate of the second vertex by the X-coordinate of the third vertex, and add the Y-coordinate of the third vertex by the X-coordinate of the first vertex to obtain the second sum. Subtract the second sum from the first sum, take the absolute value of the result, and divide it by two to obtain the area of ​​a single triangle. Finally, add the areas of all triangles to obtain the total area of ​​the intersection region of the two convex polygons, and use this total area as the shape fit feature.

[0050] Step 303: Generate a set of contour key points based on the spatial coordinates of three reference points. Adjust the scale and position of the contour key points using shape fit features to construct a two-dimensional contour. Specifically, this includes: first, generating contour key points based on the spatial coordinates of the three reference points determined in Step 2. Specifically, the generation method involves uniformly selecting three sampling points at a preset interval between the first and second reference points, uniformly selecting three sampling points at the same interval between the second and third reference points, and uniformly selecting three sampling points at the same interval between the third and first reference points. Adding these to the three reference points themselves, a total of twelve contour key points are obtained. The scale and position of these key points are adjusted using the shape fit features obtained in Step 302. If the shape fit feature is large, it indicates that the two... If the convex polygon has a high degree of fit and the current reference point layout matches the trajectory curvature well, then each contour key point is slightly adjusted towards the center of the first convex polygon by a preset small distance. If the shape fit is small, it indicates a low degree of fit and a poor match between the reference point layout and the trajectory curvature. In this case, each contour key point is slightly adjusted away from the center of the first convex polygon by a preset large distance, where the large distance is twice the small distance. After the adjustment, the twelve contour key points are connected sequentially in the following order: from the first reference point to the sampling point between the first and second reference points, then to the second reference point, then to the sampling point between the second and third reference points, then to the third reference point, and finally to the sampling point between the third and first reference points, and back to the first reference point, to form a closed two-dimensional contour.

[0051] This embodiment constructs a first convex polygon by combining the current position of the drone with three reference points, which can accurately select the pre-aiming area of ​​the current inspection trajectory and the associated space of the drone's location, adapting to the need for accurate coverage of the distribution area of ​​buildings around the trajectory in urban canyon power line inspection.

[0052] In a preferred embodiment of the present invention, step 4, calculating the geometric moments of the two-dimensional contour, obtaining the central moment of the contour based on the geometric moments, normalizing the central moment and extracting Hu invariant moment features, and combining the shape fit features and Hu invariant moment features to form a digital environment feature vector, may include:

[0053] Step 401: Calculate the area of ​​the region enclosed by the two-dimensional contour and the centroid coordinates of the contour. Based on the centroid coordinates and the coordinate distribution of each point on the contour, calculate the first and second moments of the contour about the coordinate axes to obtain the geometric moments of the two-dimensional contour. Specifically, this includes: First, calculating the area of ​​the region enclosed by the two-dimensional contour, using the same method as the summation of the triangle area calculation in Step 302. Divide the two-dimensional contour into multiple triangles, calculate the area of ​​each triangle, and then sum them to obtain the total area. Second, calculating the centroid coordinates of the contour. Specifically, calculate the sum of the X-axis coordinates of all vertices on the contour and divide it by the total number of vertices to obtain the average X-axis coordinate. Then calculate the sum of the Y-axis coordinates of all vertices and divide it by the total number of vertices to obtain the average Y-axis coordinate. Use the average X-axis coordinates and the average Y-axis coordinates as the centroid coordinates of the contour. Third, calculating the first moment of the contour about the coordinate axes. When calculating the first moment in the X-axis direction, multiply the X-axis coordinate of each vertex on the contour by... The first step is to calculate the first moment of the contour about the coordinate axes. To calculate the first moment of the contour about the X-axis, multiply the Y-coordinate of each vertex by the length of the contour segment corresponding to that vertex, and then sum all the products. To calculate the second moment of the contour about the coordinate axes, multiply the square of the X-coordinate of each vertex by the length of the contour segment corresponding to that vertex, and then sum all the products. Similarly, to calculate the second moment of the contour about the Y-axis, multiply the square of the Y-coordinate of each vertex by the length of the contour segment corresponding to that vertex, and then sum all the products. Simultaneously, calculate the mixed second moment by multiplying the X-coordinate of each vertex by its Y-coordinate, then by the length of the contour segment corresponding to that vertex, and sum all the products. The first and second moments of the area centroid coordinates obtained above are used together as the geometric moments of the two-dimensional contour.

[0054] Step 402: Calculate the central moments with the centroid of the contour as the origin based on the geometric moments and the centroid coordinates. Normalize the central moments to obtain the normalized central moments. Specifically, this includes: First, calculating the central moments with the centroid of the contour as the origin. When calculating the first-order central moments, subtract the centroid's X-axis coordinate multiplied by the area of ​​the contour from the first-order X-axis moment obtained in step 401; the result is the first-order X-axis central moment. Subtract the centroid's Y-axis coordinate multiplied by the area of ​​the contour from the first-order Y-axis moment obtained in step 401; the result is the first-order Y-axis central moment. When calculating the second-order central moments, subtract the centroid's X-axis coordinate multiplied by its square and then multiplied by the area of ​​the contour from the second-order X-axis moment obtained in step 401; the result is the second-order central moment. The second central moment along the X-axis is obtained by subtracting the square of the centroid's Y-axis coordinate from the second central moment obtained in step 401, and then multiplying the result by the area enclosed by the contour. The second central moment along the Y-axis is obtained by subtracting the square of the centroid's Y-axis coordinate from the mixed second central moment obtained in step 401, and then multiplying the result by the area enclosed by the contour. The mixed second central moment is obtained by subtracting the square of the centroid's X-axis coordinate from the centroid's Y-axis coordinate, and then multiplying the result by the area enclosed by the contour. The second step is to normalize the central moments by first calculating the area enclosed by the contour to the power of 1.5, and then dividing the first central moment by this power to obtain the normalized first central moment. Then, the square of the area enclosed by the contour is calculated, and the second central moment is divided by this square to obtain the normalized second central moment. Finally, a set of normalized central moments is obtained.

[0055] Step 403: Seven Hu invariant moment eigenvalues ​​are calculated based on the normalized central moments. These seven Hu invariant moment eigenvalues ​​are then combined with the shape fit feature to form a digital environment feature vector. Specifically, the first Hu invariant moment is calculated by adding the normalized second central moment of the X-axis to the normalized second central moment of the Y-axis. The second Hu invariant moment is calculated by first subtracting the normalized second central moment of the Y-axis from the normalized second central moment of the X-axis, multiplying this difference by itself to obtain the square value, and then... To calculate the square of four times the normalized mixed second central moment, multiply the normalized mixed second central moment by itself, then multiply the square by four, and finally add the two squares together. The third Hu invariant moment is calculated by first calculating the difference between the normalized second central moment on the X-axis and three times the normalized mixed second central moment, multiplying this difference by itself to get the first square, then calculating the difference between three times the normalized mixed second central moment on the Y-axis and multiplying this difference by itself. The second squared value is obtained, and the two squared values ​​are added together. The fourth Hu invariant moment is calculated by first calculating the difference between the normalized second central moment on the X-axis and three times the normalized mixed second central moment, multiplying this difference by itself to obtain the first squared value, then calculating the difference between three times the normalized mixed second central moment and the normalized second central moment on the Y-axis, multiplying this difference by itself to obtain the second squared value, and finally adding the two squared values ​​together. The fifth Hu invariant moment is calculated by first calculating the normalized second central moment on the X-axis... The difference between the normalized second-order central moment and three times the normalized mixed second-order central moment is calculated. Then, the difference between the normalized second-order central moment on the X-axis and three times the normalized mixed second-order central moment is calculated. Next, the difference between the square of the normalized second-order central moment on the X-axis and the product of three times the normalized second-order central moment on the X-axis and the normalized second-order central moment on the Y-axis, plus the square of the normalized second-order central moment on the Y-axis, is calculated. These three differences are then multiplied sequentially, and finally, the resulting product is multiplied by four times the normalized mixed second-order central moment.

[0056] The sixth Hu invariant moment is calculated as follows: First, calculate the difference between the normalized second central moment on the X-axis and the normalized second central moment on the Y-axis. Then, calculate the square of the normalized second central moment on the X-axis, minus the product of three times the normalized second central moment on the X-axis and the normalized second central moment on the Y-axis, and add the square of the normalized second central moment on the Y-axis. Multiply these two differences to obtain the first product. Simultaneously, calculate the product of four times the normalized mixed second central moment on the X-axis and the square of the normalized second central moment on the X-axis, minus the product of the normalized second central moment on the X-axis and the normalized second central moment on the Y-axis, and add the square of the normalized second central moment on the Y-axis. The product of the differences in the values ​​is then summed. The seventh Hu invariant moment is calculated by first calculating the difference between three times the normalized mixed second central moment and the normalized second central moment of the Y-axis, then calculating the normalized second central moment of the X-axis plus the difference between three times the normalized mixed second central moment, then calculating the square of the normalized second central moment of the X-axis minus the product of three times the normalized second central moment of the X-axis and the normalized second central moment of the Y-axis plus the square of the normalized second central moment of the Y-axis, then multiplying these three differences sequentially, and finally multiplying the resulting product by negative four times the normalized mixed second central moment. After calculating the seven Hu invariant moment eigenvalues, these seven eigenvalues ​​are arranged in the order of calculation, and the shape fit feature obtained in step 302 is added to the end of this arrangement to form an eight-dimensional digital environment feature vector.

[0057] In this embodiment, the central moment calculation realizes the feature normalization preprocessing with the centroid of the contour as the origin. The subsequent normalization operation further eliminates the feature differences caused by contour scale changes, ensuring that the extracted moment features have scale stability and improving the consistency of environmental features under different inspection distances.

[0058] In a preferred embodiment of the present invention, step 5, which involves processing the digital environment feature vector, pose state information, and preset desired trajectory, and fusing them through a neural network model to obtain control parameter adjustment instructions, may include:

[0059] Step 501 involves concatenating the digital environment feature vector, the UAV's pose state information, and the curvature features of the desired trajectory to obtain a combined input vector. Specifically, this includes: first, retrieving the eight-dimensional digital environment feature vector obtained in step 403. The eight elements of this vector are, in order, the first Hu invariant moment feature value, the second Hu invariant moment feature value, the third Hu invariant moment feature value, the fourth Hu invariant moment feature value, the fifth Hu invariant moment feature value, the sixth Hu invariant moment feature value, the seventh Hu invariant moment feature value, and the shape fit feature. These eight feature elements are arranged in this fixed order. Next, the UAV pose state information obtained in step 1 is retrieved, and three-dimensional position information and heading angle information are extracted from it. The three-dimensional position information specifically includes the UAV's current X-axis coordinates, Y-axis coordinates, and heading angles in the geodetic coordinate system. The Z-axis coordinate and heading angle information are the angle between the UAV's fuselage axis and the due north direction of the geodetic coordinate system. These four parameters are arranged in the order of X-axis coordinate, Y-axis coordinate, Z-axis coordinate, and heading angle. The curvature feature of the current segment of the desired trajectory extracted in step 1 is retrieved as a single feature element. The splicing order of the vector concatenation operation is as follows: digital environment feature vector element first, followed by the arranged three-dimensional position coordinates and heading angle, and finally the curvature feature element. That is, the first Hu invariant moment, the second Hu invariant moment, the third Hu invariant moment, the fourth Hu invariant moment, the fifth Hu invariant moment, the sixth Hu invariant moment, the seventh Hu invariant moment, shape fit, X-axis coordinate, Y-axis coordinate, Z-axis coordinate, heading angle, and curvature feature are arranged in the order of forming a thirteen-dimensional combined input vector.

[0060] Step 502a involves performing multi-level nonlinear transformations on the combined input vector through the feature extraction layer of the neural network model to obtain multi-dimensional feature information; calculating the actual trajectory information and preliminary state sequence based on the multi-dimensional feature information; comparing the actual trajectory information with the corresponding information of the expected trajectory to calculate the position deviation, heading angle deviation, and curvature following deviation, and fusing the position deviation, heading angle deviation, and curvature following deviation to obtain deviation features. Specifically, this includes: constructing a feature extraction layer for the neural network model, which adopts a three-layer fully connected structure; the number of input neurons in the first fully connected layer is set to the dimension of the combined input vector, i.e., thirteen, and the number of output neurons is set to sixty-four, with the ReLU function selected as the activation function; the second... The first fully connected layer has the same number of input neurons as the first layer (64), and the number of output neurons is set to 32. The activation function is also ReLU. The third fully connected layer has 32 input neurons and 16 output neurons, and the activation function is still ReLU. During the construction of the feature extraction layer, the initial values ​​of the weight parameters of each layer are initialized using the Xavier initialization method. Specifically, the sum of the number of input neurons and the number of output neurons in the current layer is calculated, and then the square root of six is ​​divided by the sum. The value range of the weight parameters is positive or negative. The initial weight parameters of each layer are randomly generated within this range. The initial value of the bias term of each layer is set to zero.

[0061] The combined input vector obtained in step 501 is input into the constructed feature extraction layer for a three-level nonlinear transformation. The first-level transformation is implemented through the first fully connected layer. Specifically, thirteen elements of the combined input vector are taken, and each element is multiplied by the corresponding weight parameter of the first fully connected layer to obtain thirteen product results. These thirteen product results are added together, and the bias term of the first fully connected layer is added to obtain the first-level intermediate result. The first-level intermediate result is input into the ReLU activation function. If the first-level intermediate result is greater than zero, the result is retained as the first-level feature output; if the first-level intermediate result is less than or equal to zero, zero is output as the first-level feature output. The second-level transformation is implemented through the second fully connected layer. It takes the 64 elements of the first-level feature output, multiplies each element by the corresponding weight parameter of the second fully connected layer, resulting in 64 product results. These 64 product results are summed, and the bias term of the second fully connected layer is added to obtain the second-level intermediate result. The second-level intermediate result is then input into the ReLU activation function and processed according to the same rules as the first level to obtain the second-level feature output. The third-level transformation is implemented through the third fully connected layer. It takes the 32 elements of the second-level feature output, multiplies each element by the corresponding weight parameter of the third fully connected layer, resulting in 32 product results. These 32 product results are summed, and the bias term of the third fully connected layer is added to obtain the third-level intermediate result. The third-level intermediate result is then input into the ReLU activation function and processed according to the same rules to obtain the final 16-dimensional multidimensional feature information.

[0062] Actual trajectory information and preliminary state sequence are calculated based on multidimensional feature information. The actual trajectory information is calculated by pre-constructing a feature-to-trajectory mapping table. This table contains the actual trajectory position sequence and heading sequence corresponding to different multidimensional feature information intervals in the urban canyon power line inspection scenario, with each interval clearly marked with a feature value range. The obtained sixteen-dimensional multidimensional feature information is matched one by one with the feature intervals in the mapping table. After determining the corresponding feature interval, the actual trajectory position sequence and heading sequence associated with that interval are retrieved as the current actual trajectory information. The position sequence contains the X, Y, and Z axis coordinates for ten consecutive time points, and the heading sequence contains... The initial state sequence is calculated by extracting the first six elements from the sixteen-dimensional multi-dimensional feature information, corresponding to the X-axis, Y-axis, Z-axis coordinates, and heading angle at three different times. These six elements are arranged in chronological order to form an initial state sequence containing the UAV's position and heading at three different times. Position deviation, heading angle deviation, and curvature following deviation are then calculated. The position deviation is calculated by taking the position sequence data from the actual trajectory information at ten different times, extracting the X-axis, Y-axis, and Z-axis coordinates at each time point, and subtracting the X-axis coordinate of the desired trajectory at each time point from the actual X-axis coordinate. The X-axis position deviation at that moment is obtained; the Y-axis position deviation is obtained by subtracting the Y-axis coordinate of the desired trajectory at that moment from the actual Y-axis coordinate; the Z-axis position deviation is obtained by subtracting the Z-axis coordinate of the desired trajectory at that moment from the actual Z-axis coordinate; the X-axis, Y-axis, and Z-axis position deviations at each moment are arranged in chronological order to form a position deviation sequence containing ten three-dimensional position deviations; the heading angle deviation is calculated by taking the heading angles of the ten moments from the heading sequence in the actual trajectory information, subtracting the preset heading angle of the desired trajectory at each moment from the actual heading angle, and obtaining the heading angle deviations at ten moments, which are then arranged in chronological order to form the heading angle deviations. The curvature following deviation is calculated as follows: based on the coordinates of ten time points in the position sequence of the actual trajectory information, the curvature of the actual trajectory at each time point is calculated. Specifically, the position coordinates of three consecutive time points are taken, and the directional angles of the line connecting the first two time points and the line connecting the last two time points are calculated. The angle change is obtained by subtracting the angle of the first direction from the angle of the second direction. The straight-line distance between the first two time points is calculated, and the actual curvature at the middle time point is obtained by dividing the angle change by the straight-line distance. The curvature following deviation at each time point is obtained by subtracting the curvature feature of the corresponding time point of the desired trajectory from the actual curvature at each time point. These ten time points are then arranged in chronological order to form a curvature following deviation sequence.

[0063] Finally, the various deviations are fused to obtain the deviation characteristics. The fusion method involves pre-determining the value range and specific value of each deviation weight coefficient based on the importance of position accuracy, heading stability, and curvature following in the urban canyon power line inspection scenario. Among these, position accuracy directly determines whether the inspection operation can accurately cover the power equipment, and has the highest priority. Therefore, the position deviation weight coefficient is set to a range of 0.4 to 0.6. After multiple inspection scenario tests, the final value is determined to be 0.5. Heading stability affects the stability of the drone's flight attitude and avoids collisions with surrounding buildings, and has the second highest priority. The heading angle deviation weight coefficient is set to a range of 0.2 to 0.4, and the final value is determined to be 0.3. Curvature following ensures a smooth trajectory transition and adapts to continuously varying curvature road sections. It has a relatively low priority, and the curvature following deviation weight coefficient is set to a range of 0.1 to 0.3, and the final value is determined to be 0.2. The determination of the weight range is based on the urban canyon power line inspection scenario. The safety operation requirements, equipment coverage accuracy standards, and trajectory tracking stability indicators for force inspection were optimized through multiple sets of scenario simulation tests. The subsequent fusion calculation process involves multiplying the deviations of the three dimensions in the position deviation sequence at each moment by a position deviation weighting coefficient of 0.5 to obtain a weighted position deviation sequence; multiplying the deviation in the heading angle deviation sequence at each moment by a heading angle deviation weighting coefficient of 0.3 to obtain a weighted heading angle deviation sequence; and multiplying the deviation in the curvature following deviation sequence at each moment by a curvature following deviation weighting coefficient of 0.2 to obtain a weighted curvature following deviation sequence. The corresponding moment elements of the three weighted deviation sequences are taken, and the weighted position deviations (X-axis, Y-axis, and Z-axis are added separately), weighted heading angle deviations, and weighted curvature following deviations at the same moment are added to obtain the fusion deviation value at each moment. The fusion deviation values ​​at ten moments are arranged in chronological order to form a deviation feature sequence, which is the deviation feature.

[0064] Step 502b: Based on the initial state sequence, state recursion is performed through the temporal layer of the neural network model to obtain the predicted position and predicted heading at multiple discrete time steps in the future, and to construct future state prediction features. Specifically, this includes: constructing the temporal layer of the neural network model, which adopts a Long Short-Term Memory (LSTM) network structure, with the number of input neurons set to the dimension of the initial state sequence (six), the number of hidden layer neurons set to twenty-four, the number of output neurons set to twelve, and the number of layers set to two. During the construction of the temporal layer, the initial values ​​of the weight parameters of the forget gate, input gate, and output gate are initialized using an orthogonal initialization method. Specifically, a random matrix with a dimension equal to the sum of the number of input neurons and the number of hidden layer neurons is randomly generated. Singular value decomposition is performed on this random matrix to obtain an orthogonal matrix. Submatrices of the corresponding dimensions are extracted from the orthogonal matrix as the initial weight parameters of the forget gate, input gate, and output gate. The initial values ​​of the bias terms of each gate are all set to zero.

[0065] The preliminary state sequence obtained in step 502a is input into the constructed temporal layer for state recursion. During the recursion, the first LSTM unit processes the state at the first time step of the preliminary state sequence: the forget gate processing is as follows: take the six elements of the current state, multiply each element by the input weight parameter of the forget gate to obtain six product results; take the twenty-four elements of the hidden state at the previous time step, multiply each element by the recursive weight parameter of the forget gate to obtain twenty-four product results; add these six and twenty-four product results together, and add the bias term of the forget gate to obtain the intermediate forget gate result; the intermediate forget gate result... The result is input to the sigmoid activation function, calculated by dividing 1 by 1 plus e raised to the power of the negative forget gate intermediate result, yielding the forget gate output value. This value determines the proportion of hidden state information retained from the previous time step. The input gate processing involves taking six elements of the current state, multiplying each element by the input gate's input weight parameters to obtain six products, and taking twenty-four elements of the previous hidden state, multiplying each element by the input gate's recursive weight parameters to obtain twenty-four products. These six and twenty-four products are then added together, along with the input gate's bias term, to obtain the input gate intermediate result. The input gate intermediate... The result is input into the sigmoid activation function, yielding the input gate output value, which is used to determine the update ratio of the current state information. Simultaneously, the current state element and the previous hidden state element are multiplied by the corresponding weight parameters of the candidate hidden state and summed, plus a candidate bias term. This is then processed by the tanh activation function to obtain the candidate hidden state for the current time step. The hidden state update process involves multiplying each element of the previous hidden state by the forget gate output value to obtain the retained historical state information, multiplying each element of the candidate hidden state by the input gate output value to obtain the updated current state information, and then using the retained historical state information... The hidden state output of the first LSTM unit is obtained by adding the corresponding element of the updated current state information. The output gate process is to take the updated hidden state element, multiply it by the corresponding weight parameter of the output gate and add them together, add the output gate bias term, process it through the sigmoid activation function to obtain the output gate output value, and multiply the output gate output value by the result of the updated hidden state after tanh activation to obtain the output of the first LSTM unit. The second LSTM unit uses the output of the first layer as input and repeats the above forget gate, input gate, hidden state update and output gate processes to obtain the final temporal layer output.

[0066] Based on the output of the time series layer, the predicted positions and headings for multiple discrete time steps are obtained. The number of discrete time steps is preset to six, with an interval of 0.1 seconds between each time step. This interval is determined according to the real-time requirements of urban canyon power line inspection to ensure that the prediction results can support subsequent control decisions in a timely manner. The thirty-six elements output from the time series layer are divided into six groups of three, with the first eighteen corresponding to the three-dimensional positions of the six time steps. Each group consists of three elements, corresponding to the X-axis, Y-axis, and Z-axis predicted positions for one discrete time step. The last twelve elements are extracted and divided into six groups of two. The two elements in each group are analyzed to obtain the predicted heading angle for the corresponding time step. The analysis method involves dividing the first element by the second element to obtain the tangent value of the heading angle, and then determining the heading angle size based on the tangent value. The predicted X-axis, Y-axis, Z-axis positions, and predicted heading angles for the six discrete time steps are arranged sequentially in chronological order to construct a future state prediction feature containing complete state information for the six time steps.

[0067] Step 503 involves fusing the deviation features with the future state prediction features and obtaining control parameter adjustment instructions through the output layer mapping of the neural network model. Specifically, this includes: first, constructing the output layer of the neural network model, which is a fully connected structure. The number of input neurons is set to the sum of the dimensions of the deviation features and the future state prediction features. The deviation features are the fused deviation values ​​at ten time steps (ten dimensions), and the future state prediction features are the state information at six time steps (twenty-four dimensions), thus the number of input neurons is set to thirty-four. The number of output neurons is set to three, corresponding to the proportional gain adjustment, integral gain adjustment, and differential gain adjustment, respectively. A linear activation function is used, meaning the output equals the product of the input and weights plus a bias term. During the construction of the output layer, the initial values ​​of the weight parameters are initialized using the Xavier initialization method, specifically calculated as the square root of six divided by the sum of the number of input and output neurons, with weight parameters randomly generated within the range of positive and negative values. The initial value of the term is set to zero. Feature fusion is performed by concatenating the ten-dimensional deviation features obtained in step 502a and the twenty-four-dimensional future state prediction features obtained in step 502b in the order of deviation features first and future state prediction features second. Specifically, the ten fused deviation values ​​of the deviation features are arranged sequentially, followed by the six time-step X-axis prediction position, Y-axis prediction position, Z-axis prediction position, and predicted heading angle of the future state prediction features, forming a thirty-four-dimensional fused feature vector. The fused feature vector is input to the constructed output layer for mapping processing. Specifically, the thirty-four elements of the fused feature vector are taken, and each element is multiplied by the weight parameter of the corresponding position in the output layer to obtain thirty-four product results. These thirty-four product results are added together, and the bias term of the output layer is added. After processing by a linear activation function, three output values ​​are obtained. These three output values ​​are the control parameter adjustment commands, corresponding to the proportional gain adjustment, integral gain adjustment, and derivative gain adjustment of the UAV flight controller, respectively.

[0068] The training process of the aforementioned neural network model is as follows: First, sample data from urban canyon power line inspection scenarios is collected. This data includes digital environmental feature vectors, UAV pose information, curvature features of the desired trajectory, and corresponding optimal control parameter adjustment commands under different curvature trajectories (including straight sections with small curvature, turning sections with medium curvature, and sharp bends with large curvature) and different environmental interferences (including local wind shear and positioning interference caused by building obstruction). The optimal control parameter adjustment commands are determined through expert debugging to ensure the UAV can accurately track the trajectory in the corresponding scenario. The collected sample data is divided into a training set and a test set in a 7:3 ratio. The training set is used for model parameter training, and the test set is used for model performance verification. During training, mean squared error is used as the loss function. Specifically, the three control parameter adjustments output by the model are subtracted from the optimal control parameter adjustments in the samples to obtain three error values. Each error value is multiplied by itself to obtain the squared error value. The three squared error values ​​are summed to obtain the sum of squared errors. The sum of squared errors is divided by the number of samples to obtain the loss value. Ada is used... The m-optimizer optimizes the weights and biases of each layer of the model. The initial learning rate is set to 0.001, and it decreases to 0.9 times its original value after every 100 batches. The batch size is set to 32 samples. The training iterations are set to 500. Each iteration involves taking one batch of samples from the training set and inputting it into the model, calculating the loss between the model output and the optimal sample value. The gradient of the loss with respect to the weights and biases of each layer is calculated using the backpropagation algorithm, specifically starting from the output layer and sequentially calculating the loss with respect to the output layer weights. The partial derivatives of the bias terms are calculated, and then the partial derivatives with respect to the weights and bias terms of the temporal layer and feature extraction layer are calculated to obtain the gradient of each parameter. The parameters are updated according to the gradient direction by subtracting the learning rate multiplied by the corresponding gradient from the current parameter value to obtain the updated parameter value. During training, the loss value of the test set is monitored in real time, and the loss value of the test set is calculated after each iteration. When the loss value of the test set no longer decreases after 20 consecutive iterations, training is stopped, and the weight parameters and bias terms of each layer of the model at this time are saved as the final model parameters, thus completing the training of the neural network model.

[0069] This embodiment achieves deep nonlinear fusion of multi-source information through a multi-layer fully connected feature extraction layer, accurately extracting hidden feature association information; through multi-dimensional deviation calculation and fusion, it quantifies the difference between the current state of the UAV and the expected trajectory, providing accurate deviation basis for control parameter adjustment and improving the perception accuracy of deviations in complex trajectory tracking.

[0070] In a preferred embodiment of the present invention, step 6, which involves adjusting the parameters of the UAV flight controller in real time according to the control parameter adjustment command, generating control signals to drive the UAV actuators, and achieving dynamic tracking of the desired trajectory, may include:

[0071] Step 601 involves mapping the control parameter adjustment commands to the adjustment amounts of the proportional gain, integral gain, and derivative gain within the UAV flight controller. Specifically, this includes: pre-determining a set of mapping rules between the control parameter adjustment commands and the adjustment amounts of the proportional gain, integral gain, and derivative gain of the flight controller. This set of rules is based on the flight characteristics of the UAV in urban canyon power line inspection scenarios (such as UAV payload and flight speed range) and controller parameter debugging experience. It clarifies the magnitude of each gain adjustment amount corresponding to different ranges of control parameter adjustment command values. For example, when the proportional gain adjustment command value is between 0 and 0.2, the corresponding proportional gain adjustment amount is 0.05; when the value is between 0.2 and 0.4, the corresponding adjustment amount is 0.1, and so on, dividing the data into multiple intervals and clarifying the correspondence between each interval; retrieving the control parameters obtained in step 503... The control parameter adjustment command extracts three output values, corresponding to proportional, integral, and derivative gain adjustment commands respectively. Each output value is matched with a corresponding interval in the mapping rule set. During the matching process, if the value of the control parameter adjustment command falls in the middle of two adjacent intervals in the rule set, the adjustment amount is calculated using linear interpolation. Specifically, the two adjacent intervals containing the value are determined, and the corresponding adjustment amounts for the two intervals are obtained, namely the upper interval adjustment amount and the lower interval adjustment amount. The difference between the two interval adjustment amounts is the adjustment amount difference. The difference between the command value and the lower limit of the lower interval is the numerical difference. The difference between the upper and lower limits of the lower interval is the interval range. The adjustment amount difference is multiplied by the numerical difference and then divided by the interval range to obtain the interpolated adjustment amount. The lower interval adjustment amount is added to the interpolated adjustment amount to obtain the final gain adjustment amount.

[0072] Step 602: Update the original parameter set of the flight controller using the adjustment amount to obtain the updated flight controller; input the current pose state information of the UAV and the desired trajectory into the updated flight controller to calculate and generate preliminary control quantities, specifically including: retrieving the original proportional gain, integral gain, and derivative gain parameters of the UAV flight controller, which are the factory default parameters of the UAV or the adjusted parameters of the last inspection mission; adding the proportional gain adjustment amount obtained in step 601 to the original proportional gain to obtain the updated proportional gain; adding the integral gain adjustment amount to the original integral gain to obtain the updated integral gain; adding the derivative gain adjustment amount to the original derivative gain to obtain the updated derivative gain; replacing the original parameter set with the updated proportional gain, integral gain, and derivative gain to obtain the updated flight controller, ensuring that the controller parameters can adapt to the trajectory characteristics and environmental conditions of the current inspection scenario.

[0073] Retrieve the current UAV pose information (including current X, Y, and Z axis coordinates and current heading angle) and the preset desired trajectory (including the desired X, Y, and Z axis coordinates and desired heading angle at the corresponding moment) obtained in step 1, and input these two types of information into the updated flight controller. The controller's internal calculation process is as follows: First, calculate the deviation between the current pose information and the corresponding information of the desired trajectory, namely the position deviation and heading angle deviation. The calculation method is the same as in step 502a. The position deviation is the current X-axis coordinate minus the desired X-axis coordinate, the current Y-axis coordinate minus the desired Y-axis coordinate, and the current Z-axis coordinate minus the desired Z-axis coordinate. The heading angle deviation is the current heading angle minus the desired heading angle. Based on these deviations, calculate the preliminary control quantity, specifically by calculating the proportional term output, multiplying the updated proportional gain by the three dimensions of the position deviation and the heading angle, respectively. The deviation is calculated by obtaining the proportional control component and the heading control component, which are then added together to obtain the proportional output. The integral output is calculated by first calculating the integral value of the deviation, specifically by adding the current deviation to the deviation at the previous moment, and then multiplying by the time interval (0.05 seconds, matching the controller's sampling frequency). The integral value is then multiplied by the updated integral gain to obtain the integral output. The derivative output is calculated by first calculating the rate of change of the deviation, specifically by subtracting the previous deviation from the current deviation and then dividing by the time interval. The rate of change is then multiplied by the updated derivative gain to obtain the derivative output. Finally, the corresponding components of the proportional, integral, and derivative outputs are added together to obtain the preliminary control quantity, which contains instructions for driving the UAV's position and heading adjustments.

[0074] Step 603: Apply amplitude and rate of change limits to the initial control quantity to generate a safety control signal; send the safety control signal to the UAV's motors and control surface actuators to achieve dynamic tracking of the desired trajectory. Specifically, this includes: presetting the amplitude and rate of change limit ranges for the initial control quantity; the amplitude limit range is determined based on the maximum actuation capabilities of the UAV's motors and control surface actuators, for example, setting the maximum amplitude of the control quantity corresponding to the motor output power to 0.8 and the minimum amplitude to -0.8, and the maximum amplitude of the control quantity corresponding to the control surface deflection angle to 0.6 and the minimum amplitude to -0.6; the rate of change limit range is based on the UAV's capabilities in urban canyon power line inspection scenarios. The stability requirements for flight are determined, with the maximum rate of change set to 0.1 and the minimum rate of change set to -0.1 to avoid sudden changes in control input that could cause drastic fluctuations in the UAV's attitude. Amplitude limits are applied to the initial control input obtained in step 602. Each component of the initial control input is compared with the preset maximum and minimum amplitudes. If a component of the initial control input is greater than the corresponding maximum amplitude, that maximum amplitude is used as the control input after the component is limited. If a component is less than the corresponding minimum amplitude, that minimum amplitude is used as the control input after the component is limited. If a component is within the range of the maximum and minimum amplitudes, that component remains unchanged, resulting in the amplitude-limited control input.

[0075] The rate-of-change limitation is achieved by taking each component of the control quantity after amplitude limitation, calculating the difference between that component and the corresponding component of the control signal output at the previous moment, and obtaining the change amount of each component. Each change amount is then compared with the preset maximum and minimum rate of change. If the change amount of a component is greater than the maximum rate of change, the component of the control signal at the previous moment is added to the maximum rate of change to obtain the final control quantity of that component. If the change amount of a component is less than the minimum rate of change, the component of the control signal at the previous moment is added to the minimum rate of change to obtain the final control quantity of that component. If the change amount of a component is within the range of the maximum and minimum rate of change, the control quantity of that component remains unchanged after amplitude limitation. The control quantity components after amplitude and rate-of-change limitation constitute the final safety control signal, ensuring that the control signal is within the action capability range of the actuator and changes smoothly.

[0076] The UAV's wireless signal transmission unit sends safety control signals to the UAV's motors and control surface actuators. Upon receiving the safety control signals, the motor actuators adjust their output power based on the signal amplitude. Specifically, a larger control signal amplitude results in greater motor output power, thus increasing the UAV's flight speed and lift; a smaller control signal amplitude results in lower motor output power, reducing flight speed and lift. Similarly, upon receiving the safety control signals, the control surface actuators adjust their deflection angles based on the signal amplitude and direction. Positive amplitude signals control the control surfaces to deflect in one direction, while negative amplitude signals control them to deflect in the other. The deflection angle increases with the signal amplitude, thereby altering the UAV's pitch, roll, and yaw attitude. Through the coordinated actions of the motors and control surface actuators, the UAV's flight state is adjusted in real time, correcting deviations between the flight trajectory and the desired trajectory, enabling the UAV to dynamically track the desired path.

[0077] In this embodiment, the core gain parameters of the flight controller are updated in real time, allowing the controller to adapt to the current trajectory characteristics and flight status; preliminary control quantities are generated through the collaborative calculation of proportional, integral, and derivative functions, ensuring that the control quantities can effectively correct tracking deviations and improve the accuracy of trajectory tracking.

[0078] like Figure 2 As shown, embodiments of the present invention also provide a dynamic optimization system for UAV flight trajectories based on neural networks, including:

[0079] The acquisition module is used to acquire the UAV's pose status information and the preset expected trajectory. The pose status information includes position and heading, and the expected trajectory includes curvature features.

[0080] The positioning module is used to set three reference points in space based on the pose status information and the preset desired trajectory. The first reference point is located on the desired trajectory at a pre-aiming distance in front of the UAV, the second reference point is located in the direction of the trajectory extension in front of the first reference point, and the third reference point is located at the lateral offset position determined according to the direction of trajectory curvature.

[0081] The calculation module is used to construct a first convex polygon based on the spatial coordinates of three reference points, generate a second convex polygon based on curvature features, calculate the area of ​​the intersection of the first and second convex polygons as the shape fit feature, and construct a two-dimensional contour based on the spatial coordinates of three reference points.

[0082] The processing module is used to calculate the geometric moments of the two-dimensional contour, obtain the central moment of the contour based on the geometric moments, normalize the central moment and extract the Hu invariant moment features, and combine the shape fit features with the Hu invariant moment features to form a digital environment feature vector.

[0083] The fusion module is used to process the digital environment feature vectors, pose state information, and preset desired trajectories, and fuse them through a neural network model to obtain control parameter adjustment instructions.

[0084] The control module is used to adjust the parameters of the UAV flight controller in real time according to the control parameter adjustment instructions, generate control signals to drive the UAV actuators, and realize dynamic tracking of the desired trajectory.

[0085] It should be noted that this system is a system corresponding to the above method. All implementation methods in the above method embodiments are applicable to this embodiment and can achieve the same technical effect.

[0086] Embodiments of the present invention also provide a computing device, including: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.

[0087] Embodiments of the present invention also provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the method described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.

[0088] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A neural network-based dynamic optimization method for a UAV flight trajectory, characterized in that, The method includes: Step 1: Obtain the UAV pose status information and the preset desired trajectory. The pose status information includes position and heading, and the desired trajectory includes curvature features. Step 2: Based on the pose status information and the preset desired trajectory, set three reference points in the space; the first reference point is located on the desired trajectory at a pre-aiming distance in front of the UAV, the second reference point is located in the direction of trajectory extension in front of the first reference point, and the third reference point is located at the lateral offset position determined according to the direction of trajectory curvature. Step 3: Construct a first convex polygon based on the spatial coordinates of the three reference points, generate a second convex polygon based on the curvature features, calculate the area of ​​the intersection of the first and second convex polygons as the shape fit feature, and construct a two-dimensional contour based on the spatial coordinates of the three reference points. Step 4: Calculate the geometric moments of the two-dimensional contour, obtain the central moment of the contour based on the geometric moments, normalize the central moment and extract the Hu invariant moment features, and combine the shape fit features with the Hu invariant moment features to form a digital environment feature vector. Step 5: Process the digital environment feature vector with the pose state information and the curvature features of the desired trajectory, and fuse them through a neural network model to obtain the control parameter adjustment command; Step 6: According to the control parameter adjustment instructions, the parameters of the UAV flight controller are corrected in real time, and control signals are generated to drive the UAV actuators to achieve dynamic tracking of the desired trajectory.

2. The neural network-based dynamic optimization method for UAV flight trajectory according to claim 1, wherein, Based on the pose status information and the preset desired trajectory, three reference points are set in the space; The first reference point is located on the desired trajectory at a pre-aiming distance in front of the UAV; the second reference point is located in the direction of the trajectory extension in front of the first reference point; and the third reference point is located at a lateral offset position determined according to the trajectory curvature direction, including: The aiming distance is calculated based on the pose state information of the UAV and the curvature characteristics of the desired trajectory, and the spatial coordinates of the first reference point are determined on the desired trajectory based on the aiming distance. Based on the spatial coordinates of the first reference point, the trajectory extension direction and curvature direction of the desired trajectory at the first reference point are obtained. The trajectory extension direction is moved by a preset extension step, and the spatial coordinates of the second reference point are calculated. The lateral offset direction is calculated by combining the curvature direction with a preset lateral offset distance. The spatial coordinates of the third reference point are calculated based on the lateral offset direction and the spatial coordinates of the first reference point.

3. The neural network-based dynamic optimization method for UAV flight trajectory according to claim 2, wherein, A first convex polygon is constructed based on the spatial coordinates of three reference points. A second convex polygon is generated based on curvature features. The area of ​​the intersection of the first and second convex polygons is calculated as the shape fit feature. A two-dimensional contour is constructed based on the spatial coordinates of the three reference points, including: Based on the spatial coordinates of the three reference points and the position in the pose state information of the UAV, the first convex polygon is constructed by connecting the three reference points and the position of the UAV. A second convex polygon is generated based on the curvature characteristics of the desired trajectory and the boundary vertex information of the first convex polygon; the area of ​​the intersection region between the first convex polygon and the second convex polygon is calculated, and the area of ​​the intersection region is used as the shape fit feature. Based on the spatial coordinates of three reference points, three sampling points are evenly selected on the line connecting every two reference points in the horizontal plane, with the three reference points as vertices. The three reference points and the nine selected sampling points are used as contour key points. The position of each contour key point is adjusted using shape fit features. The adjusted contour key points are connected in sequence to construct a two-dimensional contour.

4. The method for dynamic optimization of UAV trajectory based on neural networks according to claim 3, characterized in that, The geometric moments of the two-dimensional contour are calculated, and the central moment of the contour is obtained based on the geometric moments. The central moment is normalized and Hu invariant moment features are extracted. The shape fit features and Hu invariant moment features are combined to form a digital environment feature vector, including: The area enclosed by the two-dimensional contour and the centroid coordinates of the contour are calculated. Based on the centroid coordinates and the coordinate distribution of each point on the contour, the first and second moments of the contour about the coordinate axes are calculated to obtain the geometric moments of the two-dimensional contour. The central moments with the centroid of the profile as the origin are calculated based on the geometric moments and the centroid coordinates; the central moments are then normalized to obtain the normalized central moments. Seven Hu invariant moment eigenvalues ​​are obtained based on the normalized central moments, and these seven Hu invariant moment eigenvalues ​​are combined with shape fit features to form a digital environment feature vector.

5. The neural network-based dynamic optimization method for UAV flight trajectory according to claim 4, wherein, The digital environment feature vector, pose state information, and curvature features of the desired trajectory are processed and fused through a neural network model to obtain control parameter adjustment instructions, including: The digital environment feature vector, the UAV pose state information, and the curvature features of the desired trajectory are concatenated to obtain a combined input vector; The combined input vector is fed into a pre-trained neural network model to calculate multi-dimensional feature information; based on the multi-dimensional feature information, the deviation features between the current state of the UAV and the expected trajectory, as well as the future state prediction features, are calculated. By fusing deviation features with future state prediction features and mapping them through the output layer of a neural network model, control parameter adjustment instructions are obtained.

6. The neural network-based dynamic optimization method for UAV flight trajectory according to claim 5, wherein, The combined input vectors are fed into a pre-trained neural network model to calculate multi-dimensional feature information; Based on multi-dimensional feature information, the deviation characteristics between the current state and the expected trajectory of the UAV and the prediction characteristics of its future state are calculated, including: The combined input vector is subjected to multi-level nonlinear transformation by the feature extraction layer of the neural network model to obtain multi-dimensional feature information; the actual trajectory information and preliminary state sequence are calculated based on the multi-dimensional feature information; the position deviation, heading angle deviation and curvature following deviation are calculated by comparing the corresponding information of the actual trajectory information and the expected trajectory, and the position deviation, heading angle deviation and curvature following deviation are fused to obtain the deviation features; Based on the initial state sequence, the state is recursively derived through the temporal layer of the neural network model to obtain the predicted position and predicted heading at multiple discrete time steps in the future, thus constructing the future state prediction features.

7. The method of claim 6, wherein, Based on control parameter adjustment commands, the parameters of the UAV flight controller are corrected in real time, generating control signals to drive the UAV actuators and achieving dynamic tracking of the desired trajectory, including: The control parameter adjustment commands are mapped to the adjustment amounts of the proportional gain, integral gain, and derivative gain within the UAV flight controller. The original parameter set of the flight controller is updated using the adjustment amount to obtain the updated flight controller; the current pose state information of the UAV and the desired trajectory are input into the updated flight controller to calculate and generate the preliminary control quantity; The amplitude and rate of change of the initial control quantity are limited to generate a safety control signal; the safety control signal is sent to the motor and control surface actuators of the UAV to achieve dynamic tracking of the desired trajectory.

8. A neural network-based dynamic optimization system for UAV flight trajectory, which implements the method of any one of claims 1 to 7, characterized in that, include: The acquisition module is used to acquire the UAV's pose status information and the preset expected trajectory. The pose status information includes position and heading, and the expected trajectory includes curvature features. The positioning module is used to set three reference points in space based on the pose state information and the preset desired trajectory. The first reference point is located on the desired trajectory at a pre-aiming distance in front of the UAV, the second reference point is located in the direction of the trajectory extension in front of the first reference point, and the third reference point is located at the lateral offset position determined according to the direction of trajectory curvature. The calculation module is used to construct a first convex polygon based on the spatial coordinates of three reference points, generate a second convex polygon based on curvature features, calculate the area of ​​the intersection of the first and second convex polygons as the shape fit feature, and construct a two-dimensional contour based on the spatial coordinates of three reference points. The processing module is used to calculate the geometric moments of the two-dimensional contour, obtain the central moment of the contour based on the geometric moments, normalize the central moment and extract the Hu invariant moment features, and combine the shape fit features with the Hu invariant moment features to form a digital environment feature vector. The fusion module is used to process the digital environment feature vectors, pose state information, and preset desired trajectories, and fuse them through a neural network model to obtain control parameter adjustment instructions. The control module is used to adjust the parameters of the UAV flight controller in real time according to the control parameter adjustment instructions, generate control signals to drive the UAV actuators, and realize dynamic tracking of the desired trajectory.

9. A computing device, comprising: include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program that, when executed by a processor, implements the method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Gesture recognition method based on fused skin color region segmentation and machine learning algorithm and application thereof

    CN108846359A

  • Intelligent vehicle path prediction system for automatic driving

    CN119611423A