A control method for a motor in an unmanned aerial vehicle

Through the combination of deep learning models and fuzzy control rules, the problem of insufficient flight stability of drones in complex airflow environments is solved, more efficient environmental perception and motor control are achieved, and the robustness and adaptability of the system are improved.

CN119396015BActive Publication Date: 2025-06-17雷文斯(深圳)科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510005833.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-03
Publication Date
2025-06-17
Estimated Expiration
2045-01-03

AI Technical Summary

Technical Problem

The existing UAV motor control methods lack flight stability in complex airflow environments, it is difficult to respond quickly to airflow disturbances, and lack the ability to accurately identify and predict airflow disturbances.

Method used

The deep learning model is used to combine multi-dimensional input parameters (such as attitude acceleration, air pressure height change rate) to calculate the motor's target speed compensation value, and correct the PWM drive signal through fuzzy control rules to adjust the weight parameters of the deep learning model in real time.

Benefits of technology

It improves the flight stability and environmental perception capabilities of the drone in complex airflow environments, reduces the violent speed fluctuations of the motor, extends the service life of the motor, and enhances the robustness and adaptability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119396015B_ABST
    Figure CN119396015B_ABST
Patent Text Reader

Abstract

The present invention discloses a control method for a motor in a drone. By acquiring attitude data, barometric altitude data, and motor speed data during the flight of the drone, the pitch angular acceleration, roll angular acceleration, and yaw angular acceleration of the drone are calculated based on the attitude data, and it is determined whether the drone is in an airflow disturbance state. When in the airflow disturbance state, a pre-trained deep learning model is used to calculate the target speed compensation value of the motor, and the input parameters of the model include various angular accelerations, barometric altitude change rate, and the current speed of the motor. Then, in combination with preset fuzzy control rules, the correction value of the motor PWM drive signal is calculated, and the corrected drive signal is applied to the motor. At the same time, the weight parameters of the deep learning model are dynamically adjusted by real-time collecting the motor speed feedback information. The present invention can effectively improve the flight stability of the drone in a complex airflow environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of motor control, and particularly to a method for controlling a motor in an unmanned aerial vehicle (UAV). Background Art

[0002] Currently, in the actual flight process of UAVs, the PID control algorithm is generally used to achieve the speed control of the motor. This control method calculates the PWM control signal of the motor by collecting the data of the attitude sensor and combining the preset PID parameters, so as to adjust the motor speed to maintain the flight attitude of the UAV. At the same time, some improved schemes introduce an adaptive control algorithm to improve the control effect by adjusting the control parameters in real time.

[0003] However, the existing control methods have obvious deficiencies when facing a complex airflow environment. First, the parameters of the traditional PID control method are relatively fixed and it is difficult to quickly respond to sudden airflow disturbances. Second, although the adaptive control algorithm improves the control effect to a certain extent, due to the lack of accurate identification and prediction ability of airflow disturbances, its adaptability and robustness are still insufficient. Finally, the existing technologies generally ignore the influence of air pressure changes on flight stability, resulting in unsatisfactory control effects in high-altitude or environments with drastic air pressure changes.

[0004] Therefore, there is an urgent need to provide a new method for controlling the motor of a UAV. Summary of the Invention

[0005] The present application provides a method for controlling a motor in a UAV to improve the flight stability of the UAV in a complex airflow environment.

[0006] The present application provides a method for controlling a motor in a UAV, including:[[]]

[0007] Obtaining the attitude data, barometric altitude data, and the current rotational speed data of the motor during the flight of the UAV, where the attitude data includes the pitch angle, roll angle, and yaw angle;

[0008] Based on the attitude data, calculating the pitch angular acceleration, roll angular acceleration, and yaw angular acceleration of the UAV, and determining whether the current UAV is in an airflow disturbance state according to a preset threshold; when it is determined that the UAV is in an airflow disturbance state, calculating the target rotational speed compensation value of the motor based on a pre-trained deep learning model, and the input parameters of the deep learning model include: pitch angular acceleration, roll angular acceleration, yaw angular acceleration, barometric altitude change rate, and the current rotational speed of the motor;

[0009] According to the target rotational speed compensation value and in combination with a preset fuzzy control rule, calculating the correction value of the PWM drive signal of the motor;

[0010] Apply the corrected PWM drive signal to the motor, and collect the motor speed feedback information in real time, and dynamically adjust the weight parameters of the deep learning model according to the feedback information.

[0011] Further, the obtaining of the attitude data, barometric altitude data and current rotational speed data of the motor during the flight of the drone includes:

[0012] Collect the pitch angle, roll angle and yaw angle in real time through the inertial measurement unit equipped on the drone. Among them, the inertial measurement unit measures the linear acceleration and angular velocity through the accelerometer and gyroscope and uses the data fusion algorithm to generate stable attitude data;

[0013] Obtain the ambient air pressure through the barometer and perform compensation and correction in combination with the real-time temperature data to calculate the barometric altitude. At the same time, adjust the barometric altitude data in real time based on the initial calibration value of the flight controller to adapt to different flight environments;

[0014] Collect the current rotational speed data of the motor through the Hall sensor or optical encoder of the motor, and perform filtering and interpolation processing on the collected rotational speed signal to enhance the continuity and accuracy of the data;

[0015] Synchronously integrate the collected data through the timestamp alignment method to generate a joint state vector of attitude, altitude and rotational speed.

[0016] Further, the calculating of the pitch angular acceleration, roll angular acceleration and yaw angular acceleration of the drone based on the attitude data includes:

[0017] Collect the pitch angle, roll angle and yaw angle data in real time through the inertial measurement unit to form time series data respectively. Among them, the attitude angle data at each time point is sampled by the sensor and stored in the cache of the flight control system in chronological order;

[0018] Based on the smoothed attitude angle time series data, calculate the pitch angular velocity, roll angular velocity and yaw angular velocity through the first-order difference method. Among them, the angular velocity at each time step is obtained by dividing the change value of the attitude angle between the current time step and the previous time step by the sampling time interval;

[0019] Use the calculated angular velocity sequence to calculate the pitch angular acceleration, roll angular acceleration and yaw angular acceleration through the second-order difference method. Among them, the angular acceleration at each time step is obtained by dividing the change value of the angular velocity between the current time step and the previous time step by the sampling time interval.

[0020] Further, the judging whether the current drone is in the state of airflow disturbance according to the preset threshold includes:

[0021] Obtain the pitch angular acceleration , roll angular acceleration , yaw angular acceleration and the rate of change of barometric altitude ;

[0022] For pitch angular acceleration , roll angular acceleration , yaw angular acceleration , perform normalization to obtain the normalized pitch angular acceleration , the normalized roll angular acceleration and the normalized yaw angular acceleration ;

[0023] Calculate the disturbance state index according to Formula 1 below :

[0024] ;

[0025] Among them, , , and are weighting coefficients;

[0026] Compare the calculated disturbance state index with the preset threshold . If it satisfies , it is determined that the UAV is in an airflow disturbance state.

[0027] Furthermore, the deep learning model includes an input layer, a first hidden layer, a second hidden layer, a third hidden layer, and an output layer;

[0028] The input layer is used to receive pitch angular acceleration, roll angular acceleration, yaw angular acceleration, the rate of change of barometric altitude, and the current motor speed data, and perform normalization on the received data. Specifically, it includes unifying the dimensions and scaling the amplitudes of different input data to generate standardized feature data;

[0029] The first hidden layer is used to receive the standardized feature data provided by the input layer, and process the standardized feature data of the received pitch angular acceleration, roll angular acceleration, and yaw angular acceleration through two parallel sub-networks; among them, the first sub-network is implemented using a convolutional neural network structure and is used to extract features from the standardized feature data of the received pitch angular acceleration, roll angular acceleration, and yaw angular acceleration to generate local features describing disturbance characteristics; the second sub-network is implemented using a recurrent neural network structure and is used to process the time series in the standardized feature data of the received pitch angular acceleration, roll angular acceleration, and yaw angular acceleration to capture dynamic change characteristics and generate time series features;

[0030] The second hidden layer is used to receive the local features and temporal features output by the first hidden layer, and fuse them with the standardized features of the air pressure altitude change rate and the current motor speed to generate a fused feature vector; the second hidden layer is implemented through a fully connected network and dynamically assigns weights to different features in combination with an attention mechanism;

[0031] The third hidden layer is used to receive the fused feature vector and process the fused feature vector through a deep fully connected network, specifically including performing a high-dimensional non-linear transformation on the fused feature vector to generate a preliminary prediction of the target speed compensation value; during the fusion process, the third hidden layer reduces the overfitting risk of the model through regularization techniques and uses activation functions to improve the model's ability to express complex non-linear relationships;

[0032] The output layer receives the preliminary prediction from the third hidden layer and corrects it in combination with historical flight data to generate the target speed compensation value.

