Unmanned aerial vehicle dynamic PID tuning method and system based on heterovariance Bayesian optimization
Through the two-stage optimization strategy of heteroscedastic Bayesian optimization, the problem of insufficient noise processing and robustness in drone trajectory tracking is solved, and efficient trajectory tracking accuracy and robustness are improved, which is suitable for dynamic environments.
Patent Information
- Application Number
- CN202510524843.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2045-04-24
AI Technical Summary
The existing UAV trajectory tracking control methods have shortcomings in dealing with noise characteristics and robustness in dynamic environments. Traditional PID control relies on manual parameter adjustment efficiency, model-dependent methods have high computing resources, and Bayesian optimization-based methods cannot effectively handle heteroscedastic noise and are prone to fall into local optimization.
Using a two-stage optimization strategy based on heteroscedastic Bayesian optimization, the initial parameters are quickly determined and finely optimized through heteroscedastic noise modeling and Gaussian process regression to adapt to noise changes in dynamic environments, and optimize parameters based on the expected improvement criteria.
It significantly improves the accuracy and robustness of drone trajectory tracking, reduces the computing resource requirements, is suitable for complex dynamic environments, and is better than traditional methods.
Smart Images

Figure CN120406497A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of UAV control, and relates to a UAV dynamic PID tuning method and system based on heteroscedastic Bayesian optimization. Background Art
[0002] The field of UAV trajectory tracking control mainly includes traditional PID control methods, model-based controllers, and learning-based control methods. The classic proportional-integral-differential (PID) control method is widely used in the attitude stabilization and trajectory tracking tasks of UAVs due to its simple structure and easy implementation. However, this method is difficult to effectively handle the nonlinear characteristics of the UAV dynamics system and external disturbances, and performance optimization requires a large amount of manual parameter tuning, which limits its applicability in complex dynamic environments.
[0003] Model-based control methods aim to overcome the limitations of traditional PID methods, such as nonlinear model predictive control (NMPC) and model predictive path integral control (MPPI). The NMPC method improves the UAV navigation and dynamic obstacle avoidance capabilities by optimizing the real-time prediction model, while the MPPI method realizes real-time trajectory optimization through path integration, improving the flight efficiency of UAVs in obstacle-dense environments. However, the implementation of these methods requires a large amount of computing resources and highly depends on the accuracy of the system model, resulting in poor performance when the model is uncertain or the external environment changes frequently.
[0004] In recent years, learning-based methods have gradually received attention. Typically, deep reinforcement learning enhances the control performance and stability of UAVs in dynamic environments in a data-driven manner. Such methods reduce the dependence on accurate system models, but there are problems of requiring large-scale training data and computing resources, and it is difficult to quickly respond to the dynamic changes of trajectories or environments.
[0005] To address the above problems and balance computational efficiency and performance, existing research has proposed combining traditional PID controllers with nonlinear dynamic compensation mechanisms, such as sliding mode control (SMC) and Bayesian optimization (BO). Among them, the BO method effectively improves the PID controller parameter optimization performance by combining Gaussian process (GP) modeling. However, this method still has two key deficiencies: one is that it generally assumes that the system noise has homoscedastic characteristics and cannot effectively handle heteroscedastic noise caused by dynamic disturbances and sensor errors; the other is that the single-stage optimization strategy prematurely fine-tunes the parameters when the initial error is large, easily falling into local optima and reducing the overall accuracy and robustness of the control.
[0006] Therefore, it is necessary to solve the problem of how to efficiently process heteroscedastic noise in a dynamic environment to improve the accuracy and robustness of the PID controller and expand its application in the actual environment. The present invention proposes a dynamic PID tuning method based on heteroscedastic Bayesian optimization (HBO) to overcome the limitations of existing methods. Summary of the Invention
[0007] In view of this, the purpose of the present invention is to provide a dynamic PID tuning method and system for unmanned aerial vehicles based on heteroscedastic Bayesian optimization. By modeling the input-dependent noise variance and adopting a two-stage optimization strategy, the method and system achieve more accurate trajectory tracking control of unmanned aerial vehicles, and strive to solve the following technical problems existing in the prior art: traditional PID controllers rely on manual experience for parameter tuning, resulting in low efficiency and insufficient robustness; model-dependent methods (such as LQR, MPC) are vulnerable to model mismatch; learning-based control methods (such as reinforcement learning) have high computational resource requirements; the homoscedastic noise assumption adopted by existing Bayesian optimization-based PID control methods (BO-PID) cannot effectively handle heteroscedastic noise in actual application scenarios, and its single-stage optimization strategy is prone to falling into suboptimal solutions.
[0008] To achieve the above object, the present invention provides the following technical solutions:
[0009] A dynamic PID tuning method for unmanned aerial vehicles based on heteroscedastic Bayesian optimization, the method specifically includes the following steps:
[0010] S1: Divide the unmanned aerial vehicle target trajectory tracking task into a preliminary optimization stage and a fine optimization stage;
[0011] S2: In the preliminary optimization stage, preliminarily optimize the PID controller parameters through heteroscedastic Bayesian optimization,
[0012] and quickly determine the initial parameters;
[0013] S3: In the fine optimization stage, further optimize the PID controller parameters based on the determined initial parameters;
[0014] S4: Integrate the optimization results of the preliminary optimization stage and the fine optimization stage to generate the final PID controller parameters;
[0015] In the optimization process of steps S2 and S3, a heteroscedastic noise model is introduced to explicitly model the input-dependent noise variance to more accurately reflect the uncertainty in the dynamic environment.
[0016] Furthermore, the heteroscedastic noise model includes the following steps:
[0017] 1) Assume that the noises at different input points are independent of each other, and the off-diagonal elements of the noise covariance matrix are zero;
[0018] 2) Model the diagonal elements of the covariance matrix as an input-dependent noise variance function;
[0019] 3) Use the Gaussian process regression method to parametrically estimate the noise variance function;
[0020] 4) Dynamically adjust the Gaussian process model based on the estimated noise variance to adapt to the uncertainty levels at different input points.
[0021] Furthermore, the noise variance function in the heteroscedastic noise model is defined as:
[0022]
[0023] where σ 2 min is the minimum noise variance, α is the amplitude coefficient of the noise variance, β is the regression coefficient, and φ(x) is the feature mapping function of the input parameter.
[0024] Furthermore, the two-stage optimization strategy specifically includes:
[0025] In the preliminary optimization stage, determine the parameter search range by quickly reducing the initially large errors of the system;
[0026] In the fine optimization stage, improve the stability and accuracy in a dynamic environment by reducing the minor errors of the system.
[0027] Furthermore, in the preliminary optimization stage, the objective function is the weighted sum of the position error and the angle error, defined as:
[0028] e = mean(e p ) + α·mean(e ψ )
[0029] where α is the weight parameter used to balance the position error and the angle error, e p is the position error, and e ψ is the angle error.
[0030] Furthermore, the update of the Gaussian process regression model includes the following steps:
[0031] Train the initial Gaussian process model based on the parameter sampling dataset;
[0032] Dynamically adjust the noise variance through residual analysis;
[0033] Adopt the expected improvement criterion (EI) to select the next set of parameters to be evaluated and iteratively optimize until the preset number of iterations is reached.
[0034] The present invention also provides a UAV dynamic PID tuning system based on heteroscedastic Bayesian optimization, which adopts the method described above.
[0035] The present invention also provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, it implements the UAV dynamic PID tuning method based on heteroscedastic Bayesian optimization described above.
[0036] The beneficial effects of the present invention are as follows:
[0037] Compared with the existing control methods, the HBO dynamic PID tuning method proposed by the present invention includes more accurate noise modeling and more efficient optimization strategies, which are specifically reflected in the following aspects: 1. Through heteroscedastic noise modeling, it adapts to the noise changes in the adaptive dynamic environment, significantly improving the accuracy and robustness of position and angle tracking; 2. The two-stage optimization strategy adopted targets the error characteristics in different stages, effectively avoiding the situation of premature convergence to local optima in single-stage optimization and accelerating the parameter optimization process; 3. It does not rely on large-scale pre-training data and can directly perform online parameter optimization, greatly reducing the computational resource requirements; 4. It is applicable to a variety of complex trajectories and dynamic interference scenarios, showing performance advantages superior to traditional PID, MPC, and existing Bayesian optimization methods.
[0038] Other advantages, objectives, and features of the present invention will be described to some extent in the subsequent specification, and to some extent, will be obvious to those skilled in the art based on the study of the following text, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following specification. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be described in detail preferably with reference to the accompanying drawings, where:
[0040] Figure 1 is the overall framework of the algorithm of the present invention and the flowchart of parameter optimization;
[0041] Figure 2 is the schematic diagram of the pseudocode of the method proposed by the present method;
[0042] Figure 3 is the tracking result diagram of different algorithms for three trajectories in the simulation experiment;
[0043] Figure 4 is the tracking error using different noise models;
[0044] Figure 5 is the tracking error using different optimization strategies;
[0045] Figure 6 Comparison of trajectories generated using different controllers in the real - machine experiment Detailed implementation manners
[0046] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings
[0047] Figure 1 For the overall framework of the algorithm of the present invention and the parameter optimization flowchart, as Figure 1 shown, for a given target trajectory T ref , the optimization process is divided into two stages
[0048] In stage 1 (preliminary optimization stage), the PID parameters Ξ1 are quickly optimized by Heteroscedastic Bayesian Optimization (HBO).
[0049] Specifically, the objective function is defined as the weighted sum of the position error e p and the angle error e ψ :
[0050] e = mean(e p ) + α·mean(e ψ ) (1)
[0051] In the formula, α is the weight parameter, which is used to balance the position error and the angle error. In stage 2 (fine - tuning optimization stage), with the parameters optimized in stage 1 as the initial value, further fine - tuning is performed to obtain the parameters The optimization results of the two stages are fused to finally obtain the optimal parameters Ξ * :
[0052]
[0053] Furthermore, the implementation of the Heteroscedastic Bayesian Optimization (HBO) algorithm is shown in Figure 2 the pseudo - code. The specific steps include: First, construct a Gaussian process regression model GP for predicting the mapping relationship between parameters and errors, and a heteroscedastic noise model ò for modeling the uncertainty of errors. Then, perform initial parameter sampling, randomly sample an initial set of controller parameters from the parameter search space S. For each set of parameters Ξ i sampled initially, execute the UAV trajectory tracking simulation task, and calculate the error e i = f(Ξ i , T ref ). An initial data set can be obtained according to the set of sampled parameters and errors. Based on the data set D, pre - train the initial Gaussian process model GP
[0054] Next, enter the main loop optimization process (a total of iterations are performed). Each iteration executes the following steps: Define the difference between the observation error e(Ξ) and the GP prediction error as the residual Use the residual of the error to train the heteroscedastic noise model ò, thereby updating the noise variance corresponding to each input parameter: σ ν = ò(Ξ), where the noise variance model is defined as:
[0055] σ ν (Ξ) = z·exp(βρ(Ξ)) + ζ (3)
[0056] In the formula, is the regression coefficient, ζ≥0 is the minimum noise variance, z controls the overall amplitude of the noise variance, and ρ(Ξ) is the feature mapping function of the input parameter.
[0057] According to σ ν Update the noise variance of the Gaussian process model and retrain the GP model. Then use the Expected Improvement (EI) criterion to select the next parameter to be evaluated: Ξ j = EI(GP, e * ), and use the new parameter Ξ j to execute the UAV trajectory task in the simulation, and obtain the average error e j of the trajectory tracking process to evaluate the new parameter. Finally, add the new parameter Ξ j and its corresponding average error e j to the dataset D = D ∪ {(Ξ j , e j )}.
[0058] Repeat the above steps. After completing n iterations, select the parameter with the minimum error as the final optimal parameter.
[0059] This embodiment uses the PyBullet physical simulation platform in the Python 3.8 environment to conduct simulation experiment verification on the trajectory tracking control of a quadrotor UAV. The specific physical parameters of the simulated UAV are: the mass of the UAV is 27 grams, the gravitational acceleration is 9.81 m / s 2 , the arm length is 3.97 cm, the moments of inertia along the X and Y axes are 1.40×10 -5 kg·m 2 , the moment of inertia along the Z axis is 2.17×10 -5 kg·m 2 , the thrust coefficient is 2.88×10 -8 kg·m / rad 2 , the torque coefficient is 7.24×10 -10 kg·m2 / rad 2 The motor drag coefficient is 0.02 s, the motor speed coefficient is 2.81×10 -2 rad, the motor offset is 426.24 rad / s, and the maximum PWM value is set to 65535 Hz. The simulation time step is set to Δt = 0.01 s. The simulation results are shown in Table 1. The proposed HBO-PID method in the present invention shows better performance than the traditional PID, LQR, MPC, TD3, RS-PID, and BO-PID methods on all trajectories. Under the elliptical trajectory, the position error of the HBO-PID method is 0.137 m, which is reduced by 24.7% to 42.9% compared with the reference method, and the angle error is 0.323°, with a reduction range reaching 40.9% to 78.4%. Similar performance advantages are also shown under other trajectories.
[0060] The experiment designed three typical trajectories: elliptical trajectory, four-leaf clover trajectory, and spiral trajectory, and the tracking duration for each trajectory is 50 seconds. To quantify the performance, the position error e p and the angle error e ψ are introduced as evaluation indicators:
[0061]
[0062] The simulation results are shown in Table 1 and Figure 3 as follows. The proposed HBO-PID method in the present invention is significantly superior to the traditional PID, LQR, MPC, TD3, RS-PID, and BO-PID methods in terms of position and angle errors. For example, on the elliptical trajectory, the position error is 0.137 m, which is reduced by 24.7% to 42.9% compared with the traditional method, and the angle error is reduced by 40.9% to 78.4%.
[0063] Table 1 Performance comparison of different control algorithms on three trajectories
[0064]
[0065] Table 2 shows the physical parameters of the quadrotor aircraft used in the simulation of this embodiment.
[0066] Parameter name Symbol Size Unit Mass m 27 g Acceleration of gravity g 9.81 <![CDATA[m / s 2 > Arm length L 3.97 cm Moment of inertia about X-axis <![CDATA[J x > <![CDATA[1.40×10 -5 > <![CDATA[kg·m 2 > Moment of inertia about Y-axis <![CDATA[J y > <![CDATA[1.40×10 -5 > <![CDATA[kg·m 2 > Moment of inertia about Z-axis <![CDATA[J z > <![CDATA[2.17×10 -5 > <![CDATA[kg·m 2 > Thrust coefficient <![CDATA[C f > <![CDATA[2.88×10 -8 > <![CDATA[kg·m / rad 2 > Moment coefficient <![CDATA[C τ > <![CDATA[7.24×10 -10 > <![CDATA[kg·m 2 / rad 2 > Motor drag coefficient <![CDATA[T m > 0.02 s Motor speed coefficient <![CDATA[k m > <![CDATA[2.81×10 -2 > rad Motor offset <![CDATA[b m > 426.24 rad / s PWM maximum value <![CDATA[h max > 65535 Hz
[0067] Table 2 Physical parameters of the quadrotor aircraft used in the simulation
[0068] To verify the actual effect of the method of the present invention, the present invention conducts experimental verification on a real aircraft platform. The experimental platform uses a quadrotor UAV with a mass of 800 grams, a maximum thrust of 2.99 Newtons, a minimum thrust of 0.22 Newtons, the spatial size of the motion capture system is 6×4×3 meters, and the sampling frequency is 100 Hz.
[0069] The real - machine experiments were carried out to track the elliptical trajectory, four - leaf clover trajectory and spiral trajectory respectively. The experimental results are shown in Table 3. The method of the present invention (HBO - PID) has significantly lower average position error and average angle error in the real environment than the BO - PID method. Among them, the average position error is reduced by 61.2%, and the average angle error is reduced by 34.7%, which proves the excellent accuracy and robustness of the method of the present invention in practical applications.
[0070] Table 3 Performance comparison of different control algorithms on three trajectories in real - machine experiments
[0071]
[0072] This embodiment further verifies the effectiveness of the proposed heteroscedastic noise model and two - stage optimization strategy through ablation experiments. As Figure 4 shown, using the exponential heteroscedastic noise model is significantly better than the polynomial model. Especially under the spiral trajectory, the position error and angle error are reduced by 26.5% and 39.3% respectively. In addition, as Figure 5 shown, compared with the single - stage optimization strategy, the two - stage optimization strategy performs significantly better when the initial error is large. Especially in the four - leaf clover trajectory, the angle error is reduced by 60.3%, verifying the effectiveness of the two - stage strategy in avoiding falling into local optimal solutions. The above embodiments clearly illustrate the significant advantages of the present invention in improving the trajectory tracking accuracy and robustness of UAVs.
[0073] In summary, in this embodiment, in order to verify the effectiveness of the present invention, the present invention conducts experimental evaluations on three typical UAV trajectories (elliptical trajectory, four - leaf clover trajectory and spiral trajectory). The benchmark methods used include traditional PID, linear quadratic regulator (LQR), model predictive control (MPC), deep reinforcement learning (TD3), random search PID (RS - PID) and traditional Bayesian optimization PID (BO - PID). It can be seen from the experimental results that the method proposed by the present invention is significantly better than all benchmark methods in terms of both position error and angle error.
[0074] Specifically, the position tracking error of the present invention on the elliptical trajectory is 0.137 meters, which is reduced by 24.7%, 25.9%, 39.4%, 41.2%, 41.5% and 42.9% compared with TD3 (0.182 meters), BO - PID (0.185 meters), RS - PID (0.226 meters), PID (0.233 meters), MPC (0.234 meters) and LQR (0.240 meters) respectively. In addition, the improvement in the angle tracking accuracy of the present invention is more significant, and the accuracy improvement range reaches 40.9% to 78.4%.
[0075] The effectiveness of the proposed heteroscedastic noise model and two-stage optimization strategy is verified through ablation experiments. Under three types of trajectories, the exponential noise model proposed in the present invention shows obvious advantages compared with the polynomial noise model. For example, under the spiral trajectory, the position error is reduced by 26.5% and the angle error is reduced by 39.3%. At the same time, the two-stage optimization strategy proposed in the present invention also shows obvious performance improvement compared with the single-stage optimization strategy, especially in terms of angle tracking accuracy. For example, under the four-leaf clover trajectory, the angle error is reduced from 3.342° to 1.328°, and the improvement amplitude reaches 60.3%.
[0076] Further actual flight experiments also prove the practical value of the present invention. Compared with the traditional BO-PID method in the real environment, the present invention reduces the average position error by 61.2% and the average angle error by 34.7%, showing excellent robustness and accuracy advantages in various complex dynamic environments. Figure 6 Comparison of trajectories generated by different controllers in the real aircraft experiment.
[0077] Although the implementation process of the present invention is mainly evaluated based on the UAV trajectory tracking scenario, the proposed method is also applicable to control tasks in other dynamic environments, such as robot navigation, autonomous driving, and industrial automation control, etc., and has a wide application prospect.
[0078] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified without departing from the purpose and scope of the present technical solution, and they should all be covered within the scope of the claims of the present invention.
Claims
1. A dynamic PID tuning method for unmanned aerial vehicles based on heteroscedastic Bayesian optimization, characterized in that: The method specifically includes the following steps: S1: Divide the UAV target trajectory tracking task into a preliminary optimization stage and a fine optimization stage; S2: In the preliminary optimization stage, preliminarily optimize the PID controller parameters through heteroscedastic Bayesian optimization to quickly determine the initial parameters; S3: In the fine optimization stage, further optimize the PID controller parameters based on the determined initial parameters; S4: Integrate the optimization results of the preliminary optimization stage and the fine optimization stage to generate the final PID controller parameters; During the optimization processes of steps S2 and S3, introduce a heteroscedastic noise model for explicitly modeling the input-dependent noise variance to more accurately reflect the uncertainties in the dynamic environment.
2. The method for dynamically tuning the PID of an unmanned aerial vehicle based on heteroscedastic Bayesian optimization according to claim 1, wherein: The heteroscedastic noise model includes the following steps: 1) Assume that the noises at different input points are independent of each other, and the non-diagonal elements of the noise covariance matrix are zero; 2) Model the diagonal elements of the covariance matrix as an input-dependent noise variance function; 3) Use the Gaussian process regression method to parametrically estimate the noise variance function; 4) Dynamically adjust the Gaussian process model based on the estimated noise variance to adapt to the uncertainty levels at different input points.
3. A method for dynamic PID tuning of an unmanned aerial vehicle based on heteroscedastic Bayesian optimization according to claim 2, characterized in that: The noise variance function in the heteroscedastic noise model is defined as: Among them, σ 2 min is the minimum noise variance, α is the amplitude coefficient of the noise variance, β is the regression coefficient, and φ(x) is the feature mapping function of the input parameter.
4. The dynamic PID tuning method for unmanned aerial vehicles based on heteroscedastic Bayesian optimization according to claim 3, wherein: The two-stage optimization strategy specifically includes: In the preliminary optimization stage, determine the parameter search range by quickly reducing the initial large error of the system; In the fine optimization stage, improve the stability and accuracy in the dynamic environment by reducing the subtle errors of the system.
5. A method for dynamic PID tuning of an unmanned aerial vehicle based on heteroscedastic Bayesian optimization according to claim 4, characterized in that: In the preliminary optimization stage, the objective function is the weighted sum of the position error and the angle error, defined as: e = mean(e p ) + α·mean(e ψ ) where α is a weight parameter used to balance the position error and the angle error, e p is the position error, and e ψ is the angle error.
6. The method for dynamically tuning the PID of an unmanned aerial vehicle based on heteroscedastic Bayesian optimization according to claim 5, characterized in that: The update of the Gaussian process regression model includes the following steps: Train the initial Gaussian process model based on the parameter sampling data set; Dynamically adjust the noise variance through residual analysis; Adopt the expected improvement criterion (EI) to select the next set of parameters to be evaluated and iteratively optimize until the preset number of iterations is reached.
7. A dynamic PID tuning system for unmanned aerial vehicles based on heteroscedastic Bayesian optimization, characterized in that: The system adopts the method described in any one of claims 1 to 6.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the UAV dynamic PID tuning method based on heteroscedastic Bayesian optimization described in any one of claims 1 - 6.
Citation Information
Patent Citations
Multi-credibility data fusion method based on heterovariance Gaussian process regression
CN116822214A
PID control parameter setting method, terminal and medium
CN118377216A
Unmanned aerial vehicle control method and system
CN118534932A
Bluetooth transmission speed test method and system
CN118573610A
Method and device for determining a control strategy for a technical system
EP3748556A1
Cited By
PID (Proportion Integration Differentiation) parameter optimization method for reducing motion control position deviation uncertainty
CN121187221A