Quadcopter hovering control method and device, electronic equipment and storage medium

The feature points of the image frame are extracted through feature detection and description algorithms, combined with attention network and feature matching, and adaptively adjust the PID controller parameters, solving the problem of insufficient stability and real-time performance of the hover control of the quadcopter, and achieving more efficient attitude control.

CN120353162APending Publication Date: 2025-07-22CIVIL AVIATION UNIV OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510418438.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-03
Publication Date
2025-07-22

AI Technical Summary

Technical Problem

The existing quadcopter hover control method lacks stability and real-time performance in the face of external disturbances, and has high engineering complexity, making it difficult to achieve efficient attitude control.

Method used

Feature detection and description algorithms are used to extract feature points in image frames, classify and filter through attention networks, calculate hover errors based on feature matching, and adaptively adjust the parameters of the PID controller to realize motor speed control.

Benefits of technology

It improves the stability and real-time nature of the hover control of the quadcopter, reduces the impact of invalid feature points on error detection, and simplifies the engineering implementation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120353162A_ABST
    Figure CN120353162A_ABST
Patent Text Reader

Abstract

The invention relates to the field of four-axis aircraft control, in particular to a four-axis aircraft hovering control method and device, electronic equipment and a storage medium, and the method comprises the steps: extracting feature points in an aircraft collection image frame in real time through a feature detection and description algorithm; the feature points are introduced into an attention network to calculate the influence of the feature points on hovering errors, and the feature points are filtered according to an attention network processing result to reduce the influence of invalid feature points on error detection; carrying out feature matching on the reserved feature points to calculate a feature point pixel difference, and estimating aircraft position offset estimation based on a feature point pixel difference analysis method; and adaptively adjusting the control parameters of the PID controller to obtain the control quantity for adjusting the rotating speed of the aircraft. According to the method, engineering implementation is facilitated, and the stability of hovering control can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of quadcopter control, and particularly to a quadcopter hovering control method, device, electronic device, and storage medium. Background Art

[0002] A quadcopter is a typical small unmanned aerial vehicle that uses four propellers as propulsion devices and controls the flight attitude by adjusting the propeller speeds. The precise hovering of a quadcopter means that the vehicle can maintain a stable position and altitude in the air without being affected by external disturbances. During the hovering process of a quadcopter indoors or outdoors, it is always subject to various disturbances, such as airflow interference, weather effects, and sensor errors. Therefore, it is necessary to design a disturbance-resistant attitude controller. The attitude control methods of quadcopters mainly include PID control, neural networks, active disturbance rejection control, sliding mode control, etc. However, the existing attitude control methods of quadcopters have problems such as insufficient stability and real-time performance, high engineering complexity, and being unfavorable for implementation. Summary of the Invention

[0003] In view of the above technical problems, the technical solution adopted by the present invention is as follows:

[0004] According to a first aspect of the present invention, there is provided a quadcopter hovering control method, and the method includes the following steps:

[0005] S100, for the currently received image frame, use a set feature detection and description algorithm to extract the feature points in the currently received image frame to obtain a corresponding set of feature points as the current set of feature points; the image frame is sent by the shooting device of the quadcopter.

[0006] S200, classify the feature points in the current set of feature points to obtain multiple sets of feature points, and obtain a set number of feature points from each set of feature points as key feature points and add them to the set of key feature points corresponding to the current image frame; the initial value of the set of key feature points corresponding to the current image frame is empty.

[0007] S300, perform feature matching on the feature points in the set of key feature points corresponding to the current image frame and the feature points in the set of key feature points corresponding to the previous image frame to obtain feature point pairs that have undergone feature matching; and then obtain the set of feature point pairs corresponding to the current image frame, and the set of feature point pairs includes multiple feature point pairs.

[0008] S400, based on the set of feature point pairs corresponding to the current image frame, respectively obtain the hovering errors of the quadcopter in the x-axis direction and y-axis direction of the earth coordinate system and respectively use them as the current first hovering error and second hovering error.

[0009] S500, adaptively adjust the control parameters of the PID controller based on the current first hovering error to obtain the adjusted control parameters as the first target control parameters, and adaptively adjust the control parameters of the PID controller based on the current second hovering error to obtain the adjusted control parameters as the second target control parameters.

[0010] S600, input the current first hovering error into the PID controller with the first target control parameters to obtain the first control quantity for controlling the motor speed of the quadcopter, and input the current second hovering error into the PID controller with the second target control parameters to obtain the second control quantity for controlling the motor speed of the quadcopter, and send the obtained first control quantity and second control quantity to the quadcopter.

[0011] According to the second aspect of the present invention, there is provided a hovering control device for a quadcopter, the device comprising:

[0012] A feature point extraction module, configured to extract feature points in the currently received image frame by using a set feature detection and description algorithm for the currently received image frame to obtain a corresponding set of feature points as the current set of feature points; the image frame is sent by a shooting device of the quadcopter.

[0013] An attention weight acquisition module, classifying the feature points in the current set of feature points to obtain multiple sets of feature points, and obtaining a set number of feature points from each set of feature points as key feature points and adding them to the set of key feature points corresponding to the current image frame; the initial value of the set of key feature points corresponding to the current image frame is empty.

[0014] A feature matching module, configured to perform feature matching between the feature points in the set of key feature points corresponding to the current image frame and the feature points in the set of key feature points corresponding to the previous image frame to obtain feature point pairs that have undergone feature matching; and further obtain a set of feature point pairs corresponding to the current image frame, the set of feature point pairs including multiple feature point pairs.