[0033] Furthermore, the second hidden layer generates the fused feature vector through a feature fusion and attention allocation mechanism according to the following formula 2:

[0034] ;

[0035] Where, is the fused feature vector; represents the category of features, including local features, temporal features, air pressure altitude change rate features, and motor speed features; is the number of features to be fused; is the dynamic weight of the

[0036] ;

[0037] Where, is the weight parameter matrix related to the category of features; is a static adjustment coefficient independent of the flight mode; represents the category of features is a dynamic adjustment coefficient related to the flight mode; is the number of features to be fused; is the flight mode value, calculated according to the following formula 4:

[0038] ;

[0039] Where, is the rate of change of barometric altitude; is the current motor speed; is the maximum value of the motor speed in historical data.

[0040] Further, the third hidden layer optimizes the complex relationship between the fusion features through high-dimensional non-linear transformation, and specifically processes the fusion feature vector using the following formula 5:

[0041] ;

[0042] Among them, represents the feature vector after high-dimensional non-linear transformation, and is used to generate the preliminary target speed compensation value; represents the total number of fusion features transferred from the second hidden layer to the third hidden layer; represents the non-linear enhancement weight related to the fusion ; is the th fusion feature output by the second hidden layer; is a coefficient related to the flight mission and environment; is the th fusion feature and the th fusion feature interaction weight coefficient; is the activation function, and is implemented using the following formula 6:

[0043] ;

[0044] Among them, is the gain factor adjusted according to the current disturbance intensity.

[0045] Further, the convolution kernel size and number of the first sub-network in the first hidden layer are determined according to the flight characteristics of the UAV; at the same time, the coverage ability of the feature space is improved by increasing the number of convolution kernels, thereby enhancing the recognition of complex disturbance patterns.

[0046] Further, according to the target speed compensation value, combined with the preset fuzzy control rules, the correction value of the PWM drive signal of the motor is calculated, including:

[0047] Calculate the speed error and the rate of change of the error through the target speed compensation value output by the deep learning model and the current motor speed feedback value, where the speed error is the difference between the target speed compensation value and the current feedback value, and the rate of change of the error is the change in the speed error between consecutive time steps;

[0048] Taking the rotational speed error and the error change rate as input parameters of the fuzzy control rule, perform fuzzy processing on the input parameters based on a preset fuzzy membership function, where the fuzzy membership function is pre-designed according to the experimental data of the motor response and the actual requirements of the flight mission, and is divided into multiple fuzzy sets;

[0049] Perform fuzzy inference on the fuzzified input according to the fuzzy control rule base; during the inference process, use the maximum-minimum composition method or the weighted average method to comprehensively process the results of multiple rules to ensure the accuracy and stability of the control logic;

[0050] Perform defuzzification processing on the fuzzy inference result to generate an accurate PWM correction value, where the defuzzification method uses the centroid method, and determines the numerical output of the PWM correction value by calculating the centroid position of the fuzzy set; the PWM correction value represents the duty cycle adjustment amount of the motor PWM drive signal required in the current state.

[0051] Furthermore, applying the corrected PWM drive signal to the motor and collecting the real-time motor speed feedback information, and dynamically adjusting the weight parameters of the deep learning model according to the feedback information, including:

[0052] Apply the calculated corrected PWM drive signal to the motor through the motor control unit of the unmanned aerial vehicle to adjust the actual rotational speed of the motor;

[0053] Real-time collect the current rotational speed feedback information of the motor through the rotational speed sensor installed on the motor;

[0054] Calculate the error between the actual motor speed feedback value and the target speed compensation value, and use the error as the immediate reward signal of the deep learning model, and dynamically adjust the weight parameters of the model through the reinforcement learning algorithm.

[0055] The beneficial effects of the technical solution provided by this application include:

[0056] (1) By introducing a deep learning model and combining multi-dimensional input parameters (including attitude acceleration, rate of change of barometric altitude, etc.), it is possible to accurately predict and identify the disturbance state in a complex airflow environment, improving the environmental perception ability of the drone under adverse weather conditions. (2) Using fuzzy control rules to correct the PWM drive signal avoids the limitations of fixed parameters in traditional PID control, making the control response smoother, effectively reducing the severe speed fluctuations of the motor, and extending the service life of the motor. (3) By collecting real-time motor speed feedback information and dynamically adjusting the weight parameters of the deep learning model, adaptive optimization of the control strategy is achieved, improving the robustness of the system, enabling the drone to better cope with airflow disturbances of different intensities. (4) Taking barometric altitude data as one of the control parameters, considering the influence of the high-altitude environment on motor performance, enhances the adaptability of the drone at different altitudes, expanding the actual application scenarios of the drone. Description of the Drawings

[0057] Figure 1 is a flowchart of a control method for a motor in a drone provided by the first embodiment of the present application. Detailed Embodiments

[0058] Many specific details are set forth in the following description in order to provide a thorough understanding of the present application. However, the present application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar generalizations without departing from the connotation of the present application. Therefore, the present application is not limited by the specific embodiments disclosed below.

[0059] The first embodiment of the present application provides a control method for a motor in a drone. Please refer to Figure 1 , which is a schematic diagram of the first embodiment of the present application. The following combines Figure 1 to describe in detail a control method for a motor in a drone provided by the first embodiment of the present application.

[0060] Step S101: Obtain attitude data, barometric altitude data, and current motor speed data during the flight of the drone, where the attitude data includes pitch angle, roll angle, and yaw angle.

[0061] In step S101, the drone first obtains various data during flight through multiple sensor modules integrated in the flight control system. These sensor modules include, but are not limited to: an inertial measurement unit (IMU) for measuring attitude data, a barometer for detecting barometric altitude, and an encoder or Hall sensor for real-time monitoring of motor speed, etc.

[0062] The acquisition of attitude data is achieved through an IMU. An IMU usually includes an accelerometer and a gyroscope, which are used to measure the linear acceleration and angular velocity of the drone respectively. Through the internal algorithm of the IMU, by fusing the accelerometer and the gyroscope, the attitude angle information of the drone can be calculated, including the pitch angle, roll angle, and yaw angle. These attitude data are usually further processed through a Kalman filter or other data fusion algorithms to improve their accuracy and noise resistance performance.

[0063] The acquisition of barometric altitude data depends on the barometer installed on the drone. The barometer calculates the current flight altitude by detecting the change in ambient atmospheric pressure. Usually, the output value of the barometer will undergo calibration and filtering processes to eliminate errors caused by external factors such as temperature and airflow fluctuations, and output a stable barometric altitude value.

[0064] The current rotational speed data of the motor can be obtained through Hall sensors or optical encoders installed on the motor. Hall sensors calculate the rotational speed by detecting the change in the magnetic field inside the motor, while optical encoders obtain rotational speed information through the encoding and decoding of optical signals. These rotational speed data may contain certain jitters or noises, so they need to be filtered and averaged to provide a stable rotational speed value.

[0065] The above-obtained attitude data, barometric altitude data, and current rotational speed data of the motor are transmitted to the data processing module through the communication bus in the flight control unit of the drone. This module is usually based on an embedded computing platform and uses a high-speed data interface to integrate multi-source data to ensure the synchronization of each data acquisition channel and the timeliness of the data.

[0066] In step S101, the key points are the accuracy of the sensors and the real-time nature of the data. This requires reasonably selecting high-precision sensor components and appropriately preprocessing the collected data to ensure the accurate acquisition and output of attitude data, barometric altitude data, and motor rotational speed data.

[0067] Furthermore, the acquisition of attitude data, barometric altitude data, and current rotational speed data of the motor during the flight of the drone includes:

[0068] Real-time collection of the pitch angle, roll angle, and yaw angle through the inertial measurement unit equipped on the drone. Among them, the inertial measurement unit measures the linear acceleration and angular velocity through the accelerometer and the gyroscope and uses a data fusion algorithm to generate stable attitude data;

[0069] Obtain the ambient air pressure through the barometer and perform compensation and correction in combination with real-time temperature data to calculate the barometric altitude. At the same time, adjust the barometric altitude data in real time based on the initial calibration value of the flight controller to adapt to different flight environments;

[0070] Collect the current rotational speed data of the motor through the Hall sensor or optical encoder of the motor, and filter and interpolate the collected rotational speed signal to enhance the continuity and accuracy of the data;

[0071] Synchronize and integrate the collected data through the timestamp alignment method to generate a joint state vector of attitude, altitude, and rotational speed.

[0072] In this embodiment, the steps of obtaining the attitude data, barometric altitude data, and the current rotational speed data of the motor during the flight of the UAV are aimed at providing accurate and real-time inputs for subsequent flight control and disturbance state judgment. Specifically, this process is achieved through the collaborative work of multiple sensors and data processing methods, ensuring the integrity and consistency of the data.

