A UAV Attitude Control Method Based on Motor State Disturbance Compensation
By using a motor state disturbance compensation method, and utilizing a load identification module and a feedforward neural network to compensate for wind disturbances in real time, the problem of feedback control lag in UAV attitude control is solved, achieving fast and stable attitude control.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-31
- Publication Date
- 2026-03-13
AI Technical Summary
Existing UAV attitude control strategies rely on feedback mechanisms, which leads to control lag and insufficient robustness when facing high-frequency and sudden disturbances. In particular, it is difficult to achieve fast and stable attitude control in windy environments.
By using a motor state disturbance compensation method, the load identification module identifies wind disturbances in real time, and the compensation value is calculated by combining the feedforward neural network to realize feedforward compensation closed-loop control, thereby improving the system's response speed and stability under disturbance conditions.
It significantly improves the response speed and stability of UAVs in windy and turbulent environments, breaks through the bottleneck of lag in feedback control, and achieves fast and stable attitude control.
Smart Images

Figure CN121433305B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of unmanned aerial vehicle (UAV) flight control technology, and in particular to a UAV attitude control method based on motor state disturbance compensation. Background Technology
[0002] Quadrone drones fly by generating lift through motors driving propellers. By controlling the different speeds of the four motors, the lift is directed in different directions, and the drone is propelled by the component force in each direction. Currently, various control strategies are widely used in quadcopter drones, each with its own unique implementation principles.
[0003] PID controllers (Proportional-Integral-Derivative control) are the most widely used method. Their implementation principle is as follows: First, the error between the desired attitude angle and the current feedback attitude angle is calculated. Then, proportional (P), integral (I), and derivative (D) operations are performed on this error signal, and the linear combination of these three terms is output as the basic control torque. Specifically, the proportional term provides a response proportional to the instantaneous value of the error, determining the system's response speed; the integral term accumulates historical errors, aiming to eliminate steady-state error; and the derivative term reflects the rate of change of the error, playing a damping role in suppressing overshoot and improving system stability. Finally, the torque command output by the controller is distributed to each motor, generating the required roll, pitch, or yaw torque through speed differential.
[0004] The core idea of Active Disturbance Rejection Control (ADRC) is to define the unknown parts of the system model and external disturbances as a unified "total disturbance" and to observe and compensate for it in real time. In attitude control, it uses a Tracking Differentiator (TD) to arrange a smooth transition process for the desired attitude command; an Extended State Observer (ESO) dynamically estimates the total disturbance in the attitude loop that cannot be described by a linear model (including model uncertainty, aerodynamic effects, and external wind torque); and Nonlinear State Error Feedback (NLSEF) generates an initial control quantity based on the error between the command arranged by the TD and the system state observed by the ESO. Finally, the total disturbance estimated by the ESO is actively subtracted from the control quantity, thereby compensating the complex nonlinear attitude dynamics system into a simplified integral cascade system that is easy to control, significantly enhancing the robustness of the controller.
[0005] A Linear Quadratic Regulator (LQR) is an optimization control strategy based on a state-space model. When designing an attitude LQR controller, the attitude dynamics model needs to be linearized near the operating point, constructing a quadratic performance index that includes all state variables (typically attitude angles and body angular velocities) and control inputs (motor commands). An optimal state feedback gain matrix is obtained by solving the Riccati equations. The controller calculates the optimal control torque in real time by multiplying this gain matrix by the current actual state vector. This torque achieves a preset optimal balance between system dynamic performance (such as response speed) and control energy consumption. Furthermore, Model Predictive Control (MPC) generates control commands by solving an open-loop optimal control problem in a finite-time domain online; Sliding Mode Control (SMC), on the other hand, designs a specific sliding surface and constructs a control law that forces the system state trajectory to reach and maintain motion on that sliding surface within a finite time, thereby achieving invariance to parameter perturbations and external disturbances.
[0006] While the aforementioned controllers have been widely used in UAV attitude control, they still have certain shortcomings. First, all of these controllers rely on feedback mechanisms, meaning they control based on attitude errors. This inevitably introduces a lag, meaning the controller only functions after a system response. Furthermore, each controller has its own limitations, resulting in significantly insufficient control performance under specific conditions.
[0007] The response of a PID controller lags completely behind the generation of errors. When rapid disturbances such as lateral winds affect the aircraft, the controller must wait for the attitude angle and angular velocity sensors to detect the deviation before it can begin to respond. This inherent delay inevitably leads to tracking overshoot and steady-state oscillations when the system is subjected to high-frequency, sudden disturbances. Reducing the control gain to improve stability would sacrifice response speed and control accuracy, creating a contradiction.
[0008] While the Extended State Observer (ESO) of Active Disturbance Rejection Control (ADRC) can estimate and compensate for the "total disturbance," its observation behavior is essentially a dynamic estimation process. The ESO requires time to converge to the true disturbance value, which means there is still a compensation delay in the initial response phase to abrupt disturbances. Furthermore, the observer's performance is heavily dependent on its bandwidth setting; increasing the bandwidth can accelerate estimation but amplifies sensor noise, presenting a trade-off for practical implementation.
[0009] Linear Quadratic Regulators (LQRs) heavily rely on accurate mathematical models of the system. Since unmanned aerial vehicle (UAV) systems are time-varying, their dynamic parameters change during actual flight due to factors such as mechanical deformation and variations in temperature and humidity affecting system state. Furthermore, complex aerodynamic effects (such as wind disturbances) are difficult to describe with accurate linear models. Therefore, LQRs based on fixed models exhibit significantly reduced robustness and performance when faced with unmodeled dynamics and external disturbances, failing to achieve theoretically optimal control.
[0010] While Model Predictive Control (MPC) can explicitly handle constraints, its massive online computational demands pose a challenge to onboard computing resources, and its performance is also limited by the accuracy of the predictive model. Sliding Mode Control (SMC), though known for its strong robustness, suffers from inherent chattering issues that can exacerbate actuator wear and potentially induce unmodeled high-frequency dynamics, thereby affecting flight quality.
[0011] In summary, the core of existing UAV attitude control strategies relies on feedback correction of existing attitude errors. This passive response mechanism leads to inherent control lag, limiting the system's ability to handle high-frequency, abrupt disturbances (such as lateral wind disturbances) and hindering further improvements in attitude control. Furthermore, various controllers relying on feedback loops are also constrained by model dependence, observation latency, computational complexity, or chattering issues. Summary of the Invention
[0012] This invention aims to overcome the above-mentioned defects of the prior art and provide a UAV attitude control method based on motor state disturbance compensation. This method uses a motor state load identification module to calculate the effect of disturbance, and in conjunction with a feedforward neural network, calculates the compensation value into the controller to realize feedforward compensation closed-loop control, thereby improving the system stability of the UAV in wind disturbance environment. At the same time, relying on the powerful fitting ability of the neural network, an accurate system model can be established to effectively deal with the time-varying and nonlinear characteristics of the system.
[0013] To achieve the above objectives, the present invention adopts the following technical solution:
[0014] A method for UAV attitude control based on motor state disturbance compensation includes the following steps:
[0015] Step 1: The position controller calculates the desired thrust, desired roll angle, and desired pitch angle in the body coordinate system based on the desired position in the input spatial rectangular coordinate system and the actual position and speed of the quadcopter UAV collected in real time. The desired thrust is then input to the mixer, and the desired roll angle and desired pitch angle are input to the attitude feedback controller.
[0016] Step 2: The attitude feedback controller calculates the feedback torque based on the input desired yaw angle, the desired roll angle, the desired pitch angle, and the actual Euler angles and actual body angular velocity of the quadcopter UAV.
[0017] Step 3: The load identification module calculates the torque deviation of each motor caused by wind force based on the target speed, actual speed and actual current of each motor under wind disturbance, and calculates the estimated disturbance torque based on the torque deviation.
[0018] The feedforward neural network module uses a trained RBF neural network to calculate the current torque residual estimate, and performs torque synthesis on the estimated disturbance torque and the current torque residual estimate to obtain the torque feedforward compensation amount.
[0019] Step 4: Add the feedback torque to the torque feedforward compensation to generate the total control torque;
[0020] Step 5: The mixer calculates the target speed of each motor based on the desired tension and the total control torque. The motor system converts the target speed into the actual speed and inputs it into the control distributor. The control distributor drives each motor to move in order to compensate for the influence of wind disturbance on the attitude of the UAV.
[0021] Since external disturbances (such as wind disturbances) directly affect the aircraft and are immediately reflected in the motor load state, this change precedes the overall attitude response of the UAV. Therefore, this invention proposes a UAV attitude control method based on motor state disturbance compensation. This method uses a load identification module to identify the motor state in real time to detect and quantify the effect of disturbances in advance, and then uses a feedforward channel to actively and proactively compensate for the disturbances. This, combined with feedback control, significantly improves the system's response speed and stability accuracy in disturbed environments, fundamentally overcoming the lag bottleneck of UAV feedback control. This invention achieves rapid, stable, and precise attitude control of the UAV by real-time sensing of motor load changes to predict and compensate for wind disturbances, fundamentally overcoming the response delay problem caused by measurement and calculation lag in traditional pure feedback control. Attached Figure Description
[0022] Figure 1 This is a flowchart of a UAV attitude control method based on motor state disturbance compensation according to an embodiment of the present invention;
[0023] Figure 2 This is a schematic diagram of the feedforward compensation closed-loop control principle for UAVs.
[0024] Figure 3 This is a schematic diagram of a brushless motor load control model.
[0025] Figure 4This is a schematic diagram of the drone's fuselage.
[0026] Figure 5 This is a schematic diagram showing the positional relationship between the spatial rectangular coordinate system and the body coordinate system;
[0027] Figure 6 Flowchart for implementing feedforward compensation in RBF neural networks;
[0028] Figure 7 This is a communication diagram of the motor system;
[0029] Figure 8 This is a flowchart of the FOC drive algorithm for a brushless motor. Detailed Implementation
[0030] The technical solution of the present invention will now be described in detail with reference to the accompanying drawings and preferred embodiments.
[0031] like Figure 1 As shown, this embodiment provides a UAV attitude control method based on motor state disturbance compensation, including the following steps:
[0032] Step 1: The position controller determines the desired position in the input spatial rectangular coordinate system. And the real-time acquisition of the actual position of the quadcopter drone. and actual speed The desired tension in the body coordinate system was calculated. Expected roll angle and desired pitch angle and the desired tensile force The input is sent to the mixer to determine the desired roll angle. and the desired pitch angle Input is sent to the attitude feedback controller.
[0033] First, the UAV is modeled to obtain a UAV model. By improving the existing UAV structural model, the attitude control accuracy and anti-interference ability of the UAV under wind disturbances are effectively improved.
[0034] Based on the flight principles of UAVs and the relationships between their components, models can be established for analysis. These models include: a power unit model, a control efficiency model, an attitude dynamics model, an attitude kinematics model, a position dynamics model, and a position kinematics model. The power unit model describes the characteristics of the motor system, receiving speed commands and outputting speed. The control efficiency model describes the lift effect generated by motor rotation and the force and torque produced on the airframe. The attitude dynamics model describes the angular acceleration effect caused by the torque acting on the airframe, while the attitude kinematics model describes the angular effect produced by angular acceleration. Similarly, the position dynamics model describes the acceleration effect produced by force, while the position dynamics model describes the velocity and displacement effects produced by acceleration.
[0035] Since the motion of a drone relies on adjusting the lift component, closed-loop attitude control of a quadcopter drone is fundamental to implementing various complex motion commands. The mechanism involves calculating the drone's attitude angles using an inertial measurement unit (IMU), then changing the motor speeds via an attitude closed-loop controller to orient the drone into the corresponding attitude and achieve specific motion effects. However, a quadcopter drone is inherently an underactuated system. Its inputs are the rotational speeds of its four motors, while its outputs are the drone's attitude, comprising six state variables: rotation angles around coordinate axes and displacements along those axes. Modeling this system typically requires separating each input / output channel, linearizing it near the equilibrium point, and then combining this with the drone's dynamics and kinematics model to obtain its transfer function. The controller is then designed based on this transfer function.
[0036] The principle of the feedforward compensation closed-loop control circuit for UAVs is as follows: Figure 2 As shown, where the given input is the desired position. and desired yaw angle The position controller determines the desired position based on the spatial rectangular coordinate system. Actual location and actual speed Find the desired tension in the body coordinate system. Expected roll angle and desired pitch angle , will the expected Actual Euler angles and the actual angular velocity of the machine body The input is fed into the attitude feedback controller to determine the desired triaxial motion. The target speeds of the four motors are calculated by the mixer. The actual speed is obtained through the motor system. The input is sent to the control distributor, and the output of the control distributor is the actual tension. Triaxial torque Finally, the data is input into the quadcopter drone, and after decoupling from attitude dynamics, attitude kinematics, and position dynamics and position kinematics, the actual drone pose is output.
[0037] Wind disturbances occur at two locations: the motor and the blades, generating additional disturbances. Secondly, quadcopter drones generate disturbance torque. Generally, the center of gravity of a drone is slightly downward, and the rotational effect caused by wind disturbance on the fuselage is much greater than the translational effect, so the influence of acceleration can be ignored.
[0038] The compensator provides state variables through a motor closed-loop model. ( To calculate the estimated disturbance torque. The residuals are calculated using the RBF neural network module, making the estimated value close to the true value.
[0039] Using the geodetic coordinate system as a reference, a spatial rectangular coordinate system is established based on the location of the aircraft. This indicates that a body coordinate system is established based on a spatial rectangular coordinate system, using... This indicates that the positional relationship between the spatial rectangular coordinate system and the body coordinate system is as follows: Figure 5 As shown, the body coordinate system Axial downward, front is Positive axis direction, right is Taking the positive axis, the positional kinematics of the quadrotor UAV system are obtained as follows:
[0040] ;
[0041] ;
[0042] in, This represents the desired velocity in the Cartesian coordinate system, which includes components in three directions: Representing the spatial rectangular coordinate system Desired velocity in the axial direction, Representing the spatial rectangular coordinate system Desired velocity in the axial direction, Representing the spatial rectangular coordinate system Desired velocity in the axial direction; Represents gravitational acceleration; Let represent the total mass of the quadcopter drone. Equations (1) and (2) are simplified to:
[0043] ;
[0044] ;
[0045] in, The lift of the propeller in the body coordinate system. For pitch angle (around) (rotation of the axis) Yaw angle (around) (rotation of the axis) For the roll angle (around) Rotation of the axis.
[0046] The attitude dynamics relationships are as follows:
[0047] ;
[0048] in, The gyro torque is equal to... ,because Its impact on the system is minimal and therefore negligible. Therefore, according to formula (5), the following relationship can be obtained:
[0049] ;
[0050] in, This represents the three-axis torque generated by lift on the drone. Let be the moment of inertia about the three axes in the body coordinate system. Let be the angular acceleration of the UAV around the three axes in the body coordinate system. Formula (6) is as follows:
[0051] ;
[0052] in, for Torque in the axial direction, for Torque in the axial direction, for Torque in the axial direction; For the body coordinate system Moment of inertia of the shaft For the body coordinate system Moment of inertia of the shaft, For the body coordinate system Moment of inertia of the shaft; For the body coordinate system Angular acceleration of the axis, For the body coordinate system Angular acceleration of the axis, For the body coordinate system Angular acceleration of the axis.
[0053] Based on the torque and lift magnitudes, the UAV system is decoupled to obtain a control distributor model, which describes the relationship between motor speed and fuselage torque. The UAV is arranged in a cross shape, and the control distributor model is as follows:
[0054] ;
[0055] in, For the total lift of the system, Let be the lift constant. The length of the boom. This is the motor torque coefficient. This is the actual speed of motor 1. This is the actual speed of motor 2. This is the actual speed of motor 3. This is the actual speed of motor 4.
[0056] Based on the above relationships, a drone model is established and used in conjunction with a controller to achieve closed-loop control.
[0057] Step 2: The attitude feedback controller adjusts the input yaw angle accordingly. The desired roll angle The desired pitch angle And the actual Euler angles of quadcopter drones and actual body angular velocity The feedback torque is calculated. .
[0058] Each loop of the UAV is implemented using PID control, and the input to the position controller is the desired position. , and actual location The difference is calculated, and the target speed value is obtained through the position loop PID controller. , speed target value Compared with actual speed The difference is calculated, and the target value of the attitude angle is obtained through the speed loop PID controller. and tension Based on this, the attitude feedback controller will With actual Euler angles The difference is calculated, and the desired angular velocity is obtained by outputting the angle loop PID controller. This value is then compared with the actual body angular velocity. The difference is calculated, and the feedback torque is obtained by the output of the angular velocity loop PID controller. .
[0059] Step 3: The load identification module calculates the torque deviation of each motor caused by wind force based on the target speed, actual speed, and actual current of each motor under wind disturbance, and calculates the estimated disturbance torque based on the torque deviation. ;
[0060] The feedforward neural network module uses a trained RBF neural network to calculate the current torque residual estimate. And the estimated disturbance torque and the current torque residual estimate Torque synthesis is performed to obtain the torque feedforward compensation. .
[0061] In this embodiment, the motor system uses sensed vector control (FOC) instead of the traditional brushless driver to perform closed-loop control of the motor. At the same time, the motor is no longer just an actuator. The motor's state variables are processed by the load identification module to calculate the magnitude of the disturbance torque, and then feedforward compensation is achieved through a neural network.
[0062] The load identification module is implemented through motor state observation and modeling. Firstly, the motor drive adopts a sensor-driven vector closed-loop control scheme, establishing a brushless motor load control model. This is based on the following voltage balance equation, torque balance equation, back electromotive force equation, and electromagnetic torque equation:
[0063] ;
[0064] ;
[0065] ;
[0066] ;
[0067] in, Indicates the supply voltage; Represents back electromotive force; Phase resistance; For phase inductance; For current; Electromagnetic torque; This is the electromagnetic torque coefficient; It is the moment of inertia; The coefficient of viscous friction (since the system rotates at high speed, this effect is minimal and can be ignored); For resistive torque; Here is the back electromotive force coefficient. Based on the above relationships, a Laplace transform is performed to obtain the complete brushless motor load control model. Combining the relationships between the controller and the load, the formula for the brushless motor load control model is as follows:
[0068] ;
[0069] in, This is the open-loop transfer function for the motor model. For phase inductance, For phase resistance, This is the Laplace operator. The brushless motor load control model uses a PI controller to complete the current loop and speed loop closed loop. The entire closed-loop scheme implementation process is as follows: [The text abruptly ends here, likely due to an incomplete sentence or missing information.] Compared with the actual speed provided by the encoder By performing differential calculations, a current reference value is obtained through a speed loop PI controller. , current reference value Compared with the actual current value The difference is calculated, and the voltage control quantity is obtained through a current loop PI controller. Voltage control quantity After driver gain Amplification yields the actual voltage. This is the actual driving voltage.
[0070] After the motor is fitted with blades, the load resistance becomes related to the motor's condition. The resistance torque is proportional to the square of the rotational speed, and the torque required to reach equilibrium gradually increases. The specific relationship is as follows: Figure 3 As shown, where, For reference speed, Using the reference current, the obtained speed error and current error are used to achieve closed-loop control of the motor through the controller. This is the actual motor speed. For the actual shaft current, Due to wind disturbance, The disturbance torque coefficient is... This is the load torque coefficient. Let be the moment of inertia of the load, and satisfy the following relationship:
[0071] ;
[0072] ;
[0073] The above relationships show that when crosswinds act on the motor system, the system's load state will change. Based on the load changes of the four motors, the magnitude of the disturbance can be calculated.
[0074] Based on the target speed, actual speed, and current of the motor, relevant parameters are calculated. Simultaneously, motor state variables and the UAV's pitch and roll torques are collected as a dataset, which is then used to train a neural network model. The parameters of the motor system are calculated through the following steps:
[0075] power supply voltage The phase inductance can be measured by measuring the battery input using a multimeter in voltage mode. and phase resistance The back electromotive force coefficient was measured using a bridge circuit. The waveform of the motor rotor during motion is acquired using an oscilloscope, and the flux linkage constant is calculated to obtain the back electromotive force coefficient. Under no-load conditions, the motor is controlled to move at low speed, and the torque magnitude is acquired using a torque meter. The shaft current value is used to obtain the electromagnetic torque coefficient. Based on this, a propeller is assembled, and in a windless environment, the motor speed is maintained in a closed-loop manner until it reaches a steady state. The rotational speed at steady state is recorded. and shaft current Ignoring the influence of friction, by collecting multiple sets of sample data and fitting multiple data points, the following relationship can be obtained:
[0076] ;
[0077] The load torque coefficient is measured using formula (16). By applying lateral wind disturbance to the motor and measuring the torque under steady-state conditions, the difference between this torque and the torque under windless conditions can be used to obtain the wind disturbance torque, i.e., the disturbance torque coefficient, as shown in the following formula:
[0078] ;
[0079] Through the above steps, the parameters of each component of the motor system are obtained. After obtaining the parameters of each component of the motor system, a wind disturbance experiment is conducted on the quadcopter UAV to collect multiple sets of sample data, including data for each motor at a given target speed. windless steady state A dataset for training the RBF neural network was constructed using shaft current and actual steady-state rotational speed in windless conditions. Based on this, wind disturbance experiments were conducted to collect the dataset; the specific steps are as follows:
[0080] The drone was fixed on a six-dimensional force platform, and the flight control target attitude angle was set to 0. A certain amount of wind disturbance was applied to the drone through an adjustable speed fan. The wind speed and torque values were recorded at this time. Multiple sets were measured and averaged to obtain the following relationship:
[0081] ;
[0082] in, The magnitude of the torque acting on the fuselage along both axes. To generate a winding The magnitude of the wind speed affected in the axial direction. To generate a winding The magnitude of the wind speed affected in the axial direction. This is the lever arm conversion factor.
[0083] Establish a dataset: Measure the state variables of each motor and the torque magnitudes in both axes of the UAV at the same moment before and after wind application. Repeat the experiment by changing the wind force to collect a sufficient number of data samples. Cover the state information of the UAV under step wind and frequency-sweeping wind conditions to ensure comprehensive test data coverage. Based on the collected dataset, calculate the load torque deviation of each motor using the following formula:
[0084] ;
[0085] ;
[0086] in, For the first Each motor at a given target speed windless steady state shaft current, For the first time collected The current value of each motor. This represents the deviation between the current and the reference. For the first Each motor at a given target speed The actual speed under windless steady-state conditions, For the first time collected The speed value of each motor, The deviation of the rotational speed from the reference value is given; based on this, the torque deviation caused by the wind force on each motor is calculated, using the following formula:
[0087] ;
[0088] in, This represents the deviation of the torque from the reference value. Based on the above values, the computer-generated torque distribution can be calculated using the following formula:
[0089] ;
[0090] ;
[0091] in, , The magnitude of the wind torque estimated for the motor model. , Let be the layout transformation coefficients fitted from the data through linear regression. The physical model estimation error is calculated according to formula (24):
[0092] ;
[0093] in, To estimate the error of the physical model.
[0094] Based on the established dataset, an RBF neural network is built, and the RBF neural network is trained using the dataset to improve the estimation accuracy.
[0095] The established RBF neural network includes:
[0096] The input layer constructs the input feature vector. We selected data from 20 adjacent sampling times in the dataset, calculated the state variables within the same time period, and calculated the normalized motor state residual vector:
[0097] ;
[0098] in, The reference torque is the torque at rest. These represent the torque deviations of each motor caused by wind force.
[0099] The hidden layer uses Gaussian radial basis functions to perform a linear transformation on the input. The formula for the Gaussian radial basis functions is:
[0100] ;
[0101] in, The width parameter determines the coverage area of the Gaussian function. It is the hidden layer center vector, corresponding to the first... One neuron. Determined using the K-means clustering method:
[0102] ;
[0103] ;
[0104] in, The number of hidden layer nodes in an RBF neural network is a hyperparameter that needs to be tuned; it's typically chosen to be 3-5 times the number of nodes in the input layer. It affects the fitting ability of the RBF neural network; too small a value leads to underfitting, while too large a value leads to overfitting and increases computational cost. It is the overlap coefficient, which is 1.0 to 2.0.
[0105] The output layer is:
[0106] ;
[0107] in, The output of the RBF neural network contains two components, namely... and , respectively represent shaft and Torque residual estimation in the axial direction; For the first The first neuron pairs with the first The contribution of each output; This is a bias term.
[0108] The adjustment objective is to minimize the network output. residual with target The root mean square error between them is the standard measurement. The optimal weights and biases are solved using the gradient descent method, with the following formula steps:
[0109] ;
[0110] ;
[0111] in, For learning rate, For the first The weight matrix at the next iteration For the first The weight matrix at the next iteration For the first The bias vector at the next iteration. For the first The bias vector at the next iteration. For the first The output error vector of each training sample. Save the network parameters. , , , The trained RBF neural network is obtained.
[0112] Online operation phase: such as Figure 6 As shown, the real-time motor status is first obtained. By calculating the windless baseline value, we obtain... Calculate each motor And thus obtain Then reconstruct the input feature vector. The RBF neural network performs forward computation and outputs the current torque residual estimate. The torque synthesis yields the following values:
[0113] ;
[0114] ;
[0115] in, Calculated respectively The magnitude of the axial wind disturbance torque is used as the basis for obtaining the torque feedforward compensation amount as follows:
[0116] ;
[0117] in, This is the torque feedforward compensation amount.
[0118] Step 4: Adjust the torque feedforward compensation amount Feedback torque output by the attitude feedback controller Add them together to generate the total control torque. .
[0119] The attitude feedback controller uses PID control, which is based on the error between the desired attitude angular velocity and the current actual attitude angular velocity. Calculate the feedback torque The calculation formula is as follows:
[0120] ;
[0121] in, This is the proportionality coefficient. These are the differential coefficients. is the integral coefficient.
[0122] Torque feedforward compensation amount With feedback torque Adding them together, we get the final control quantity, i.e., the total control torque:
[0123] ;
[0124] in, This is the total control torque.
[0125] Step 5: The mixer controls the pull force according to the desired force. and total control torque The target speed of each motor is calculated, and the motor system converts the target speed of each motor into the actual speed and inputs it into the control distributor. The control distributor drives each motor to move in order to compensate for the influence of wind disturbance on the attitude of the UAV.
[0126] This embodiment proposes a UAV attitude control method based on motor state disturbance compensation. By using a load identification module to identify the motor state in real time to proactively sense and quantify disturbances, a feedforward neural network module performs active and advanced compensation for the disturbances. This synergizes with feedback control, significantly improving the system's response speed and stability accuracy under disturbed environments, fundamentally overcoming the lag bottleneck of UAV feedback control. The proposed UAV attitude control method can be applied to disturbance observation and compensation for most UAVs, providing theoretical support for high-precision modeling of their attitude control systems. Furthermore, it can be applied to various outdoor UAV operations such as maritime search and rescue, forest fire prevention, and power line inspection, improving target search and positioning accuracy and success rate.
[0127] As a specific implementation method, the brushless motor speed closed-loop controller design involves two state variables during the control process: the motor's speed and current values. Traditional square-wave open-loop control cannot meet the requirements of this invention. Therefore, this implementation method provides a new motor system that achieves the following functions: driving the motor to rotate to the target speed, simultaneously acquiring the current actual speed and current values, and feeding back the motor's state variables to the UAV's main control system. In terms of hardware, this mainly includes the circuit design of the motor system and the design of the main control communication link for the motor system.
[0128] like Figure 7 As shown, the motor system mainly includes:
[0129] The main control chip is used to run the FOC control algorithm;
[0130] The gate driver chip is connected to the main control chip.
[0131] The power bridge circuit, composed of multiple N-MOS transistors and controlled by the gate drive circuit, is used to output three-phase drive signals to the motor to drive the motor to move; optionally, the motor is a 2212 brushless motor.
[0132] The current sampling circuit, which includes three-phase sampling resistors and a differential amplifier, is used to collect the three-phase current of the motor.
[0133] An analog-to-digital converter is used to convert the acquired analog current signal into a digital signal and output it to the main control chip.
[0134] An encoder is used to detect the position of a motor rotor to obtain the motor's rotational speed.
[0135] The main control chip is connected to the main control system of the drone through a communication interface.
[0136] Optionally, the main control chip uses an STM32F407VET6, which includes a serial communication interface, an advanced timer interface, an SPI communication interface, and ADC acquisition. The gate driver chip is a DRV8323, the N-MOS transistor is an IRFH7440, and the encoder is an AS5047P with a 6mm diameter radial magnet.
[0137] The brushless motor drive algorithm flow is as follows: Figure 8 As shown in the diagram, "BLDC" represents a brushless DC motor. This indicates that encoder data processing is used to calculate the mechanical angle of the rotor. and rotor angular velocity , used to implement and Calculation and angular velocity feedback, As a reference speed, a current reference value is obtained through a PI controller, where q represents the direction perpendicular to the rotor, and d represents the direction in the same direction as the rotor. To maximize control efficiency, the speed PI controller calculates the reference current in the q direction. Simultaneously, the reference current in the d-axis direction is... The value is 0; after passing through a two-way current loop PI controller, the voltage values in the d and q directions are obtained, and the values in the stator are obtained through RevPark transformation. Voltage values in two directions in a coordinate system Then through RevClark The voltage values are transformed to the stator three-phase coordinate system and then used in conjunction with SVPWM to obtain the three-phase voltage values. Voltage. After the motor rotates, the three-phase current values will... Transformation to stator In coordinate system, we obtain Combined with the rotor mechanical angle fed back by the encoder Solving for the d and q directions in the rotor coordinate system yields... The current closed loop is completed, and the encoder performs angle differential within the cycle to calculate the angle increment and obtain the angular velocity value. This achieves a closed-loop speed control.
[0138] The main control system of a UAV is the flight controller of a quadcopter UAV, which includes the main control circuit, communication interface, inertial measurement unit, optical flow sensor, laser ranging module, etc., and is used to communicate with the motor system and run control algorithms.
[0139] This invention correlates the motor's state parameters with the UAV's attitude, designing a controller and a disturbance analysis model. Compared to traditional control schemes, it enriches the input state information while improving the control accuracy and dynamic response characteristics of the control system.
[0140] Furthermore, the state observer, in conjunction with the error analysis network, classifies and models the disturbance factors of the system, obtains compensation quantities, and introduces them into the system. Simultaneously, it combines intelligent control strategies to achieve compensatory control, thereby improving the performance indicators and anti-interference capabilities of the attitude control process. This approach can be applied to the attitude feedback controllers of most UAV systems, providing theoretical support for their high-precision modeling.
[0141] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0142] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.
Claims
1. A method for attitude control of an unmanned aerial vehicle (UAV) based on motor state disturbance compensation, characterized in that, Includes the following steps: Step 1: The position controller calculates the desired thrust, desired roll angle, and desired pitch angle in the body coordinate system based on the desired position in the input spatial rectangular coordinate system and the actual position and speed of the quadcopter UAV collected in real time. The desired thrust is then input to the mixer, and the desired roll angle and desired pitch angle are input to the attitude feedback controller. Step 2: The attitude feedback controller calculates the feedback torque based on the input desired yaw angle, the desired roll angle, the desired pitch angle, and the actual Euler angles and actual body angular velocity of the quadcopter UAV. Step 3: The load identification module calculates the torque deviation of each motor caused by wind force based on the target speed, actual speed and actual current of each motor under wind disturbance, and calculates the estimated disturbance torque based on the torque deviation. The feedforward neural network module uses a trained RBF neural network to calculate the current torque residual estimate, and performs torque synthesis on the estimated disturbance torque and the current torque residual estimate to obtain the torque feedforward compensation amount. Step 4: Add the feedback torque to the torque feedforward compensation to generate the total control torque; Step 5: The mixer calculates the target speed of each motor based on the desired tension and the total control torque. The motor system converts the target speed into the actual speed and inputs it into the control distributor. The control distributor drives each motor to move in order to compensate for the influence of wind disturbance on the attitude of the UAV.
2. The UAV attitude control method based on motor state disturbance compensation according to claim 1, characterized in that, In step 3, the estimated disturbance torque The calculation formula is as follows: ; ; in, and They are respectively shaft and The disturbance torque of the shaft; , These are the layout conversion coefficients obtained through linear regression fitting; For the first The torque deviation of each motor is calculated using the following formula: ; ; ; in, The electromagnetic torque coefficient is... This is the load torque coefficient. For the first Each motor at a given target speed windless steady state shaft current, For the first time collected The current value of each motor. For the first Each motor at a given target speed The actual speed under windless steady-state conditions, For the first time collected The rotational speed of each motor.
3. The UAV attitude control method based on motor state disturbance compensation according to claim 2, characterized in that, Electromagnetic torque coefficient The calculation formula is as follows: ; ; in, This refers to the actual motor speed; This is the actual q-axis current; Wind disturbance; This is the disturbance torque coefficient; This is the load torque coefficient, obtained through data fitting.
4. The UAV attitude control method based on motor state disturbance compensation according to claim 2, characterized in that, The RBF neural network includes an input layer, a hidden layer, and an output layer. The input layer is a normalized motor state residual vector, and its formula is as follows: ; in, These are the windless reference torques for each motor; These represent the torque deviations of each motor caused by wind force. The hidden layer is linearly transformed using Gaussian radial basis functions; The output layer is a linear combination of the outputs of each neuron in the hidden layer, and aims to minimize the network output. residual with target Using the root mean square error between the two sides as the adjustment target, the optimal weights and biases are solved using the gradient descent method to obtain the current torque residual estimate. .
5. The UAV attitude control method based on motor state disturbance compensation according to claim 4, characterized in that, The formula for the Gaussian radial basis function is: ; in, It is the width parameter; It is the hidden layer center vector, corresponding to the first... The number of neurons was determined using the K-means clustering method: ; ; in, This represents the number of hidden layer nodes in an RBF neural network. It is the overlap coefficient.
6. The UAV attitude control method based on motor state disturbance compensation according to claim 1, characterized in that, After obtaining the parameters of each component of the motor system, a wind disturbance experiment was conducted on the quadcopter UAV, and multiple sets of sample data were collected, including data for each motor at a given target speed. windless steady state A dataset for training the RBF neural network is constructed using shaft current and actual steady-state rotational speed without wind.
7. The UAV attitude control method based on motor state disturbance compensation according to claim 1, characterized in that, The attitude feedback controller employs PID control, which adjusts the input angular velocity based on the error between the desired angular velocity and the current actual angular velocity. Calculate the feedback torque The calculation formula is as follows: ; in, , , These are the proportional coefficient, differential coefficient, and integral coefficient, respectively.
8. The UAV attitude control method based on motor state disturbance compensation according to claim 1, characterized in that, The quadcopter drones are arranged in a cross shape, and the control distributor model is as follows: ; in, For the total lift of the system, for Torque in the axial direction, for Torque in the axial direction, for Torque in the axial direction, Let be the lift constant. The length of the boom. This is the motor torque coefficient. These represent the actual speeds of the four motors.
9. The UAV attitude control method based on motor state disturbance compensation according to claim 1, characterized in that, The motor system includes: The main control chip is used to run the FOC control algorithm; A gate driver chip is connected to the main control chip; The power bridge circuit, composed of multiple N-MOS transistors, is controlled by the gate drive circuit and is used to output three-phase drive signals to the motor to drive the motor to move. The current sampling circuit, which includes three-phase sampling resistors and a differential amplifier, is used to collect the three-phase current of the motor. An analog-to-digital converter is used to convert the acquired analog current signal into a digital signal and output it to the main control chip. An encoder is used to detect the position of a motor rotor to obtain the motor's rotational speed. The main control chip is connected to the main control system of the UAV via a communication interface.
10. The UAV attitude control method based on motor state disturbance compensation according to claim 9, characterized in that, The main control chip is STM32F407VET6; the gate driver chip is DRV8323; the N-MOS transistor is IRFH7440; the encoder is AS5047P and its matching radial magnet with a diameter of 6mm; and the motor is a 2212 brushless motor.
Citation Information
Patent Citations
Anti-interference attitude control method for four-rotor unmanned aerial vehicle
CN107491081A
Quad-rotor unmanned aerial vehicle trajectory tracking control method and device, equipment and storage medium
CN121187332A