[0015] A hovering error acquisition module, configured to respectively obtain the hovering errors of the quadcopter in the x-axis direction and the y-axis direction of the earth coordinate system based on the set of feature point pairs corresponding to the current image frame, and respectively use them as the current first hovering error and the current second hovering error.

[0016] A control parameter adjustment module, configured to adaptively adjust the control parameters of the PID controller based on the current first hovering error to obtain the adjusted control parameters as the first target control parameters, and adaptively adjust the control parameters of the PID controller based on the current second hovering error to obtain the adjusted control parameters as the second target control parameters.

[0017] A control quantity acquisition module is configured to input the current first hovering error into a PID controller with first target control parameters to obtain a first control quantity for controlling the motor speed of the quadcopter, and input the current second hovering error into a PID controller with second target control parameters to obtain a second control quantity for controlling the motor speed of the quadcopter, and send the obtained first control quantity and second control quantity to the quadcopter.

[0018] According to a third aspect of the present invention, there is provided an electronic device including a processor and a memory; the processor is configured to execute the steps of the method according to the first aspect of the present invention by calling a program or instruction stored in the memory.

[0019] According to a fourth aspect of the present invention, there is provided a computer-readable storage medium storing a program or instruction, and the program or instruction causes a computer to execute the steps of the method according to the first aspect of the present invention.

[0020] The present invention has at least the following beneficial effects:

[0021] The quadcopter hovering control method provided by the embodiment of the present invention includes: extracting feature points in an image frame collected by the aircraft in real time through a feature detection and description algorithm; inputting the feature points into an attention network to calculate the influence of the feature points on the hovering error, and filtering the feature points according to the processing result of the attention network to reduce the influence of invalid feature points on error detection; performing feature matching on the remaining feature points to calculate the pixel difference of the feature points, and estimating the position offset of the aircraft based on a feature point pixel difference analysis method; adaptively adjusting the control parameters of the PID controller to obtain a control quantity for adjusting the rotation speed of the aircraft. The present invention is not only easy to implement in engineering but also can improve the stability of hovering control.

[0022] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present invention, nor is it used to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention, and those of ordinary skill in the art can obtain other drawings without creative efforts based on these drawings.

[0024] Figure 1 is a flowchart of the quadcopter hovering control method provided by the embodiment of the present invention;

[0025] Figure 2 Schematic diagram of whether the quadcopter has deviated. Specific implementation mode

[0026] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present invention.

[0027] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present invention belongs. The terms used in the description of the present invention in this specification are only for the purpose of describing specific implementation modes, and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.

[0028] It should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the steps as sequential processes, many of the steps can be implemented in parallel, concurrently, or simultaneously. In addition, the order of the steps can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0029] The embodiment of the present invention provides a hovering control method for a quadcopter, which is used to control the flight attitude of the quadcopter.

[0030] The quadcopter is an underactuated system with four inputs and six outputs. Structurally, it can be divided into two types: cross-shaped and cruciform. Its motors and propellers are respectively installed on 4 arm shafts, and the rotation of the propellers provides power for the quadcopter. In order to cancel out the counter-torque force generated by the rotors, the propellers on the same diagonal of the quadcopter rotate in the same direction, while the propellers on different diagonals rotate in opposite directions. In the embodiment of the present invention, a cruciform quadcopter is used for research, and the goal of steady-state control is that the aircraft can still maintain its current position and attitude unchanged when it is disturbed. When encountering external disturbances, it is not ideal to achieve a steady-state hovering effect only by the aircraft's own sensors. Therefore, a controller with good robustness and real-time performance needs to be designed.

[0031] The attitude of a quadcopter is described using attitude angles, and the flight position of the quadcopter is described by (x, y, z). When estimating the attitude of the aircraft, the body coordinate system and the earth coordinate system are usually involved. The body coordinate system is relative to the physical structure of the aircraft and is used to describe the attitude and motion state of the aircraft. The origin of the coordinate system is usually at the center of gravity of the aircraft. The X-axis is the forward direction of the aircraft, the Z-axis is perpendicular to the X-axis and points upward, and the Y-axis is determined by the right-hand rule. The earth coordinate system is relative to the flight environment, and this coordinate system provides a reference framework for describing the position and motion of the aircraft in the environment. The origin of the coordinate system is usually at the take-off point of the aircraft. The X-axis points due north, the Y-axis points due east, and the Z-axis is perpendicular to the ground and points upward.

[0032] According to Newton-Euler theorem, a dynamic model of the quadcopter is established. The relationship between the attitude change rate and the angular velocity is as follows, [a, b, c] T represent the angular velocities of the X, Y, and Z axes respectively, is the pitch angle, θ is the yaw angle, and φ is the roll angle.

[0033]

[0034] Let q be the thrust coefficient, p be the drag coefficient, and m be the mass of the quadcopter. Then the control quantity of the propeller angular velocity is expressed as:

[0035]

[0036] Among them, r1 represents the total thrust, and r2, r3, and r4 represent the roll control input, pitch control input, and yaw control input respectively. [Ω1, Ω2, Ω3, Ω4] is the angular velocity of the four propellers. The position of the quadcopter is:

[0037]

[0038] Among them, G represents gravity.