[0073] First, the attitude data of the UAV is collected in real time through the inertial measurement unit (IMU) equipped on the UAV. The inertial measurement unit includes a three-axis accelerometer and a three-axis gyroscope. The accelerometer is used to measure the linear acceleration of the UAV in three-dimensional space, while the gyroscope is used to measure the three-dimensional angular velocity of the UAV. To convert these discrete measurement data into pitch angle, roll angle, and yaw angle, the system adopts data fusion algorithms, such as the Kalman filter or complementary filter algorithm. These algorithms compensate for sensor noise and drift by combining the data of the accelerometer and gyroscope, thereby generating stable and accurate attitude data.

[0074] Second, obtain the ambient air pressure value through the barometer, and compensate and correct the measurement result of the barometer by combining the real-time temperature sensor data. Since the change of ambient temperature may cause deviation in air pressure measurement, by using the temperature sensor inside the UAV, the air pressure data can be corrected according to the temperature change. In addition, to convert the air pressure data into barometric altitude, the system uses the standard atmospheric pressure formula or an empirical correction curve for calculation. At the same time, the flight controller will also adjust the barometric altitude data in real time according to the initial calibration value of the UAV to ensure the good adaptability and accuracy of the barometric altitude data in different flight environments. This adjustment is particularly important for coping with severe airflow disturbances or rapid altitude changes.

[0075] Next, collect the current rotational speed data of the motor through the Hall sensor or optical encoder installed on the motor. The Hall sensor generates a pulse signal by detecting the change of the magnetic field inside the motor rotor, while the optical encoder obtains the rotational speed data by reading the optical encoding pattern on the rotor. To improve the continuity and accuracy of the rotational speed data, the system filters the collected signal, for example, uses a low-pass filter to eliminate high-frequency noise. In addition, to ensure the time consistency of the signal under high-dynamic conditions, the system adopts interpolation processing to fill the data gaps caused by sampling rate limitations or signal loss.

[0076] Finally, synchronize and integrate the collected attitude data, barometric altitude data, and motor speed data through the timestamp alignment method. By adding precise time stamps to each data point, ensure that the data from different sensors can be compared and combined based on the same time reference, thereby generating a joint state vector containing attitude, altitude, and speed information. This joint state vector, as a multi-dimensional feature descriptor, provides complete and accurate input for subsequent flight control algorithms and deep learning models.

[0077] By combining multiple sensors and data processing methods, high standards in real-time performance, accuracy, and consistency of the acquired data are ensured.

[0078] Step S102: Based on the attitude data, calculate the pitch angular acceleration, roll angular acceleration, and yaw angular acceleration of the UAV, and determine whether the current UAV is in an airflow disturbance state according to a preset threshold.

[0079] In step S102, based on the attitude data obtained from step S101, specifically including the pitch angle, roll angle, and yaw angle, calculate the pitch angular acceleration, roll angular acceleration, and yaw angular acceleration of the UAV. To achieve this, it is necessary to first perform continuous recording and processing of the acquired attitude data in terms of time. Specifically, the pitch angle, roll angle, and yaw angle are angle descriptions of the UAV in a three-axis coordinate system, and these data change continuously over time.

[0080] To calculate the accelerations of these angles, it is first necessary to perform differential processing on the attitude angle data in the time dimension. This can be achieved in the following way: First, sample the attitude angle values at each time point, and then calculate the angular velocity using the angle change amount within a discrete time interval. For example, the pitch angular velocity can be expressed as the difference between the pitch angle at the current time point and the previous time point divided by the time interval. Similarly, the roll angular velocity and yaw angular velocity can be calculated.

[0081] Then, calculate the angular acceleration through a similar differential operation. For example, the pitch angular acceleration can be expressed as the change amount of the pitch angular velocity at two consecutive time points divided by the time interval. The same method applies to the roll angular acceleration and yaw angular acceleration. This calculation process requires high-precision timestamp recording to ensure the accuracy of the calculation results.

[0082] After the calculation is completed, it is necessary to compare these angular acceleration data with a preset threshold to determine whether the current UAV is in an airflow disturbance state. The preset threshold can be set based on experimental and flight data experience, and is usually a boundary reflecting the acceleration change range in the normal flight state. When a certain acceleration exceeds its corresponding threshold, it can be considered that the UAV may be affected by airflow disturbance.

[0083] The judgment process can be realized through logical operations. For example, the pitch angular acceleration, roll angular acceleration, and yaw angular acceleration are respectively compared with their thresholds. If any value exceeds the threshold range, the flag of the airflow disturbance state is triggered. Further, by comprehensively analyzing the change trends of the accelerations in the three directions, it can be judged whether the disturbance has an obvious directionality or a specific pattern.

[0084] The entire step needs to be completed by the flight control system of the UAV. This system includes an acquisition module for attitude data, a processing module, and a judgment module for the disturbance state.

[0085] Furthermore, calculating the pitch angular acceleration, roll angular acceleration, and yaw angular acceleration of the UAV based on the attitude data includes:

[0086] The pitch angle, roll angle, and yaw angle data are collected in real time through an inertial measurement unit to form time series data respectively. The attitude angle data at each time point is sampled by the sensor and stored in the cache of the flight control system in chronological order;

[0087] Based on the smoothed attitude angle time series data, the pitch angular velocity, roll angular velocity, and yaw angular velocity are calculated by the first-order difference method. Among them, the angular velocity at each time step is obtained by dividing the change value of the attitude angle between the current time step and the previous time step by the sampling time interval;

[0088] Using the calculated angular velocity sequence, the pitch angular acceleration, roll angular acceleration, and yaw angular acceleration are calculated by the second-order difference method. Among them, the angular acceleration at each time step is obtained by dividing the change value of the angular velocity between the current time step and the previous time step by the sampling time interval.

[0089] In this embodiment, the attitude data is collected and processed through the inertial measurement unit to calculate the pitch angular acceleration, roll angular acceleration, and yaw angular acceleration. This process includes multiple steps such as data acquisition, difference calculation, and acceleration extraction, aiming to ensure the accuracy and real-time performance of the results.

[0090] First of all, the inertial measurement unit of the UAV will collect the data of the pitch angle, roll angle, and yaw angle in real time. These data are jointly generated by the accelerometer and the gyroscope, representing the instantaneous attitude angles of the UAV in the three-dimensional space. The collected attitude angle data will be stored in the cache of the flight control system in the form of time series. To ensure the time continuity and sequential consistency of the data, each data point will be marked with an accurate timestamp. These timestamps allow subsequent calculations to correctly identify the time intervals between the data. The storage of the attitude angle data not only helps with real-time processing but also provides a basis for future dynamic analysis and flight state assessment.

[0091] Next, based on the time series data in the cache, the angular velocity of the drone is calculated by the method of first-order difference. The first-order difference method is completed by calculating the change value of the attitude angle between adjacent time steps divided by the sampling time interval. Specifically, for each time step, the angular velocity is obtained by subtracting the attitude angle of the previous time step from the attitude angle of the current time step and then dividing by the time interval between two samplings. This method can capture the dynamic trend of the attitude angle change and generate the time series of pitch angular velocity, roll angular velocity, and yaw angular velocity. These angular velocity sequences are an important basis for further calculating the acceleration. To reduce the error caused by sensor noise, the attitude angle data is usually smoothed before the difference operation, such as using a moving average filter or a low-pass filter, so as to improve the stability of the angular velocity calculation.

[0092] After obtaining the time series of angular velocity, the pitch angular acceleration, roll angular acceleration, and yaw angular acceleration are calculated using the second-order difference method. The second-order difference method is implemented by calculating the change value of the angular velocity between adjacent time steps divided by the sampling time interval. Specifically, the angular acceleration at each time step is obtained by subtracting the angular velocity of the previous time step from the angular velocity of the current time step and then dividing by the time interval between two samplings. Such calculations can accurately capture the change rate of the attitude angular velocity, thereby providing the dynamic characteristics of the acceleration. To improve the robustness of the calculation, the angular velocity sequence can also be smoothed before the difference processing to reduce the influence of high-frequency noise caused by measurement errors or environmental disturbances.

[0093] Through the above process, the pitch angular acceleration, roll angular acceleration, and yaw angular acceleration are finally generated. These acceleration data can accurately reflect the dynamic change characteristics of the current attitude of the drone and provide key inputs for subsequent flight control and disturbance state judgment.

[0094] Furthermore, the judgment of whether the current drone is in the airflow disturbance state according to the preset threshold includes:

[0095] Obtain the pitch angular acceleration , roll angular acceleration , yaw angular acceleration and the rate of change of barometric altitude ;

