A method for optimizing control parameters of a quadrotor drone
By designing an optimization method for the control parameters of four-rotor UAVs, using nonlinear update strategy and cost function, the problem that the existing PID parameter adjustment method is time-consuming and labor-intensive and the optimization results cannot guarantee energy saving and tracking performance, and the rapid and accurate search of the optimal parameters of multiple sets of PID controllers is achieved, and the tracking performance and energy efficiency are improved.
Patent Information
- Application Number
- CN202411650711.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-11-19
AI Technical Summary
The existing PID parameter adjustment method is time-consuming and labor-intensive for the case where a quadrotor UAV needs multiple sets of PID controllers. The fitness function used by the optimization algorithm lacks dependence on force, resulting in the ultimate optimization result that the energy saving and tracking performance optimization cannot be guaranteed.
An optimization method for the control parameters of four-rotor UAV was designed. By obtaining mathematical models and designing the PID controller, a nonlinear update strategy and a cost function containing error terms and input terms were adopted, the population position was updated and the parameters of the PID controller were adjusted to balance the global and local search capabilities.
This method quickly and accurately finds the optimal parameters of multiple sets of PID controllers, improves the tracking performance and energy efficiency in PID control, and ensures the ability to balance global and local searches during the optimization process.
Smart Images

Figure CN119148507B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of unmanned aerial vehicle control, and in particular to a method for optimizing control parameters of a quad-rotor unmanned aerial vehicle. Background Art
[0002] Quadrotors have become indispensable in various applications such as monitoring, mapping, emergency rescue, and environmental observation due to their flexibility and versatility. A lot of research has been devoted to the development of quadrotors. On the one hand, many scholars focus on the state space modeling of quadrotors; on the other hand, based on these models, different control methods have also been studied on drones, such as linear quadratic regulation control, backstepping control, sliding mode control, model predictive control, etc.
[0003] Although the above control methods have achieved good results, proportional-integral-derivative control (PID) is still the dominant method in practical applications. However, the adjustment of PID parameters is usually obtained by trial and error, which is a very time-consuming and laborious project for the situation where a quadrotor drone requires multiple sets of PID controllers. To solve this problem, many optimization algorithms are used to find the optimal PID parameters, such as: the live system search algorithm tunes the PID parameters by minimizing the integral square error; meta-heuristic methods such as genetic algorithms are also used to optimize PID parameters; a new collaborative particle swarm optimization method is used to cross-optimize the control parameters of two subsystems; other optimization algorithms for PID parameter tuning include gravity search algorithm, taboo search optimization, differential evolution, golden search optimization algorithm and longhorn beard search algorithm. However, the fitness functions used by these optimization algorithms lack dependence on force, so the final optimization result cannot guarantee energy saving, and the tracking performance is still not ideal.
[0004] As a meta-heuristic search method, the beetle swarm algorithm has the advantages of fast convergence and simple structure. It does not need to understand the specific form of the function or gradient information to achieve efficient optimization. However, in the traditional beetle swarm algorithm, the group always maintains a fixed moving speed during the iteration process, which causes the population to tend to either global search or local search, hindering the algorithm from finding the global optimal solution. Summary of the invention
[0005] In view of this, the present invention provides a method for optimizing the control parameters of a quadrotor drone, which is used to quickly and accurately find the optimal parameters of multiple groups of PID controllers, balance the capabilities of global and local searches during the optimization process, and improve the tracking performance and energy efficiency in PID control.
[0006] In a first aspect, the present invention provides a method for optimizing control parameters of a quad-rotor drone, the method comprising:
[0007] Step 1: Obtain the mathematical model of the quadrotor drone and design a PID controller;
[0008] Step 2: Design a nonlinear update strategy based on the PID controller;
[0009] Step 3: According to the nonlinear update strategy, a cost function including error terms and input terms is designed to update the population position and adjust the parameters of the PID controller.
[0010] Optionally, the mathematical model in step 1 includes:
[0011] ;
[0012] Among them, the take-off position of the quadcopter is taken as the origin. Indicates the distance traveled in the east direction. Indicates the speed in the east direction. represents the acceleration in the east direction; Indicates the distance traveled in the south direction. Indicates the speed in the south direction. represents the acceleration in the south direction; Indicates the height of the flight in the vertical direction. Indicates the speed of flying in the vertical direction. Indicates the acceleration of flying upward in the vertical direction; Indicates the angle of rotation towards the east direction. represents the angular velocity of rotation toward the east direction, represents the angular acceleration of rotation toward the due east; Indicates the angle of rotation towards due south. represents the angular velocity of rotation toward due south, represents the angular acceleration of rotation toward due south; Indicates the angle of rotation of the quadrotor from west to east. represents the angular velocity of the quadrotor rotating from west to east, represents the angular acceleration of the quadrotor rotating from west to east; are the overall mass and arm length of the quadrotor respectively; is the sum of the speeds of the four propellers; , and Four rotors in , , Coefficient of moment of inertia in direction; , and Four rotors in , , Directional fuselage drag coefficient; , and Four rotors in , , Fuselage damping moment coefficient in direction; is the total lift generated by the rotation of the four propellers, , , Four rotors in , , The torque in the direction;
[0013] Decompose the mathematical model into two subsystem models, including position subsystem and attitude subsystem;
[0014] The expression of the position subsystem is:
[0015] ;
[0016] The expression of the attitude subsystem is:
[0017] ;
[0018] In the quadrotor system, the attitude subsystem serves as the inner loop and the position subsystem serves as the outer loop.
[0019] Optionally, the algorithm of the PID controller in step 1 is:
[0020] ;
[0021] in, is the proportional coefficient of the PID control algorithm, is the integral coefficient of the PID control algorithm, is the differential coefficient of the PID control algorithm, is the state error of the system;
[0022] Specifically:
[0023] ;
[0024] ;
[0025] ;
[0026] ;
[0027] in, is the total lift generated by the rotation of the four propellers, , , Four rotors in , , The torque in the direction; Indicates the height of the flight in the vertical direction. Indicates the angle of rotation towards the east direction. Indicates the angle of rotation towards due south. Indicates the angle of the quadrotor's rotation from west to east.
[0028] Optionally, the nonlinear update strategy in step 2 includes:
[0029] ;
[0030] ;
[0031] ;
[0032] in, is the inertia weight in the beetle swarm optimization algorithm, and They are The minimum and maximum values of is the acceleration factor in the beetle swarm optimization algorithm, and They are The minimum and maximum values of is the acceleration factor in the beetle swarm optimization algorithm, and They are The minimum and maximum values of is a proportional coefficient of a nonlinear update strategy, n is the number of optimizations, and N is the maximum number of optimization iterations.
[0033] Optionally, the cost function in step 3 is in the form of:
[0034] ;
[0035] in, is the cost function of the design, , , , is the tracking error of the system, , , , They are the upward forces generated by the rotation of the four propellers of the quadrotor; , , , The relationship is:
[0036] .
[0037] In the technical solution provided by the present invention, the method includes obtaining a mathematical model of a quad-rotor unmanned aerial vehicle and designing a PID controller; designing a nonlinear update strategy based on the PID controller; designing a cost function including error terms and input terms based on the nonlinear update strategy to update the population position and adjust the parameters of the PID controller. The method quickly and accurately finds the optimal parameters of multiple groups of PID controllers, balances the capabilities of global and local searches during the optimization process, and improves the tracking performance and energy efficiency in PID control. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 A flowchart of a method for optimizing control parameters of a quad-rotor drone provided in an embodiment of the present invention;
[0040] Figure 2 A diagram of the attitude control architecture of a quad-rotor drone provided in an embodiment of the present invention;
[0041] Figure 3 A flow chart of an improved beetle swarm optimization algorithm provided by an embodiment of the present invention;
[0042] Figure 4 A nonlinear update change diagram of inertia weight provided by an embodiment of the present invention;
[0043] Figure 5 A nonlinear update change diagram of the acceleration factor provided by an embodiment of the present invention;
[0044] Figure 6 A schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0046] It should be clear that the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention are also intended to include plural forms, unless the context clearly indicates other meanings.
[0048] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0049] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0050] Figure 1 A flowchart of a method for optimizing control parameters of a quad-rotor drone provided in an embodiment of the present invention is shown in FIG. Figure 1 As shown, the method includes:
[0051] Step 1: Obtain the mathematical model of the quadrotor drone and design a PID controller.
[0052] In the embodiment of the present invention, the mathematical model in step 1 includes:
[0053] ;
[0054] Among them, the take-off position of the quadcopter is taken as the origin. Indicates the distance traveled in the east direction. Indicates the speed in the east direction. represents the acceleration in the east direction; Indicates the distance traveled in the south direction. Indicates the speed in the south direction. represents the acceleration in the south direction; Indicates the height of the flight in the vertical direction. Indicates the speed of flying in the vertical direction. Indicates the acceleration of flying upward in the vertical direction; Indicates the angle of rotation towards the east direction. represents the angular velocity of rotation toward the east direction, represents the angular acceleration of rotation toward the due east; Indicates the angle of rotation towards due south. represents the angular velocity of rotation toward due south, represents the angular acceleration of rotation toward due south; Indicates the angle of rotation of the quadrotor from west to east. represents the angular velocity of the quadrotor rotating from west to east, represents the angular acceleration of the quadrotor rotating from west to east; are the overall mass and arm length of the quadrotor respectively; is the sum of the speeds of the four propellers; , and Four rotors in , , Coefficient of moment of inertia in direction; , and Four rotors in , , Directional fuselage drag coefficient; , and Four rotors in , , Fuselage damping moment coefficient in direction; is the total lift generated by the rotation of the four propellers, , , Four rotors in , , The torque in the direction;
[0055] In the embodiment of the present invention, Figure 2 As shown, the mathematical model is decomposed into two subsystem models, including a position subsystem and a posture subsystem;
[0056] The expression of the position subsystem is:
[0057] ;
[0058] The expression of the attitude subsystem is:
[0059] ;
[0060] In the quadrotor system, the attitude subsystem serves as the inner loop and the position subsystem serves as the outer loop.
[0061] In the embodiment of the present invention, the algorithm of the PID controller in step 1 is:
[0062] ;
[0063] in, is the proportional coefficient of the PID control algorithm, is the integral coefficient of the PID control algorithm, is the differential coefficient of the PID control algorithm, is the state error of the system;
[0064] Specifically:
[0065] ;
[0066] ;
[0067] ;
[0068] ;
[0069] in, is the total lift generated by the rotation of the four propellers, , , Four rotors in , , The torque in the direction; Indicates the height of the flight in the vertical direction. Indicates the angle of rotation towards the east direction. Indicates the angle of rotation towards due south. Indicates the angle of the quadrotor's rotation from west to east.
[0070] Step 2: Design a nonlinear update strategy based on the PID controller.
[0071] In the embodiment of the present invention, a nonlinear update strategy is designed to enhance the ability of the existing optimization algorithm to find the optimal solution.
[0072] In the embodiment of the present invention, Figure 3 As shown in the figure, the improved beetle swarm optimization algorithm optimizes the parameters of the PID controller, randomly initializes the population position X, and calculates the cost function ; Record the best individual position P and the global best position G of the beetle group; Update the parameters according to the design method: inertia weight , acceleration factor and , calculate the new cost function ; Update the individual best position P and the global best position G of the beetle group, and calculate the random search direction , calculate the position X of the two antennae (i.e., the right antennae and the left antennae) of the longhorn beetle group; calculate the cost function of the two antennae , determine the left and right direction of the beetle group; update the forward speed V and spatial position X of the beetle group; determine whether the current number of iterations k is less than or equal to the maximum number of iterations K. When it is determined that the current number of iterations k is less than or equal to the maximum number of iterations K, repeat the update of parameters according to the design method: inertia weight , acceleration factor and , calculate the new cost function .
[0073] The beetle swarm optimization algorithm includes:
[0074] ;
[0075] Where d is the random search direction, rands represents the random function, and D is the dimension of the population.
[0076] ;
[0077] Where X is the location of the population, is the step length, is the cost function of the right antenna of the longicorn, is the cost function of the left antenna of the longicorn.
[0078] ;
[0079] X=X+V;
[0080] Among them, V is the speed of the population moving forward, and yes A random number between , P is the best position for the individual, and G is the best position for the population.
[0081] In the embodiment of the present invention, the nonlinear updating strategy in step 2 includes:
[0082] ;
[0083] ;
[0084] ;
[0085] in, is the inertia weight in the beetle swarm optimization algorithm, and They are The minimum and maximum values of is the acceleration factor in the beetle swarm optimization algorithm, and They are The minimum and maximum values of is the acceleration factor in the beetle swarm optimization algorithm, and They are The minimum and maximum values of is a proportional coefficient of a nonlinear update strategy, n is the number of optimizations, and N is the maximum number of optimization iterations.
[0086] In the embodiment of the present invention, in the beetle swarm algorithm, the inertia weight Balances the ability of global and local search. By adjusting the inertia weight, the sensitivity of the swarm to its current speed can be controlled, thus affecting the optimization ability of the swarm. Larger inertia weights promote global exploration, while smaller inertia weights favor local exploration. Typically, larger inertia weights are used early in the optimization process to enable a broad search, while smaller weights are applied later to allow for a refined search around the local optimum. This approach ensures that the swarm conducts a more precise search around the global optimal solution without getting stuck in the local optimal solution. Figure 4 As shown, when When taking different values, the inertia weight In the initial iteration, the inertia weight Maintain a certain large value, as the number of iterations increases, the inertia weight This can ensure that the beetle group can maintain a large moving distance in the initial iteration, and search for the optimal parameters in the entire spatial solution range; as the number of iterations increases, the beetle group can basically determine the local area where the optimal solution is located. At this time, the moving distance of the beetle group should be reduced to ensure that the beetle group can search for the optimal solution in a local range.
[0087] In the beetle swarm algorithm, the group searches for the optimal solution by sharing information between individuals. and Controls the attraction of the beetle group to its individual best position and the global best position respectively. Adjusting these factors will affect the search ability. Use larger To prioritize individual experience and expand the search space. To focus on the local search around the global optimal position. This dynamic adjustment of the acceleration factor enhances the search ability of the group, avoids falling into the local optimal solution, and helps to find the global optimal solution. Figure 5 As shown, when selecting =14 when the acceleration factor and The change curve of acceleration factor is the proportional coefficient of the individual's optimal position, which aims to pull the beetle group towards the individual; the same acceleration factor is the ratio coefficient of the optimal position of the population, and its purpose is to guide the beetle population towards the global trend. In the initial iteration, the population is expected to search all over the space, so it cannot be limited to a certain area. It should take a larger value. It should take a smaller value to ensure that the population relies on individual experience and explores a large range in the entire solution space. As the number of iterations increases, the population can basically determine the local area where the optimal solution is located in the entire solution space. At this time, the population is expected to be used to conduct more detailed exploration in the surrounding area of the optimal solution location based on the currently explored optimal solution. That is, the experience of the population's progress depends on the best results achieved by all populations so far, and the population needs to all move closer to the current best results. So It should take a smaller value. A larger value should be taken to ensure that the population relies on social experience and conducts more detailed exploration in the space near the optimal solution obtained.
[0088] Step 3: According to the nonlinear update strategy, a cost function including error terms and input terms is designed to update the population position and adjust the parameters of the PID controller.
[0089] In the embodiment of the present invention, the PID control parameters are found through the cost function, and the cost function in step 3 is in the form of:
[0090] ;
[0091] in, is the cost function of the design, , , , is the tracking error of the system, , , , They are the upward forces generated by the rotation of the four propellers of the quadrotor; , , , The relationship is:
[0092] .
[0093] In the embodiment of the present invention, the cost function not only considers minimizing the tracking error, but also considers the system input during the flight process, thereby reducing the energy consumption of the quadrotor to achieve high-performance tracking.
[0094] Each step of the embodiment of the present invention may be performed by an electronic device, which includes but is not limited to a mobile phone, a tablet computer, a portable PC, a desktop computer, etc.
[0095] In the technical solution provided by the present invention, the method includes obtaining a mathematical model of a quad-rotor unmanned aerial vehicle and designing a PID controller; designing a nonlinear update strategy based on the PID controller; designing a cost function including error terms and input terms based on the nonlinear update strategy to update the population position and adjust the parameters of the PID controller. The method quickly and accurately finds the optimal parameters of multiple groups of PID controllers, balances the capabilities of global and local searches during the optimization process, and improves the tracking performance and energy efficiency in PID control.
[0096] An embodiment of the present invention provides a computer-readable storage medium, which includes a stored program, wherein when the program is running, the electronic device where the computer-readable storage medium is located is controlled to execute an embodiment of the above-mentioned method for optimizing the control parameters of a quadrotor drone.
[0097] Figure 6 A schematic diagram of an electronic device provided by an embodiment of the present invention, such as Figure 6 As shown, the electronic device 21 includes: a processor 211, a memory 212, and a computer program 213 stored in the memory 212 and executable on the processor 211. When the computer program 213 is executed by the processor 211, the method for optimizing the control parameters of the quad-rotor drone in the embodiment is implemented. To avoid repetition, they are not described one by one here.
[0098] The electronic device 21 includes, but is not limited to, a processor 211 and a memory 212. Those skilled in the art will appreciate that Figure 6It is only an example of the electronic device 21 and does not constitute a limitation of the electronic device 21. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.
[0099] The processor 211 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0100] The memory 212 may be an internal storage unit of the electronic device 21, such as a hard disk or memory of the electronic device 21. The memory 212 may also be an external storage device of the electronic device 21, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card (FlashCard), etc. equipped on the electronic device 21. Further, the memory 212 may also include both an internal storage unit of the electronic device 21 and an external storage device. The memory 212 is used to store computer programs and other programs and data required by network devices. The memory 212 may also be used to temporarily store data that has been output or is to be output.
[0101] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0102] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for optimizing control parameters of a quad-rotor drone, characterized in that: The method comprises: Step 1: Obtain the mathematical model of the quadrotor drone and design a PID controller; Step 2: Design a nonlinear update strategy based on the PID controller; Step 3: According to the nonlinear update strategy, a cost function including error terms and input terms is designed to update the population position and adjust the parameters of the PID controller; The nonlinear updating strategy in step 2 includes: ; ; ; in, is the inertia weight in the beetle swarm optimization algorithm, and They are The minimum and maximum values of is the acceleration factor in the beetle swarm optimization algorithm, and They are The minimum and maximum values of is the acceleration factor in the beetle swarm optimization algorithm, and They are The minimum and maximum values of is a proportional coefficient of a nonlinear update strategy, n is the number of optimizations, and N is the maximum number of optimization iterations; The cost function in step 3 is in the form of: ; in, is the cost function of the design, , , , is the tracking error of the system, , , , They are the upward forces generated by the rotation of the four propellers of the quadrotor; , , , The relationship is: 。 2. The method according to claim 1, characterized in that The mathematical model in step 1 includes: ; Among them, the take-off position of the quadcopter is taken as the origin. Indicates the distance traveled in the east direction. Indicates the speed in the east direction. represents the acceleration in the east direction; Indicates the distance traveled in the south direction. Indicates the speed in the south direction. represents the acceleration in the south direction; Indicates the height of the flight in the vertical direction. Indicates the speed of flying upward in the vertical direction. Indicates the acceleration of flying upward in the vertical direction; Indicates the angle of rotation towards the east direction. represents the angular velocity of rotation toward the east direction, represents the angular acceleration of rotation toward due east; Indicates the angle of rotation towards due south. represents the angular velocity of rotation toward due south, represents the angular acceleration of rotation toward due south; Indicates the angle of rotation of the quadrotor from west to east. represents the angular velocity of the quadrotor rotating from west to east, represents the angular acceleration of the quadrotor rotating from west to east; are the overall mass and arm length of the quadrotor respectively; is the sum of the speeds of the four propellers; , and Four rotors in , , Coefficient of moment of inertia in direction; , and Four rotors in , , Directional fuselage drag coefficient; , and Four rotors in , , Fuselage damping moment coefficient in direction; is the total lift generated by the rotation of the four propellers, , , Four rotors in , , The torque in the direction; Decompose the mathematical model into two subsystem models, including position subsystem and attitude subsystem; The expression of the position subsystem is: ; The expression of the attitude subsystem is: ; In the quadrotor system, the attitude subsystem serves as the inner loop and the position subsystem serves as the outer loop.
3. The method according to claim 1, characterized in that The algorithm of the PID controller in step 1 is: ; in, is the proportional coefficient of the PID control algorithm, is the integral coefficient of the PID control algorithm, is the differential coefficient of the PID control algorithm, is the state error of the system; Specifically: ; ; ; ; in, is the total lift generated by the rotation of the four propellers, , , Four rotors in , , The torque in the direction; Indicates the height of the flight in the vertical direction. Indicates the angle of rotation towards the east direction. Indicates the angle of rotation towards due south. Indicates the angle of the quadrotor's rotation from west to east.
Citation Information
Patent Citations
Rotor unmanned aerial vehicle autonomous path planning method based on Tiancattle swarm algorithm
CN115903888A
Mobile robot trajectory tracking method, storage medium and mobile robot
CN116520823A