[0039] The attitude change of the aircraft can be described by rotation around the Z-axis, Y-axis, and X-axis. In the specified coordinate system, the above three rotations can respectively obtain the yaw angle, pitch angle, and roll angle. These three angles are used to represent the attitude transformation of the aircraft relative to the initial reference position. The conversion between the body coordinates and the ground coordinates can be achieved by means of rotation matrices and Euler angles, etc.

[0040] Furthermore, as Figure 1 shown, the embodiment of the present invention provides a hovering control method for a quadcopter, which may include the following steps:

[0041] S100. For the currently received image frame, use a set feature detection and description algorithm to extract the feature points in the currently received image frame, and obtain the corresponding set of feature points as the current set of feature points. The image frame is sent by the shooting device of the quadcopter.

[0042] In the embodiment of the present invention, the quadcopter will perform real-time shooting on the surrounding environment through its own shooting device, obtain the corresponding video stream and send it to the ground station. The ground station establishes a connection with the quadcopter through the on-board wireless network of the quadcopter and communicates with the quadcopter using the UDP (User Datagram Protocol) protocol. In the real world, humans judge the relative motion between people and objects by the position of the same object at different times. Inspired by this idea, the video stream collected by the quadcopter is processed frame by frame and the feature points in the image frame are extracted.

[0043] In the embodiment of the present invention, the set feature detection and description algorithm can be the ORB feature point detection and description algorithm. ORB (Oriented FAST and Rotated BRIEF) is a feature point detection and description algorithm with scale invariance and rotation invariance, which combines the FAST (Features from Accelerated Segment Test) corner detection algorithm and the BRIEF (Binary Robust Independent Elementary Features) descriptor algorithm, solving both the problem of slow speed in establishing feature points by the SIFT algorithm and the problem of limited computing resources. Therefore, the ORB algorithm is widely used in fields such as object recognition, image matching, and 3D reconstruction. The FAST algorithm judges whether a pixel point is a feature point by the gray values of other pixel points in the neighborhood of the pixel point. If the gray value of the pixel point is significantly different from the gray values of most pixel points in the neighborhood, the pixel point is considered a feature point. The BRIEF algorithm uses binary coding to describe the feature point information, reducing the feature matching time while accelerating the establishment speed of the feature descriptor. The BRIEF algorithm takes the feature point as the center, selects an S×S neighborhood window, randomly selects multiple pairs of feature points in the window for binary assignment to form a binary code, and this code is the descriptor of the feature point.

[0044] S200. Classify the feature points in the current set of feature points to obtain multiple sets of feature points, and obtain a set number of feature points from each set of feature points as key feature points, and add them to the set of key feature points corresponding to the current image frame. The initial value of the set of key feature points corresponding to the current image frame is empty.

[0045] A quadcopter is a typical small unmanned aerial vehicle with limited resources. If each feature point in an image frame is processed one by one, it will consume a large amount of resources and reduce the system efficiency. Therefore, it is necessary to classify the feature points to improve the real-time performance of hover error detection while improving the resource utilization rate of the quadcopter.

[0046] Further, S200 may specifically include:

[0047] S201, obtaining the attention weight of each feature point in the current feature point set, and classifying the feature points based on the obtained attention weights of all feature points to obtain a classification feature point set group CF = {CF1, CF2,..., CF i ,..., CF n}, CF i is the i-th type of feature point set in CF, and the value of i ranges from 1 to n, where n is the number of feature point sets in CF.

[0048] In the embodiment of the present invention, the attention weight of each feature point can be obtained through an attention network. The attention network is a new neural network structure designed by simulating the attention mechanism when humans process information, and it can be well combined with other models or algorithms so that the machine can filter unimportant information like humans. The core idea of the attention network is to adjust the model's attention to different information by calculating the weight matrix of the input sequence. The attention weight is obtained by calculating the inner product between vectors composed of feature point information and normalizing it. The attention weight represents the similarity degree between feature points, and the points with larger attention weights have stronger similarity. The feature points are divided according to the attention weights to obtain the classification feature point set group CF.

[0049] In the embodiment of the present invention, the attention network is a single-head self-attention mechanism network. The attention weight AS of the feature point = Q × K T , where Q is the query vector and K is the key vector. Those skilled in the art know that any method of obtaining the attention weight of feature points using a single-head self-attention mechanism grid belongs to the protection scope of the present invention.

[0050] In a schematic embodiment of the present invention, the attention weights of the feature points in the current feature point set can be clustered through a clustering algorithm such as the k-means algorithm, etc., to obtain CF.

[0051] In another schematic embodiment of the present invention, the feature points can be classified according to multiple thresholds. Specifically, S201 specifically includes:

[0052] S2011, initializing CF = {CF1, CF2, CF3}, and the initial values of CF1, CF2, and CF3 are empty.

[0053] In S2022, for the attention weight w of each obtained feature point, if w < w1, add the feature point to CF1; if w1 ≤ w ≤ w2, add the feature point to CF2; if w > w2, add the feature point to CF3; where w1 is the first set attention weight threshold and w2 is the second set attention weight threshold.

[0054] In an embodiment of the present invention, w1 and w2 can be empirical values. In a preferred embodiment, w1 = 0.3 and w2 = 0.7.

[0055] In an embodiment of the present invention, the average attention weight of the previous type of feature point set in two adjacent types of feature point sets in CF is less than the average attention weight of the latter type of feature point set.

[0056] S202, select Z i feature points from CF i and add them to the key feature point set corresponding to the current image frame.