[0096] For the pitch angular acceleration , roll angular acceleration , yaw angular acceleration perform normalization processing to obtain the normalized pitch angular acceleration , normalized roll angular acceleration and normalized yaw angular acceleration ;

[0097] The purpose of normalization is to eliminate the dimension difference and balance the weights of different features in the calculation of the disturbance state. The normalization process adopts the following formula:

[0098] ;

[0099] where, , , are the historical means of the pitch angle acceleration, roll angle acceleration, and yaw angle acceleration respectively, , , are the standard deviations of the pitch angle acceleration, roll angle acceleration, and yaw angle acceleration respectively. These statistical parameters can be calculated from the data collected by the UAV under stable flight conditions

[0100] Calculate the disturbance state index according to Formula 1 below :

[0101] ;

[0102] where, , , and are the weighting coefficients; is used to control the weight of the pitch angle acceleration, and the reference value is 0.3. is used to control the weight of the roll angle acceleration, and the reference value is 0.3. is used to control the weight of the yaw angle acceleration, and the reference value is 0.2. is used to control the weight of the rate of change of barometric altitude, and the reference value is 0.2.

[0103] Compare the calculated disturbance state index with the preset threshold . If is satisfied, it is determined that the UAV is in the airflow disturbance state. The threshold is an empirical value set based on experiments and historical data, and usually reflects the boundary between the stable flight state and the disturbance state.

[0104] Step S103: When it is determined that the UAV is in the airflow disturbance state, calculate the target speed compensation value of the motor based on a pre-trained deep learning model. The input parameters of the deep learning model include: pitch angle acceleration, roll angle acceleration, yaw angle acceleration, rate of change of barometric altitude, and the current speed of the motor.

[0105] In step S103, when the drone is in an airflow disturbance state, a pre-trained deep learning model is used to calculate the target rotational speed compensation value of the motor. To implement this process, it is first necessary to clarify the design and training steps of the deep learning model, then input the relevant data obtained in real time into the model, and finally output the target rotational speed compensation value.

[0106] The deep learning model is trained with a large amount of flight data. Its core is a neural network structure used to map the relationship between input features and the target rotational speed compensation value of the motor. The input features include pitch angular acceleration, roll angular acceleration, yaw angular acceleration, barometric altitude change rate, and the current rotational speed of the motor. These data comprehensively reflect the current attitude and environmental disturbance state of the drone, so they can provide sufficient information for compensation calculation.

[0107] During the training process of the model, it is necessary to first collect a large amount of flight experiment data, especially sensor data and motor rotational speed change data under various disturbance conditions. These data are labeled as the training samples of the model, where the input is the above-mentioned features and the output is the target rotational speed compensation value of the motor. Reinforcement learning algorithms such as Deep Deterministic Policy Gradient (DDPG) or Proximal Policy Optimization (PPO) are used for training, aiming to minimize the attitude deviation or flight energy consumption of the drone. By iteratively optimizing the weight parameters of the neural network, a model that can dynamically respond to complex disturbances is finally obtained.

[0108] During operation, the real-time data obtained from steps S101 and S102 are input into the trained deep learning model. These data are first normalized to ensure that the input range is consistent with that during model training, so as to improve the accuracy and robustness of the calculation. The model will calculate the current target rotational speed compensation value based on the input data, and this value represents the amount of motor rotational speed adjustment required to maintain the stability of the drone in the airflow disturbance state.

[0109] The calculation of the target rotational speed compensation value is a process with high real-time requirements. Therefore, the inference efficiency of the model must be optimized, which can be achieved through lightweight neural networks or hardware accelerators (such as embedded GPUs or TPUs). In addition, to ensure the reliability of the model, an anomaly detection mechanism can be set to trigger a backup control strategy when the input data is abnormal or the model output is abnormal.

[0110] Through the above steps, the deep learning model maps the complex flight state of the drone into an accurate target rotational speed compensation value.

[0111] Furthermore, the deep learning model includes an input layer, a first hidden layer, a second hidden layer, a third hidden layer, and an output layer;

[0112] The input layer is used to receive pitch angular acceleration, roll angular acceleration, yaw angular acceleration, air pressure altitude change rate, and current motor speed data, and perform normalization processing on the received data items, specifically including unifying the dimensions and scaling the amplitudes of different input data to generate standardized feature data;

[0113] The first hidden layer is used to receive the standardized feature data provided by the input layer, and process the standardized feature data of the received pitch angular acceleration, roll angular acceleration, and yaw angular acceleration through two parallel sub-networks; among them, the first sub-network is implemented by a convolutional neural network structure and is used to extract features from the standardized feature data of the received pitch angular acceleration, roll angular acceleration, and yaw angular acceleration to generate local features describing disturbance characteristics; the second sub-network is implemented by a recurrent neural network structure and is used to process the time series in the standardized feature data of the received pitch angular acceleration, roll angular acceleration, and yaw angular acceleration to capture dynamic change characteristics and generate time series features;

[0114] The second hidden layer is used to receive the local features and time series features output by the first hidden layer, and fuse them with the standardized features of the air pressure altitude change rate and the current motor speed to generate a fused feature vector; the second hidden layer is implemented by a fully connected network and dynamically allocates weights for different features in combination with an attention mechanism;

[0115] The third hidden layer is used to receive the fused feature vector and process the fused feature vector through a deep fully connected network, specifically including performing a high-dimensional non-linear transformation on the fused feature vector to generate a preliminary prediction of the target speed compensation value; during the fusion process, the third hidden layer reduces the overfitting risk of the model through regularization techniques and at the same time uses activation functions to improve the model's ability to express complex non-linear relationships;

[0116] The output layer receives the preliminary prediction from the third hidden layer and corrects it in combination with historical flight data to generate the target speed compensation value.

[0117] In this embodiment, through the multi-layer structure of the deep learning model, the flight data of the unmanned aerial vehicle is processed and analyzed, so as to calculate the target speed compensation value of the motor. This model consists of an input layer, a first hidden layer, a second hidden layer, a third hidden layer, and an output layer. Each layer is interrelated and optimizes feature information layer by layer to ensure the accuracy and real-time performance of the final output result.

[0118] The input layer first receives various real-time data from the drone, including pitch angular acceleration, roll angular acceleration, yaw angular acceleration, rate of change of barometric altitude, and the current rotational speed of the motor. These data have different dimensions and characteristics, so the input layer needs to normalize them. Specifically, unit differences between different data are eliminated through dimensional unification, and at the same time, an amplitude scaling method is used to adjust the data to a unified numerical range, generating standardized feature data. The data after normalization has high stability and consistency, laying a foundation for the processing of subsequent layers.

[0119] The first hidden layer receives the standardized feature data generated by the input layer and separately performs local pattern extraction and time series analysis on these features through two parallel sub-networks. The first sub-network adopts the structure of a convolutional neural network (CNN) and focuses on the standardized feature data of pitch angular acceleration, roll angular acceleration, and yaw angular acceleration. The convolutional network extracts local features from the input data through convolutional kernels, captures the spatial patterns of perturbation characteristics, and generates local feature vectors for describing the instantaneous state characteristics of the flight attitude. The second sub-network adopts the structure of a recurrent neural network (RNN) and focuses on processing the time series of these features. The recurrent network gradually processes the data within the time step through its cyclic structure, captures the dynamic change laws of pitch, roll, and yaw angular accelerations, and generates time series feature vectors for reflecting the change trend of the flight attitude.

[0120] The second hidden layer receives the local features and time series features output by the first hidden layer, and at the same time combines the standardized features of the rate of change of barometric altitude and the current rotational speed of the motor to generate a high-dimensional fused feature vector through feature fusion. Feature fusion adopts the structure of a fully connected network and maps various features to a unified high-dimensional feature space through linear and nonlinear transformations. In addition, the second hidden layer introduces an attention mechanism to dynamically adjust the weights according to the importance of the features to the target task. For example, time series features may be given priority under perturbed states, while local features are more concerned during stable flight. The attention mechanism improves the adaptability of the model to complex flight environments by dynamically allocating weights.

[0121] The third hidden layer receives the fused feature vector and further processes it through a deep fully connected network. In this process, the third hidden layer performs high-dimensional nonlinear transformation on the fused feature vector, capturing higher-order feature correlations by increasing the depth and complexity of the model. In addition, the third hidden layer adopts regularization techniques such as the Dropout method to effectively reduce the risk of overfitting of the model, thereby improving the generalization ability to unknown flight scenarios. At the same time, the introduction of activation functions (such as ReLU or Swish) enhances the model's ability to express nonlinear relationships, ensuring that the output results can accurately reflect the current flight state.

[0122] The output layer receives the preliminary prediction results from the third hidden layer and corrects them in combination with historical flight data to generate the final target rotational speed compensation value. During the correction process, the output layer compares the current prediction value with the patterns in the historical flight data and dynamically adjusts the prediction results according to specific flight tasks and environmental conditions. This correction mechanism enables the model to adapt to changes in real time in complex flight environments, improving the accuracy and robustness of the output results.

[0123] The overall model optimizes the feature information layer by layer through the normalization processing of the input layer, the feature extraction of the first hidden layer, the feature fusion and weight assignment of the second hidden layer, the non-linear transformation and regularization of the third hidden layer, as well as the correction and output of the output layer, and finally generates a high-precision target rotational speed compensation value.

[0124] Furthermore, the second hidden layer generates a fused feature vector through a feature fusion and attention allocation mechanism according to the following formula 2:

[0125] ;

[0126] where is the fused feature vector, which is used to describe the current state of the UAV.

[0127] represents the type of feature, including local features, temporal features, barometric altitude change rate features, and motor speed features;

[0128] is the number of features to be fused. For example, is 4, and the features to be fused include local features, temporal features, barometric altitude change rate features, and motor speed features.

[0129] is the dynamic weight of the type of feature, which is calculated according to the following formula 3:

[0130] ;

[0131] where is the weight parameter matrix related to the type of feature. This matrix is obtained through offline training and is dynamically adjusted according to the flight mode and disturbance state.

[0132] is a static adjustment coefficient independent of the flight mode, which is used to balance the basic contribution of the features. The reference value can be set to 0.8.

[0133] is a dynamic adjustment coefficient related to the flight mode, used to enhance the influence of specific features according to the current flight state. The reference value is usually 0.2, but can be adjusted to 0.5 in a high-perturbation environment.

[0134] represents the type of feature, including local features, temporal features, barometric altitude change rate features, and motor speed features.

[0135] is the number of features to be fused, the same as in the above formula 2;

[0136] is the flight mode value, calculated according to the following formula 4:

[0137] ;

[0138] where, is the barometric altitude change rate, indicating the current vertical motion state of the UAV, with the unit of meters per second. The value is calculated from the barometric altitude data collected in real time, for example, the difference between the current barometric altitude and the previous barometric altitude divided by the time interval.

[0139] is the current motor speed, with the unit of revolutions per second, sourced from the motor's Hall sensor or optical encoder.

[0140] is the maximum value of the motor speed in historical data, used to measure the difference between the current motor speed and the historical maximum value. This value is calculated from the UAV's flight log records and is usually set during model initialization.

[0141] Further, the third hidden layer optimizes the complex relationship between the fused features through high-dimensional non-linear transformation. Specifically, the following formula 5 is used to process the fused feature vector:

[0142] ;

[0143] where, represents the feature vector after high-dimensional non-linear transformation, used to generate the preliminary target speed compensation value; represents the total number of fused features transferred from the second hidden layer to the third hidden layer;

[0144] represents the fused The relevant non - linear enhancement weights are used to adjust the contribution of each feature to the final output. This parameter is dynamically optimized through offline training, and the typical initial value ranges from 0.5 to 1.5, which is adjusted according to the requirements of the flight mission. For example, when the perturbation is severe, the weight of the time - series feature may be higher.

[0145] is the th fused feature of the output of the second hidden layer; is the th fused feature of the output of the second hidden layer; is the th fused feature of the output of the second hidden layer.

[0146] is a coefficient related to the flight mission and environment, reflecting the specific requirements of the flight mission and environment, usually between 0.1 and 0.3. For example, in a complex flight environment, can be increased to strengthen the contribution of key features.

[0147] is the th fused feature and the th fused feature 's interaction weight coefficient, reflecting the relative importance between features. This parameter is determined through model training, and the initial value range is generally from 0.1 to 0.5, and can be dynamically adjusted according to specific flight patterns.

[0148] is the activation function, which is implemented by the following formula 6:

[0149] ;

[0150] where is the gain factor adjusted according to the current perturbation intensity, which determines the gradient change range of the activation function. This parameter is related to the current perturbation intensity. In a low - perturbation environment, 's value is usually set to 1.0, while in a high - perturbation environment, it can be increased to 2.0 to enhance the response sensitivity of the model to the input data.

[0151] Furthermore, the size and number of the convolution kernels of the first sub - network in the first hidden layer are determined according to the flight characteristics of the UAV; meanwhile, by increasing the number of convolution kernels, the coverage of the feature space is improved, thereby enhancing the recognition of complex perturbation patterns.

[0152] In this embodiment, the first sub-network of the first hidden layer processes the input normalized feature data through a Convolutional Neural Network (CNN) structure to extract local perturbation patterns related to the flight characteristics of the drone. In the implementation process, the design of the convolutional kernel, including its size and number, directly determines the effect of feature extraction and computational efficiency. To ensure that the model can adapt to the dynamic characteristics of the drone in a complex flight environment, the size and number of the convolutional kernels are carefully set according to the specific flight characteristics of the drone. At the same time, by appropriately increasing the number of convolutional kernels, the coverage ability of the model for the feature space is improved, and the recognition ability for complex perturbation patterns is enhanced.

[0153] The size of the convolutional kernel defines the receptive field range on the input feature map, that is, in each convolution operation, the local feature area that the convolutional kernel can capture. To adapt to the rapid dynamic changes of the drone, the size of the convolutional kernel needs to be selected within a certain range to ensure that it can capture subtle perturbation features while maintaining the perception ability of the overall flight state. For example, for the input feature data of pitch angular acceleration, roll angular acceleration, and yaw angular acceleration, the size of the convolutional kernel is usually selected as or to capture the perturbation patterns between different dimensions in space. These sizes of convolutional kernels can effectively balance the accuracy of local feature extraction and computational complexity, ensuring real-time processing ability.

[0154] The number of convolutional kernels directly determines the types and richness of the features extracted by the model. Increasing the number of convolutional kernels can improve the coverage ability of the feature space, thereby capturing more perturbation patterns. For example, the number of convolutional kernels in the initial layer can be set to 32 or 64 to extract low-level perturbation features; in subsequent convolutional layers, the number of convolutional kernels can be gradually increased to 128 or higher to capture higher-level patterns. This hierarchical design enables the model to gradually construct feature representations from simple to complex while retaining comprehensive coverage of key perturbation information.

[0155] To further improve the robustness of the convolution operation, the weights of the convolutional kernels are optimized through offline training. During the training process, the model automatically adjusts the parameters of the convolutional kernels according to the perturbation characteristics of the input data, so that each convolutional kernel focuses on capturing specific perturbation patterns. For example, during the flight of the drone, a specific convolutional kernel may be optimized to be more sensitive to the rapidly changing pitch angular acceleration, while other convolutional kernels may focus on the slowly changing roll angular acceleration.

[0156] In addition, to prevent overfitting, regularization techniques such as the Dropout method or weight penalty terms are introduced after the convolution operation to ensure the generalization ability of the model in practical applications. Through the design of the size and number of convolutional kernels and the combination of regularization techniques, the first sub-network can fully extract the local perturbation patterns in the input features and provide high-quality feature inputs for subsequent hidden layers.

[0157] The following is the reference implementation code for the deep learning model:

[0158] import torch

[0159] import torch.nn as nn

[0160] import torch.nn.functional as F

[0161] import math

[0162] # Define the deep learning model

[0163] class DroneMotorControlModel(nn.Module):

[0164] def __init__(self, input_dim, hidden_dim, output_dim, num_features):

[0165] """

[0166] Initialize the model structure, including the input layer, the first hidden layer, the second hidden layer, the third hidden layer, and the output layer

[0167] :param input_dim: Dimension of input features

[0168] :param hidden_dim: Dimension of hidden layers

[0169] :param output_dim: Dimension of output features

[0170] :param num_features: Number of features to be fused, n

[0171] """

[0172] super(DroneMotorControlModel, self).__init__()

[0173] # Input layer: Receive and normalize the input data

[0174] self.input_layer = nn.BatchNorm1d(input_dim)

[0175] # The first hidden layer: Contains two parallel sub-networks

[0176] # The first sub-network (convolutional network)

[0177] self.conv1 = nn.Conv2d(in_channels=1, out_channels=32,kernel_size=(3, 3), padding=1)

[0178] self.conv2 = nn.Conv2d(in_channels=32, out_channels=64,kernel_size=(3, 3), padding=1)

[0179] self.pool = nn.MaxPool2d(kernel_size=(2, 2))

[0180] # Second sub-network (recurrent network)

[0181] self.rnn = nn.LSTM(input_dim, hidden_dim, batch_first=True)

[0182] # Second hidden layer: fuse feature vectors and apply attention mechanism

[0183] self.fc_fusion = nn.Linear(hidden_dim + hidden_dim + 2,hidden_dim)

[0184] self.attention_weights = nn.Parameter(torch.randn(num_features, 1)) # Dynamic weights

[0185] # Third hidden layer: high-dimensional non-linear transformation