[0057] Due to considering feature diversity, a set number of feature points are selected and retained from each attention weight classification set. In an embodiment of the present invention, Z i is positively correlated with the average attention weight of CF i , that is, the number of feature points retained in each type of feature point set is positively correlated with the average attention weight of the feature point set. The larger the average attention weight, the more feature points are retained. The specific relationship can be an empirical value.

[0058] In a schematic embodiment, Z i = k i ×Q i , k i is the selection coefficient corresponding to CF i , 0 < k i < 1, and it can be an empirical value. Q i is the number of feature points in the CF i . Among them, k1 + k2 + …… + k i + …… + k n = 1, and, k1 < k2 < …… < k i < …… < k n。In a schematic embodiment, for the first type of feature point set, the second type of feature point set, and the third type of feature point set obtained by multi-level threshold classification, where the number of feature points Z1 selected from the first type of feature point set = 0.2 × Q1, the number of feature points Z2 selected from the second type of feature point set = 0.3 × Q2, and the number of feature points Z3 selected from the third type of feature point set = 0.5 × Q3, where Q1, Q2, and Q3 are the numbers of feature points in the first type of feature point set, the second type of feature point set, and the third type of feature point set, respectively.

[0059] In the embodiments of the present invention, the feature points in the image frame are used as the input of the attention network to calculate the attention weights, and the input feature points are divided into feature point sets with different similarities according to the attention weights. Any number of feature points are selected and retained from different sets, which can significantly reduce the number of feature points while retaining the key feature points. The reduction in the number of feature points means that the efficiency of the feature matching algorithm is improved, that is, the time for detecting the hovering error of the quadcopter is shortened.

[0060] S300. Feature match the feature points in the key feature point set corresponding to the current image frame with the feature points in the key feature point set corresponding to the previous image frame to obtain the feature point pairs that have undergone feature matching; obtain the feature point pair set corresponding to the current image frame, and the feature point pair set includes multiple feature point pairs.

[0061] In S300, any feature point pair in the feature point pair set corresponding to the current image frame is obtained through the following steps:

[0062] For any feature point in the key feature point set corresponding to the current image frame, based on the feature matching algorithm, obtain the corresponding feature point corresponding to this feature point from the key feature point set corresponding to the previous image frame. If the corresponding feature point is obtained, obtain the distance between the descriptors of this feature point and the corresponding feature point. If the distance is less than the set distance parameter, use this feature point and the corresponding feature point as a feature point pair.

[0063] In the embodiments of the present invention, the feature matching algorithm can be an existing feature matching algorithm, such as the ORB feature point detection and description algorithm. The set distance parameter can be an empirical value. In a schematic embodiment, the set distance parameter can be 30.

[0064] S400. Based on the feature point pair set corresponding to the current image frame, respectively obtain the hovering errors of the quadcopter in the x-axis direction and the y-axis direction of the earth coordinate system, and use them as the current first hovering error and second hovering error, respectively.

[0065] Further, S400 may specifically include:

[0066] S401. Obtain the pixel differences of any feature point pair in the x-axis direction and the y-axis direction in the set of feature point pairs corresponding to the current image frame respectively, as the first pixel difference and the second pixel difference of this feature point pair; obtain the first pixel difference sequence and the second pixel difference sequence corresponding to the set of feature point pairs corresponding to the current image frame.

[0067] S402. Sort the first pixel difference sequence and the second pixel difference sequence respectively in ascending order of pixel difference to obtain the sorted first pixel difference sequence and the second pixel difference sequence.

[0068] S403. Take the median value in the sorted first pixel difference sequence as the current first hovering error, and take the median value in the sorted second pixel difference sequence as the current second hovering error.

[0069] In the embodiments of the present invention, the positive or negative of the pixel difference represents the offset direction of the quadcopter, and the magnitude of the pixel difference represents the offset distance of the quadcopter. If the pixel error is a, there are the following two cases:

[0070] 1) When a = 0, the quadcopter does not deviate. Use the ORB feature point detection and description algorithm to extract the feature points in the image frame, as shown by the solid dots in the left image in Figure 2 This is an ideal state. Figure 2 The t-th frame in

[0071] represents the previous frame image, and the (t + 1)-th frame represents the current frame image. Figure 2 2) When a ≠ 0, the quadcopter deviates. The aircraft keeps the attitude angle unchanged and deviates by a distance of |a| in the direction of the X-axis of the image coordinate system. The feature points in the image frame after deviation also move, as shown by the dotted dots in the right image in

[0072] S500. Based on the current first hovering error, adaptively adjust the control parameters of the PID controller to obtain the adjusted control parameters as the first target control parameters, and based on the current second hovering error, adaptively adjust the control parameters of the PID controller to obtain the adjusted control parameters as the second target control parameters.

[0073] Further, S500 may specifically include:

[0074] S501. Construct Z control parameter combinations and set the iteration number counter t = 1.

[0075] In the embodiments of the present invention, the value of Z can be set according to actual needs, and Z > 1.

[0076] S502. Based on the current hovering error, obtain the fitness of the PID controller under each of the current Z control parameter combinations, obtaining Z fitness values. Sort these Z fitness values in descending order, and use the k control parameter combinations corresponding to the top k fitness values in the sorted Z fitness values as the current reference combinations, and use the remaining (Z - k) control parameter combinations as the current combinations to be adjusted, where 1 < k < Z; the current hovering error is the current first hovering error or the current second hovering error.