[0186] self.fc_non_linear = nn.Linear(hidden_dim, hidden_dim)

[0187] self.gamma_weights = nn.Parameter(torch.randn(hidden_dim)) # Non-linear enhancement weights

[0188] self.delta_weights = nn.Parameter(torch.randn(hidden_dim,hidden_dim)) # Feature interaction weights

[0189] # Output layer: Calibrate the target rotational speed compensation value

[0190] self.output_layer = nn.Linear(hidden_dim, output_dim)

[0191] def forward(self, x, delta_h, omega_current, omega_max):

[0192] """

[0193] Forward propagation process

[0194] :param x: Input data, including pitch angular acceleration, roll angular acceleration, yaw angular acceleration, etc.

[0195] :param delta_h: Rate of change of barometric altitude

[0196] :param omega_current: Current motor rotational speed

[0197] :param omega_max: Historical maximum motor rotational speed

[0198] :return: Final output target rotational speed compensation value

[0199] """

[0200] # Input layer normalization processing

[0201] x_normalized = self.input_layer(x)

[0202] # First hidden layer: Convolutional network extracts local features

[0203] x_conv = F.relu(self.conv1(x_normalized.unsqueeze(1)))

[0204] x_conv = self.pool(F.relu(self.conv2(x_conv))).view(x.size(0), -1) # Flatten

[0205] # First hidden layer: Recurrent network extracts temporal features

[0206] x_rnn, _ = self.rnn(x_normalized.unsqueeze(1))

[0207] x_rnn = x_rnn[:, -1, :] # Take the output of the last time step

[0208] # Second hidden layer: fuse local features and temporal features

[0209] m_i = delta_h / (1 + abs(delta_h)) + (omega_max - omega_current) / (1 + abs(omega_max - omega_current)) # Equation 4

[0210] x_fusion = torch.cat([x_conv, x_rnn, m_i.unsqueeze(1)], dim=1)

[0211] attention_scores = F.softmax(torch.matmul(x_fusion,self.attention_weights), dim=0) # Dynamic weights

[0212] x_fused = torch.sum(attention_scores * x_fusion, dim=0) # Fused feature vector

[0213] # Third hidden layer: high-dimensional non-linear transformation

[0214] non_linear = self.fc_non_linear(x_fused)

[0215] gamma_term = torch.sum(self.gamma_weights * (non_linear + 0.1* torch.pow(non_linear, 2)))

[0216] delta_term = torch.sum(torch.matmul(non_linear, self.delta_weights) * non_linear)

[0217] x_transformed = F.sigmoid(gamma_term + delta_term) # Equation 5 and Equation 6

[0218] # Output layer: generate the target speed compensation value

[0219] output = self.output_layer(x_transformed.unsqueeze(0))

[0220] return output

[0221] The key to training this deep learning model includes data preparation, model training, loss optimization, and model evaluation. The following are the main steps.

[0222] First, prepare the training dataset, including data on pitch angular acceleration, roll angular acceleration, yaw angular acceleration, rate of change of barometric altitude, and current motor speed. These data are collected by sensors and paired with the target speed compensation value as the label for supervised learning. The feature data need to be normalized to unify the dimension and scale the amplitude, and sliding windows need to be constructed for time series features to capture dynamic changes.

[0223] When initializing the model, adopt a reasonable weight randomization method, such as Xavier initialization, and determine hyperparameters, such as the number of neurons in each layer, the learning rate, and the initial value of the attention mechanism weight, etc.

[0224] During the training process, choose the mean squared error (MSE) as the loss function and use the Adam optimizer to dynamically adjust the learning rate. Each training passes through mini-batch data for forward propagation and backward propagation. Forward propagation calculates the loss, and backward propagation optimizes the model weights. During training, the validation set is used to monitor the model performance in real time to ensure that the loss converges and there are no signs of overfitting. Regularization techniques such as Dropout layers and L2 regularization reduce the risk of overfitting.

[0225] After training is completed, evaluate the model performance on the test set to verify the accuracy and stability of the model in predicting the target speed compensation value. Finally, save the best weights for subsequent deployment.

[0226] Through the above steps, the model training can be completed, and its effectiveness and applicability in UAV motor control can be ensured.

[0227] Step S104: According to the target speed compensation value, combined with the preset fuzzy control rules, calculate the correction value of the PWM drive signal of the motor.

[0228] In step S104, according to the target speed compensation value calculated from the deep learning model, combined with the preset fuzzy control rules, calculate the correction value of the PWM drive signal of the motor.

[0229] First, the core of the fuzzy control rules lies in the fuzzy logic rules defined based on empirical knowledge and expert systems, which are used to handle the non-linear relationship between the target rotational speed compensation value and the current system state. These rules usually take the form of "if-then", for example, "if the pitch angular acceleration is large and the current rotational speed is low, then the duty cycle of the PWM drive signal needs to be increased". The specific design of the rules depends on the observation and summary of the UAV's dynamic characteristics in experiments.

[0230] When applying the fuzzy control rules, the input variables need to be fuzzified first. The target rotational speed compensation value is divided into several fuzzy sets, such as "small", "medium", "large", and each set is quantified through a membership function. The fuzzified inputs include the target rotational speed compensation value calculated by the deep learning model and possibly other auxiliary variables (such as the change rate of the current motor rotational speed). The form of the membership function can be triangular, trapezoidal, or Gaussian function, and its specific shape and range are calibrated through experimental data.

[0231] Next, the fuzzified input variables are substituted into the fuzzy rule base for inference. The inference process is based on fuzzy logic operations, such as min-max inference or weighted average inference, to synthesize the results of multiple rules. After the inference is completed, a fuzzified output result is obtained, which is the fuzzy description of the PWM drive signal correction value.

[0232] Finally, the fuzzified correction value needs to be converted into an actual numerical signal through a defuzzification method. Defuzzification usually adopts the centroid method, that is, the final output of the correction value is determined by calculating the centroid position of the fuzzy membership function. This correction value represents the amount of adjustment required for the duty cycle of the motor PWM drive signal in the current state.

[0233] The correction value obtained by defuzzification is superimposed on the basic PWM signal to generate the final corrected PWM drive signal. This signal can not only accurately compensate for the rotational speed of the motor according to the disturbance situation, but also respond to different flight state requirements by dynamically adjusting the duty cycle. In actual implementation, this process usually runs through a real-time algorithm on an embedded flight control processor to ensure high efficiency and accuracy.

[0234] Furthermore, calculating the correction value of the PWM drive signal of the motor according to the target rotational speed compensation value and in combination with preset fuzzy control rules includes:

[0235] Calculating the rotational speed error and the error change rate through the target rotational speed compensation value output by the deep learning model and the current motor rotational speed feedback value, where the rotational speed error is the difference between the target rotational speed compensation value and the current feedback value, and the error change rate is the change amount of the rotational speed error between consecutive time steps;

[0236] The rotational speed error and the error change rate are used as input parameters of the fuzzy control rule, and the input parameters are fuzzified based on a preset fuzzy membership function. The fuzzy membership function is pre-designed according to the experimental data of the motor response and the actual requirements of the flight mission, and is divided into multiple fuzzy sets;

[0237] Fuzzy inference is performed on the fuzzified input according to the fuzzy control rule base; during the inference process, the maximum-minimum composition method or the weighted average method is used to comprehensively process the results of multiple rules to ensure the accuracy and stability of the control logic;

[0238] The fuzzy inference result is defuzzified to generate an accurate PWM correction value. The defuzzification method uses the centroid method, and the numerical output of the PWM correction value is determined by calculating the centroid position of the fuzzy set; the PWM correction value represents the duty cycle adjustment amount of the motor PWM drive signal required in the current state.

[0239] In this embodiment, by combining the target rotational speed compensation value and the motor rotational speed feedback value, and using the preset fuzzy control rule, the correction value of the motor PWM drive signal is dynamically calculated, thereby realizing precise control of the motor rotational speed and adapting to the disturbance requirements in a complex flight environment. The specific implementation process is carried out through the following steps to ensure the accuracy and real-time performance of the entire control logic.

[0240] First, the rotational speed error and the error change rate are calculated through the target rotational speed compensation value output by the deep learning model and the current rotational speed feedback value collected by the motor sensor. The rotational speed error is the difference between the target rotational speed compensation value and the actual feedback rotational speed value, which is used to quantify the deviation of the current rotational speed from the ideal target. The error change rate represents the change rate of the rotational speed error between consecutive time steps, reflecting the dynamic trend of the motor response. These two parameters provide the basic input for subsequent fuzzy control and can comprehensively characterize the static deviation and dynamic change of the motor rotational speed.

[0241] Next, the rotational speed error and the error change rate are input into the fuzzification processing module of the fuzzy control rule. The fuzzification process converts the precise input parameters into fuzzy sets through a preset fuzzy membership function. The fuzzy membership function is pre-designed according to the actual response data of the motor and the requirements of the flight mission, and is usually divided into multiple fuzzy sets, such as "smaller", "medium" and "larger". The specific division of these sets is determined by experimental data and system debugging. For example, the fuzzy set of the rotational speed error can be realized by segmented mapping of the error value range. When the range is [-10, 10], the membership degree range of "smaller" is [-3, 3], "medium" is [-7, 7], and values outside this range are classified as "larger". Through the fuzzification process, the adaptability of the control system to uncertainty and complex dynamic conditions can be enhanced.

[0242] After fuzzification, fuzzy inference is performed on the fuzzified input parameters according to the fuzzy control rule base. The fuzzy rules are predefined in the form of "if - then", for example, "if the rotational speed error is large and the error change rate is small, then the PWM correction value should be increased". During the fuzzy inference process, the inference results of multiple rules are comprehensively processed through the max - min composition method or the weighted average method to ensure the accuracy and stability of the logic. For example, if multiple rules are triggered simultaneously, the system weights and superimposes the outputs of the rules according to the membership degrees of the input parameters to generate a comprehensive inference result.

[0243] The result of fuzzy inference is a fuzzy set, which needs to be converted into an accurate PWM correction value through a defuzzification method. The centroid method is used for defuzzification. By calculating the centroid position of the fuzzy set, the specific numerical output of the PWM correction value is determined. For example, if the fuzzy set contains multiple membership degree peaks, the centroid method generates a unique output value by performing a weighted average on the distribution of the membership function. The PWM correction value directly represents the duty cycle adjustment amount of the motor PWM drive signal in the current state and is a real - time compensation for the target rotational speed deviation.

[0244] Finally, the generated PWM correction value is superimposed on the existing PWM signal to form a corrected PWM drive signal. This signal acts on the motor in real - time, causing its rotational speed to gradually approach the target value, thereby achieving stable flight control.

[0245] Step S105: Apply the corrected PWM drive signal to the motor and collect the motor rotational speed feedback information in real - time, and dynamically adjust the weight parameters of the deep - learning model according to the feedback information.

[0246] In step S105, the corrected PWM drive signal calculated in step S104 is directly applied to the motor to drive the motor to operate at the desired rotational speed. This process requires the flight control system of the unmanned aerial vehicle to convert the correction signal into a drive pulse suitable for the motor, while ensuring the accurate transmission and real - time execution of the signal.

[0247] The application of the PWM drive signal is completed through the motor control circuit, usually generated by an embedded microcontroller to generate the corresponding PWM waveform. The corrected PWM signal is transmitted to the motor drive chip through a hardware interface, and the drive chip converts it into the actual motor input current to adjust the motor rotational speed. It should be noted that to ensure the stability and accuracy of the drive signal, the application of the signal requires anti - interference processing, such as adding a filter circuit, to prevent signal distortion caused by electromagnetic noise or hardware instability.

[0248] Meanwhile, during the process of applying the PWM signal to drive the motor, it is necessary to collect the rotational speed feedback information of the motor in real time. The rotational speed feedback is usually achieved through Hall sensors, optical encoders or other speed detectors. The collected rotational speed data is transmitted to the flight control system via a communication bus and compared with the current target rotational speed. The acquisition frequency of the feedback information needs to be high enough to ensure that the system can promptly sense the motor response and make necessary adjustments.

[0249] Based on the feedback information obtained in real time, the system dynamically adjusts the weight parameters of the deep learning model. This process is achieved through the online update strategy in reinforcement learning. Specifically, the model calculates the immediate reward value according to the error between the rotational speed feedback and the desired rotational speed, and uses this reward value to adjust the model parameters to gradually optimize the output performance of the model. The online adjustment adopts the gradient update method or other optimization algorithms to ensure that the model can adapt to the new dynamic conditions and improve the control accuracy under the changing flight states.

[0250] The entire process requires a high degree of coordination between the flight control system hardware and the algorithm software. On the one hand, the hardware needs to provide sufficient computing power and real-time performance to ensure the accuracy and rapidity of PWM signal generation, application, and feedback information acquisition; on the other hand, the algorithm part needs to efficiently process the real-time data stream and maintain the dynamic optimization of the system performance through online updates.

[0251] In the above manner, the corrected PWM drive signal can effectively control the motor operation, and at the same time, achieve closed-loop control and model optimization through the feedback loop.

[0252] Furthermore, applying the corrected PWM drive signal to the motor and collecting the rotational speed feedback information of the motor in real time, and dynamically adjusting the weight parameters of the deep learning model according to the feedback information, includes:

[0253] Apply the calculated corrected PWM drive signal to the motor through the motor control unit of the unmanned aerial vehicle to adjust the actual rotational speed of the motor;

[0254] Through the rotational speed sensor installed on the motor, collect the current rotational speed feedback information of the motor in real time;

[0255] Calculate the error between the actual motor rotational speed feedback value and the target rotational speed compensation value, and use the error as the immediate reward signal of the deep learning model, and dynamically adjust the weight parameters of the model through the reinforcement learning algorithm.

[0256] In this embodiment, by applying the corrected PWM drive signal to the unmanned aerial vehicle motor and using the rotational speed feedback information of the motor collected in real time, the weight parameters of the deep learning model are dynamically adjusted to achieve efficient and precise motor control.

[0257] To apply the calculated corrected PWM drive signal to the motor, it is first necessary to complete the signal conversion and execution through the motor control unit of the drone. The corrected PWM signal is transmitted to the control unit in the form of a duty cycle, which is used to adjust the input current of the motor, thereby changing the actual speed of the motor. The control unit converts the PWM signal into a drive current suitable for the motor, and directly affects the output power of the motor by adjusting the strength and time ratio of the input current. This process ensures the fast and accurate response of the PWM signal to the motor speed and is the core link of the entire motor control system.

[0258] During the operation of the motor, the current speed feedback information is collected in real time through a speed sensor installed on the motor. The speed sensor can use a Hall sensor or an optical encoder to generate continuous pulse signals according to the position and motion state of the motor rotor. The flight control system converts the collected pulse signals into motor speed values and eliminates environmental noise and signal jitter through a filtering algorithm (such as a low-pass filter) to obtain stable real-time speed data. These feedback data accurately reflect the current operating state of the motor and provide reliable inputs for subsequent calculations and model optimization.

[0259] According to the collected speed feedback information, calculate the error between the actual motor speed and the target speed compensation value. This error quantifies the deviation between the current output of the motor and the target state and is an important indicator for evaluating the performance of the control system. The calculation formula for the error is the target speed compensation value minus the current feedback value, and its positive or negative magnitude directly reflects the direction in which the motor needs to accelerate or decelerate. At the same time, the system dynamically monitors the error and evaluates the response ability of the motor by recording the historical change trend of the error.

[0260] Take the calculated error as the immediate reward signal of the deep learning model, and dynamically adjust the weight parameters of the model through the reinforcement learning algorithm. In the reinforcement learning framework, the smaller the error, the higher the reward value of the model, and vice versa. The model optimizes its objective function through this mechanism, thereby gradually adjusting the weight parameters of the neural network to adapt to the current flight state. The specific process of weight update is realized through the backpropagation algorithm. The error signal is transmitted to the hidden layer of the model, and the connection weights are adjusted layer by layer according to the network structure. This dynamic optimization process enhances the adaptive ability of the model and enables it to maintain stable control performance in a complex flight environment.

[0261] The entire method forms a closed-loop control system through the adjustment of the PWM signal, the real-time acquisition of speed feedback, and the dynamic optimization of the deep learning model, effectively improving the accuracy and response speed of the drone motor control.

[0262] The second embodiment of the present application provides an electronic device, and the electronic device includes:

[0263] Processor;

[0264] A memory for storing a program which, when read and executed by the processor, executes a method for controlling a motor in a drone provided in the first embodiment of the present application.

[0265] The third embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which when executed by a processor, executes a method for controlling a motor in a drone provided in the first embodiment of the present application.

[0266] Although the present application is disclosed above in preferred embodiments, it is not intended to limit the present application. Any person skilled in the art can make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the protection scope of the present application shall be subject to the scope defined by the claims of the present application.

Claims

1. A method for controlling a motor in a drone, characterized in that: include: Acquire the attitude data, air pressure altitude data and current speed data of the motor during the flight of the drone, wherein the attitude data includes pitch angle, roll angle and yaw angle; Based on the attitude data, the pitch acceleration, roll acceleration and yaw acceleration of the drone are calculated, and according to a preset threshold, it is determined whether the current drone is in an airflow disturbance state; When it is determined that the vehicle is in an airflow disturbance state, a target speed compensation value of the motor is calculated based on a pre-trained deep learning model, wherein the input parameters of the deep learning model include: pitch angular acceleration, roll angular acceleration, yaw angular acceleration, pressure altitude change rate, and current motor speed; According to the target speed compensation value, combined with the preset fuzzy control rule, a correction value of the PWM drive signal of the motor is calculated; The corrected PWM drive signal is applied to the motor, and the motor speed feedback information is collected in real time, and the weight parameters of the deep learning model are dynamically adjusted according to the feedback information.