[0077] In an embodiment of the present invention, the current hovering error can be input into a PID controller with different control parameter combinations to obtain corresponding control quantities. The fitness of the PID controller under each control parameter combination can be obtained based on a fitness function. For example, the fitness function can be set to be equal to the square of the difference between the input and output of the PID controller, etc.

[0078] The value of k can be set according to actual needs. In an exemplary embodiment, k = 3.

[0079] S503. If t > T or the current Z fitness values meet the set conditions, use the control parameter combination corresponding to the maximum fitness value among the current Z fitness values as the target control parameter of the PID controller; otherwise, execute S504; T is the total number of iterations.

[0080] In an embodiment of the present invention, T can be set according to actual needs. The set conditions can be set according to actual needs. For example, the maximum fitness value is greater than a set fitness threshold, etc.

[0081] S504. Obtain the adjustment factor A uv (t) and the guiding factor C uv (t) for the u-th reference combination with respect to the v-th combination to be adjusted at the current iteration number t, where A uv (t) = (2 × r uv (t) - 1) × (a max - (a max - a min ) × (t / T) 2 ), C uv (t) = 2 × r uv (t) × (c max - (c max - c min ) × (t / T) 2 ), where a max is the maximum adjustment value, a min is the minimum adjustment value, c max is the maximum guiding value, c min is the minimum guiding value, and r uv(t) is the random factor of the u-th reference combination for the v-th combination to be adjusted at the current iteration t, where the value range of u is from 1 to k, and the value range of v is from 1 to Z - k.

[0082] In the embodiment of the present invention, the adjustment factor is used to control the search direction (positive or negative) and step size (magnitude), that is, to approach (biased towards local search) or move away from (biased towards global search) the reference combination. In terms of conversion to numerical values, this approach and departure carry positive and negative signs. For example, for the same distance of 1, moving in the direction of approaching the reference combination is +1, and moving in the direction of moving away from the reference combination is -1. The guiding factor is used to adjust the search range of the combination to be adjusted relative to the reference combination, without involving changes in the positive and negative directions. The role of the random factor is to increase the randomness and diversity of the search. Through this random perturbation, the behavior of each individual will be slightly different. For example, if there are 20 combinations to be adjusted and 3 reference combinations, without the random factor, the information obtained by these 20 combinations to be adjusted, the advancing direction, the affected intensity, etc. will be exactly the same. However, with a random factor for each combination to be adjusted, they can exhibit different behaviors, increasing the possibility of finding the optimal solution.

[0083] In the embodiment of the present invention, the specific meanings of approaching and moving away are as follows: For example, if four points A, B, C, and D are arranged in sequence, A is the combination to be adjusted, and C is the reference combination, then "approaching" C refers to the position of B, between C and A, while "moving away" from C refers to the position of D, on the other side of C.

[0084] In the embodiment of the present invention, the range of the random factor is 0 - 1. Since the range of the random factor is 0 - 1, if the random factor is multiplied by 2, the range becomes 0 - 2. In this way, it may be larger or smaller than the guiding factor, which can make the result more diverse and further expand the search space.

[0085] S505. Update the combinations to be adjusted in the current Z control parameter combinations, obtain the updated Z control parameter combinations, and use the updated Z control parameter combinations as the current Z control parameter combinations. Set t = t + 1 and execute S502.

[0086] Among them, the updated v-th combination to be adjusted X v new satisfies the following condition: X v new =(1 / k)×∑ k u=1 (W u ×X u temp (t)), X u temp (t) is the temporary combination of the v-th combination to be adjusted relative to the u-th reference combination currently, and Wu is the weight corresponding to the u-th reference combination, X u temp (t) = X u (t) - A uv (t) × D uv (t), X u (t) is the control parameter combination corresponding to the u-th reference combination, D uv (t) is the distance between the u-th reference combination and the v-th combination to be adjusted.

[0087] In the embodiment of the present invention, in the calculation process of X u temp (t), the adjustment factor A uv (t) is used to adjust the amplitude and direction of each position update by scaling the distance D uv (t), so as to control how the combination to be adjusted moves around the reference combination. When A uv (t) × D uv (t) has a negative sign in front, when A uv (t) is also negative, it will move away from the reference combination, and when A uv (t) is positive, it will move closer to the reference combination. The amplitude of this adjustment is determined by the numerical value of A uv (t).

[0088] In the embodiment of the present invention, D uv (t) satisfies the following conditions:

[0089] D uv (t) = |C uv (t) × X u (t) - X v (t)|;

[0090] wherein, X v (t) is the hyperparameter combination corresponding to the current v-th combination to be adjusted.

[0091] In the embodiment of the present invention, adding or subtracting combinations means adding or subtracting each corresponding element in the combinations. For example, the hyperparameter combination (2, 3) plus the hyperparameter combination (4, 2) = (2 + 4, 3 + 2) = (6, 5). That is, X u temp (t) can be specifically expressed as: X u temp (t) = (X u 1 (t) - A uv (t) × D uv 1 (t), ……, X u w(t)-A uv (t)×D uv w (t), ……, X u Q (t)-A uv (t)×D uv Q (t)), X u w (t) is X u (t) is the w-th hyperparameter in X, where w ranges from 1 to Q, and Q is the number of hyperparameters in the hyperparameter combination. D uv w (t) is D uv (t) is the w-th element in D. D uv (t) can be specifically expressed as: D uv (t) = (|C uv (t)×X u 1 (t)-X v 1 (t)|, ……, |C uv (t)×X u w (t)-X v w (t)|, ……, |C uv (t)×X u Q (t)-X v Q (t)|), X v w (t) is X v (t) is the w-th hyperparameter in X. X v new It can be specifically expressed as: X v new = ((1 / k)×∑ k u=1 (X u temp-1 (t)), ……, (1 / k)×∑ k u=1 (X u temp-w (t)), ……, (1 / k)×∑ k u=1 (X u temp-Q (t))), X u temp-w (t) is X u temp (t) is the w-th element in X, that is, X u w (t)-Auv (t)×D uv w (t).