2. The method for controlling a motor in a drone according to claim 1, characterized in that: The acquisition of the attitude data, the air pressure altitude data and the current speed data of the motor during the flight of the drone includes: The inertial measurement unit equipped with the drone collects pitch angle, roll angle and yaw angle in real time. The inertial measurement unit measures linear acceleration and angular velocity through accelerometers and gyroscopes and generates stable attitude data using data fusion algorithms. The ambient air pressure is obtained through the barometer and compensated with the real-time temperature data to calculate the pressure altitude. At the same time, the pressure altitude data is adjusted in real time based on the initial calibration value of the flight controller to adapt to different flight environments; The current speed data of the motor is collected through the Hall sensor or optical encoder of the motor, and the collected speed signal is filtered and interpolated to enhance the continuity and accuracy of the data; The collected data are synchronously integrated through the timestamp alignment method to generate a joint state vector of attitude, altitude and rotation speed.

3. The method for controlling a motor in a drone according to claim 1, characterized in that: The step of calculating the pitch acceleration, roll acceleration and yaw acceleration of the drone based on the attitude data includes: The pitch angle, roll angle and yaw angle data are collected in real time through the inertial measurement unit to form time series data respectively, where the attitude angle data at each time point is sampled by the sensor and stored in the cache of the flight control system in chronological order; Based on the smoothed attitude angle time series data, the pitch angular velocity, roll angular velocity and yaw angular velocity are calculated by a first difference method, where the angular velocity of each time step is obtained by dividing the attitude angle change value between the current time step and the previous time step by the sampling time interval; The calculated angular velocity sequence is used to calculate the pitch angular acceleration, roll angular acceleration and yaw angular acceleration through the quadratic difference method, where the angular acceleration of each time step is obtained by dividing the angular velocity change between the current time step and the previous time step by the sampling time interval.

4. The method for controlling a motor in a drone according to claim 1, characterized in that: The step of judging whether the current drone is in an airflow disturbance state according to a preset threshold value includes: Get the pitch angle acceleration 、Roll angular acceleration , yaw angular acceleration and the rate of change of pressure altitude ; For the pitch angular acceleration 、Roll angular acceleration , yaw angular acceleration Perform normalization to obtain the normalized pitch angle acceleration , normalized roll angular acceleration And the normalized yaw acceleration ; According to the following formula 1, the disturbance state index is calculated : ; in, , , and is the weighting coefficient; The calculated disturbance state index With preset threshold Compare, if satisfied , then it is judged that the UAV is in a state of airflow disturbance.

5. The method for controlling a motor in a drone according to claim 1, characterized in that: The deep learning model includes an input layer, a first hidden layer, a second hidden layer, a third hidden layer and an output layer; The input layer is used to receive the pitch acceleration, roll acceleration, yaw acceleration, pressure altitude change rate and current motor speed data, and normalize the received data, specifically including unifying the dimensions and scaling the amplitudes of different input data to generate standardized feature data; The first hidden layer is used to receive the standardized feature data provided by the input layer, and to process the received standardized feature data of the pitch acceleration, the roll acceleration and the yaw acceleration through two parallel sub-networks; wherein the first sub-network is implemented by a convolutional neural network structure, and is used to extract features from the received standardized feature data of the pitch acceleration, the roll acceleration and the yaw acceleration, and generate local features describing the disturbance characteristics; the second sub-network is implemented by a recursive neural network structure, and is used to process the time series in the received standardized feature data of the pitch acceleration, the roll acceleration and the yaw acceleration, and capture the dynamic change characteristics, and generate time series features; The second hidden layer is used to receive the local features and time series features output by the first hidden layer, and fuse them with the standardized features of the pressure altitude change rate and the current motor speed to generate a fused feature vector; the second hidden layer is implemented by a fully connected network, and the weights of different features are dynamically allocated in combination with the attention mechanism; The third hidden layer is used to receive the fused feature vector and process the fused feature vector through a deep fully connected network, specifically including performing a high-dimensional nonlinear transformation on the fused feature vector to generate a preliminary prediction of the target speed compensation value; during the fusion process, the third hidden layer reduces the overfitting risk of the model through regularization technology and uses activation functions to improve the model's ability to express complex nonlinear relationships; The output layer receives the preliminary prediction from the third hidden layer, and performs correction in combination with the historical flight data to generate a target rotation speed compensation value.

6. The method for controlling a motor in a drone according to claim 5, characterized in that: The second hidden layer generates a fused feature vector through feature fusion and attention allocation mechanism according to the following formula 2: ; in, is the fused feature vector; Indicates Class features, including local features, time series features, pressure altitude change rate features and motor speed features; is the number of features that need to be fused; For the The dynamic weight of the class feature is calculated according to the following formula 3: ; in, For the The weight parameter matrix related to class features; For the The weight parameter matrix related to class features; is a static adjustment coefficient that is independent of the flight mode; It is the dynamic adjustment coefficient related to the flight mode; For the Class characteristics; is the number of features that need to be fused; is the flight mode value, is the flight mode value; Calculated according to the following formula 4: ; in, is the rate of change of pressure altitude; is the current motor speed; It is the maximum value of the motor speed in the historical data.

7. The method for controlling a motor in a drone according to claim 6, characterized in that: The third hidden layer optimizes the complex relationship between fused features through high-dimensional nonlinear transformation, and specifically uses the following formula 5 to process the fused feature vector: ; in, represents the feature vector after high-dimensional nonlinear transformation, which is used to generate a preliminary target speed compensation value; Represents the total number of fused features passed from the second hidden layer to the third hidden layer; Representation and Fusion The associated nonlinear enhancement weights; is a coefficient related to the flight mission and environment; is the output of the second hidden layer. Fusion features; is the output of the second hidden layer. Fusion features; For the Fusion features and Fusion features The interaction weight coefficient of As the activation function, the following formula 6 is used: ; in, is the gain factor adjusted according to the current disturbance intensity, represents the input variable, as shown in the following formula 7: ; The meanings of the terms in Formula 7 are the same as those in Formula 5.

8. The method for controlling a motor in a drone according to claim 5, characterized in that: The size and number of convolution kernels of the first subnetwork in the first hidden layer are determined according to the flight characteristics of the UAV; at the same time, the coverage capability of the feature space is improved by increasing the number of convolution kernels, thereby enhancing the recognition of complex disturbance patterns.

9. The method for controlling a motor in a drone according to claim 1, characterized in that: The method of calculating the correction value of the PWM drive signal of the motor according to the target speed compensation value and combining the preset fuzzy control rule includes: The speed error and error change rate are calculated through the target speed compensation value output by the deep learning model and the current motor speed feedback value, where the speed error is the difference between the target speed compensation value and the current feedback value, and the error change rate is the change in the speed error between consecutive time steps; The speed error and the error change rate are used as input parameters of the fuzzy control rule, and the input parameters are fuzzified based on a preset fuzzy membership function, wherein the fuzzy membership function is pre-designed according to the experimental data of the motor response and the actual requirements of the flight mission, and is divided into a plurality of fuzzy sets; Perform fuzzy reasoning on the fuzzified input according to the fuzzy control rule base; in the reasoning process, use the maximum-minimum synthesis method or weighted average method to comprehensively process the results of multiple rules; The fuzzy inference result is defuzzified to generate an accurate PWM correction value, wherein the defuzzification method adopts the centroid method to determine the numerical output of the PWM correction value by calculating the centroid position of the fuzzy set; the PWM correction value represents the duty cycle adjustment amount of the motor PWM drive signal required under the current state.

10. The method for controlling a motor in a drone according to claim 1, characterized in that: The modified PWM drive signal is applied to the motor, and the motor speed feedback information is collected in real time, and the weight parameters of the deep learning model are dynamically adjusted according to the feedback information, including: The calculated corrected PWM drive signal is applied to the motor through the motor control unit of the drone to adjust the actual speed of the motor; The speed sensor installed on the motor collects the current speed feedback information of the motor in real time; The error between the actual motor speed feedback value and the target speed compensation value is calculated, and the error is used as an immediate reward signal for the deep learning model. The weight parameters of the model are dynamically adjusted through the reinforcement learning algorithm.

Citation Information

Patent Citations

  • Unmanned aerial vehicle attitude control system

    CN111367308A

  • Anti-interference rotating speed control method suitable for manned electric helicopter motor

    CN115208258A