[0092] In the embodiment of the present invention, since the distance difference between the product of the combination to be adjusted and the reference combination and the corresponding guiding factor is used as the distance between the combinations, the search space can be expanded and the global optimization effect is good. For example, if the reference combination is (1, 1) and the combination to be adjusted is (4, 1), and if the corresponding guiding factor is greater than 1, then the distance calculated by the above formula will be larger than the original true distance (3, 0). Suppose the hyperparameter combination corresponding to a certain combination to be adjusted is (1, 1), the hyperparameter combination corresponding to the reference combination is (5, 5), the adjustment factor of the reference combination for this combination to be adjusted is 1.2, and the guiding factor is 0.8. Then the distance between the two is (5×0.8, 5×0.8)-(1, 1)=(3, 3), and the temporary combination of this combination to be adjusted relative to this reference combination is (5, 5)-(1.2×3, 1.2×3)=(1.4, 1.4).

[0093] In the embodiment of the present invention, by automatically searching the parameter space of the control parameters, the controller parameters that minimize the hovering error are found, which solves the problem of the complexity of manual tuning of the parameters of the traditional PID controller. In addition, there are external disturbances of different degrees during the steady-state hovering process, which makes the feedback error change in real time. Through S500, it can help the PID controller to achieve adaptive adjustment of the parameters.

[0094] S600, input the current first hovering error into the PID controller with the first target control parameters to obtain the first control quantity for controlling the motor speed of the quadcopter, and input the current second hovering error into the PID controller with the second target control parameters to obtain the second control quantity for controlling the motor speed of the quadcopter, and send the obtained first control quantity and second control quantity to the quadcopter.

[0095] In the embodiment of the present invention, the send_rc_control command is used to send the change of the propeller speed to the flight control system of the quadcopter, and control the quadcopter to make corresponding movements so that it is always in the ideal state of hovering control.

[0096] (Embodiment)

[0097] The present invention conducts actual flight experiments on the Tello quadcopter platform. This quadcopter is equipped with a front monocular camera that can transmit a 720p video stream and image frames of 5 million pixels. An electronic anemometer is used to control the external force disturbances during the experiment. The anemometer is a wind speed measuring instrument that can convert the input analog signal into a digital signal. The external force disturbance device uses a wind speed regulator, and the wind force is between [0.6, 3.0] (unit: m / s).

[0098] The present invention simulates the disturbances encountered during the hover of the quadcopter through two different disturbance methods and conducts actual flight experiments to compare the performance of PID, fuzzy PID controllers, and the controller designed in this paper. The following scenarios are designed according to the disturbance methods:

[0099] 1) Scenario 1 (no disturbance experiment): Comparison of different control algorithms and the method of the present invention without external force disturbance;

[0100] 2) Scenario 2 (different wind flow disturbance experiments): Simulate the air flow disturbance encountered during the hover of the quadcopter through a wind speed regulator;

[0101] 3) Scenario 3 (different external force disturbance experiments): Simulate the external force disturbance that the quadcopter may encounter during hover by pulling with a thin string.

[0102] The ground station establishes a connection with the quadcopter platform Tello through its own WIFI. After successfully establishing the connection, the ground station can process the video stream data obtained during the flight of the quadcopter frame by frame, extract the feature points in the image frames, send them into the attention network for filtering processing, then match them through a matcher and filter the obtained results to get the optimal matching result. The ORB feature point pixel difference analysis method is used to estimate the offset of the quadcopter. Finally, the adaptive PID controller based on the improved grey wolf optimization algorithm calculates the rotational speed change of the quadcopter and returns the control command.

[0103] During the experiment, the parameters of the PID controller and the fuzzy PID controller are both initialized to [0.225, 0.15, 0.16]. In the grey wolf optimization algorithm, the number of grey wolves N is initialized to 15, and the maximum number of iterations MaxIter is 50.

[0104] It is found through experimental results that in the air flow disturbance experiment with a wind speed of [1.0, 1.4] (unit: m / s), in the horizontal direction, the cumulative error of the adaptive PID controller obtained based on the method provided by the present invention is reduced by about 18% on the basis of the PID controller and by 31% on the basis of the fuzzy PID controller; in the vertical direction, the cumulative errors are reduced by 18% and 45% respectively on the basis of the PID controller and the fuzzy PID controller. The experimental results of the three groups all show that the PID controller based on the method provided by the present invention can greatly reduce the hovering error and has better robustness.

[0105] Based on the same inventive concept, an embodiment of the present invention provides a hovering control device for a quadcopter, and the device includes:

[0106] A feature point extraction module, configured to extract feature points in the currently received image frame by using a set feature detection and description algorithm for the currently received image frame, so as to obtain a corresponding set of feature points as the current set of feature points; the image frame is sent by a shooting device of the quadcopter.

[0107] An attention weight acquisition module, which classifies the feature points in the current set of feature points to obtain N sets of feature points, and obtains a set number of feature points from each set of feature points as key feature points, and adds them to the set of key feature points corresponding to the current image frame; the initial value of the set of key feature points corresponding to the current image frame is empty.

[0108] A feature matching module, configured to perform feature matching on the feature points in the set of key feature points corresponding to the current image frame and the feature points in the set of key feature points corresponding to the previous image frame to obtain feature point pairs that have undergone feature matching; and further obtain a set of feature point pairs corresponding to the current image frame, where the set of feature point pairs includes multiple feature point pairs.

[0109] A hovering error acquisition module, configured to respectively obtain the hovering errors of the quadcopter in the x-axis direction and the y-axis direction of the earth coordinate system based on the set of feature point pairs corresponding to the current image frame, and respectively use them as the current first hovering error and the second hovering error.

[0110] A control parameter adjustment module, configured to adaptively adjust the control parameters of the PID controller based on the current first hovering error to obtain adjusted control parameters as the first target control parameters, and adaptively adjust the control parameters of the PID controller based on the current second hovering error to obtain adjusted control parameters as the second target control parameters.

[0111] A control quantity acquisition module, configured to input a current first hovering error into a PID controller with a first target control parameter to obtain a first control quantity for controlling the motor speed of the quadcopter, and input a current second hovering error into a PID controller with a second target control parameter to obtain a second control quantity for controlling the motor speed of the quadcopter, and send the obtained first control quantity and second control quantity to the quadcopter.

[0112] This device can be used to execute Figure 1 the method shown in the embodiments shown, and thus, for the functions that can be achieved by each functional module of this device, reference can be made to Figure 1 the description of the embodiments shown, which will not be elaborated here.

[0113] An embodiment of the present invention further provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are configured to execute the method of the embodiment of the present invention.

[0114] An embodiment of the present invention further provides a computer-readable storage medium storing computer-executable instructions, and the computer instructions are used to execute the method of the embodiment of the present invention.

[0115] It should be understood that various forms of the processes shown above can be used, steps can be reordered, added or deleted. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in the present invention can be achieved, and no limitation is made herein.

[0116] The above specific embodiments do not constitute a limitation to the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.

Claims

1. A hovering control method for a quadcopter, characterized in that, The method includes the following steps: S100. For the currently received image frame, use a set feature detection and description algorithm to extract feature points in the currently received image frame, and obtain the corresponding set of feature points as the current set of feature points. The image frame is sent by the shooting device of the quadcopter. S200. Classify the feature points in the current set of feature points to obtain multiple sets of feature points, and obtain a set number of feature points from each set of feature points as key feature points, and add them to the set of key feature points corresponding to the current image frame. The initial value of the set of key feature points corresponding to the current image frame is empty. S300. Match the feature points in the set of key feature points corresponding to the current image frame with the feature points in the set of key feature points corresponding to the previous image frame to obtain feature point pairs that have been feature-matched; thereby obtaining the set of feature point pairs corresponding to the current image frame, and the set of feature point pairs includes multiple feature point pairs. S400. Based on the set of feature point pairs corresponding to the current image frame, respectively obtain the hovering errors of the quadcopter in the x-axis direction and y-axis direction of the earth coordinate system, and use them as the current first hovering error and second hovering error respectively. S500. Based on the current first hovering error, adaptively adjust the control parameters of the PID controller to obtain the adjusted control parameters as the first target control parameters, and based on the current second hovering error, adaptively adjust the control parameters of the PID controller to obtain the adjusted control parameters as the second target control parameters. S600. Input the current first hovering error into the PID controller with the first target control parameters to obtain the first control quantity for controlling the motor speed of the quadcopter, and input the current second hovering error into the PID controller with the second target control parameters to obtain the second control quantity for controlling the motor speed of the quadcopter, and send the obtained first control quantity and second control quantity to the quadcopter.

2. The method according to claim 1, wherein In S300, any feature point pair in the set of feature point pairs corresponding to the current image frame is obtained through the following steps: For any feature point in the set of key feature points corresponding to the current image frame, based on the feature matching algorithm, obtain the corresponding feature point corresponding to this feature point from the set of key feature points corresponding to the previous image frame. If the corresponding feature point is obtained, obtain the distance between the descriptor of this any feature point and the corresponding feature point. If the distance is less than or equal to the set distance parameter, use this any feature point and the corresponding feature point as a feature point pair.

3. The method according to claim 1, characterized in that, S400 specifically includes: S401. Respectively obtain the pixel differences of any feature point pair in the set of feature point pairs corresponding to the current image frame in the x-axis direction and y-axis direction as the first pixel difference and the second pixel difference of this feature point pair; obtain the first pixel difference sequence and the second pixel difference sequence corresponding to the set of feature point pairs corresponding to the current image frame. S402. Respectively sort the first pixel difference sequence and the second pixel difference sequence in ascending order of pixel difference to obtain the sorted first pixel difference sequence and the second pixel difference sequence. S403. Take the median value in the sorted first pixel difference sequence as the current first hovering error, and take the median value in the sorted second pixel difference sequence as the current second hovering error.

4. The method according to claim 1, wherein S500 specifically includes: S501. Construct Z control parameter combinations, and set the iteration number counter t = 1; S502. Based on the current hovering error, obtain the fitness of the PID controller under the current Z control parameter combinations respectively, obtain Z fitness values, sort them in descending order, and take the control parameter combinations corresponding to the top k fitness values in the sorted Z fitness values as the current reference combinations, and take the remaining (Z - k) control parameter combinations as the current combinations to be adjusted, where 1 < k < Z; the current hovering error is the current first hovering error or the current second hovering error; S503. If t > T or the current Z fitness values meet the set conditions, take the control parameter combination corresponding to the maximum fitness value in the current Z fitness values as the target control parameter of the PID controller; otherwise, execute S504; T is the total number of iterations; S504, obtain the adjustment factor A uv (t) and the guiding factor C uv (t) of the u-th reference combination for the v-th combination to be adjusted at the current iteration number t, where A uv (t) = (2 × r uv (t) - 1) × (a max - (a max - a min ) × (t / T) 2 ), and C uv (t) = 2 × r uv (t) × (c max - (c max - c min ) × (t / T) 2 ), where a max is the maximum adjustment value, a min is the minimum adjustment value, c max is the maximum guiding value, c min is the minimum guiding value, and r uv (t) is the random factor of the u-th reference combination for the v-th combination to be adjusted at the current iteration number t. The value range of u is from 1 to k, and the value range of v is from 1 to Z - k; S505. Update the combination to be adjusted among the current Z control parameter combinations to obtain the updated Z control parameter combinations, and use the updated Z control parameter combinations as the current Z control parameter combinations. Set t = t + 1 and execute S502. Among them, the updated v-th combination to be adjusted X v new satisfies the following condition: X v new =(1 / k)×∑ k u=1 (W u ×X u temp (t)), X u temp (t) is the temporary combination of the v-th combination to be adjusted relative to the u-th reference combination at present, W u is the weight corresponding to the u-th reference combination, X u temp (t)=X u (t)-A uv (t)×D uv (t), X u (t) is the control parameter combination corresponding to the u-th reference combination, D uv (t) is the distance between the u-th reference combination and the v-th combination to be adjusted.

5. The method according to claim 1, characterized in that, S200 specifically includes: S201. Obtain the attention weights of each feature point in the current feature point set, and classify the feature points based on the obtained attention weights of all feature points to obtain a classification feature point set group CF = {CF1, CF2,..., CF i ,..., CF n}, where CF i is the i-th type of feature point set in CF, and the value of i ranges from 1 to n, where n is the number of feature point sets in CF; S202, select Z i feature points from CF i and add them to the key feature point set corresponding to the current image frame.

6. The method according to claim 5, characterized in that S201 specifically includes: S2011. Initialize CF = {CF1, CF2, CF3}, and the initial values of CF1, CF2, and CF3 are empty; S2022. For the attention weight w of each obtained feature point, if w < w1, add this feature point to CF1, if w1 ≤ w ≤ w2, add this feature point to CF2, if w > w2, add this feature point to CF3; where w1 is the first set attention weight threshold and w2 is the second set attention weight threshold.

7. The method according to claim 5, characterized in that The average attention weight corresponding to the previous type of feature point set in two adjacent types of feature point sets in CF is less than the average attention weight corresponding to the latter type of feature point set, where Z i = k i ×Q i , k i is the selection coefficient corresponding to CF i , 0 < k i < 1, Q i is the number of feature points in CF i , where, k1 + k2 + …… + k i + …… + k n = 1, and, k1 < k2 < …… < k i < …… < k n .

8. A four-axis aircraft hovering control device, characterized in that, The device includes: A feature point extraction module, which is used to extract the feature points in the currently received image frame by using a set feature detection and description algorithm for the currently received image frame, and obtain the corresponding feature point set as the current feature point set; the image frame is sent by the shooting device of the quadcopter; An attention weight acquisition module, which classifies the feature points in the current feature point set to obtain multiple categories of feature point sets, and obtains a set number of feature points from each category of feature point sets as key feature points, and adds them to the key feature point set corresponding to the current image frame; the initial value of the key feature point set corresponding to the current image frame is empty; A feature matching module, which is used to match the feature points in the key feature point set corresponding to the current image frame with the feature points in the key feature point set corresponding to the previous image frame to obtain the feature point pairs that have undergone feature matching; and then obtain the feature point pair set corresponding to the current image frame, and the feature point pair set includes multiple feature point pairs; A hovering error acquisition module, which is used to respectively obtain the hovering errors of the quadcopter in the x-axis direction and y-axis direction of the earth coordinate system based on the feature point pair set corresponding to the current image frame, and respectively use them as the current first hovering error and the current second hovering error; A control parameter adjustment module, configured to adaptively adjust the control parameters of a PID controller based on the current first hovering error to obtain the adjusted control parameters as the first target control parameters, and adaptively adjust the control parameters of the PID controller based on the current second hovering error to obtain the adjusted control parameters as the second target control parameters; A control quantity acquisition module, configured to input the current first hovering error into a PID controller with the first target control parameters to obtain a first control quantity for controlling the motor speed of the quadcopter, and input the current second hovering error into a PID controller with the second target control parameters to obtain a second control quantity for controlling the motor speed of the quadcopter, and send the obtained first control quantity and second control quantity to the quadcopter.

9. An electronic device, characterized in that, It includes a processor and a memory; The processor is configured to execute the steps of the method according to any one of claims 1 to 7 by calling the program or instructions stored in the memory.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store the program or instructions, and the program or instructions cause the computer to execute the steps of the method according to any one of claims 1 to 7.