Unmanned aerial vehicle attitude prediction control method
Through singular spectrum analysis and improved LSTM model preprocessing data, combined with fuzzy neural PID controller, the problem of drone attitude loss is solved, significantly improving the stability and robustness of the system.
Patent Information
- Application Number
- CN202410850547.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-11-01
AI Technical Summary
The existing drone attitude control methods are difficult to effectively deal with the problem of attitude loss caused by system failure and external interference, and the single algorithm control leads to insufficient system robustness.
Singular spectrum analysis (SSA) data preprocessing technology, combined with improved LSTM model and fuzzy neural PID controller, a drone attitude prediction control method was constructed. SSA is used for denoising and extracting data trends, LSTM model is used for pose prediction, and fuzzy neural PID controller is used for adaptive parameter adjustment, enhancing system stability and robustness.
It realizes effective resistance to system and environmental disturbances, improves the stability and robustness of the drone, and significantly improves the stability of the system compared with a single algorithm control method.
Smart Images

Figure CN118884993A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of unmanned aerial vehicles, and in particular to a method for predicting and controlling the attitude of an unmanned aerial vehicle. Background Art
[0002] Currently, drones have been widely used in both military and civilian fields. They are required to operate safely in urban areas to complete many complex tasks such as reconnaissance, detection, and power inspection. Therefore, ensuring the stability of the drone system can significantly improve the drone's work efficiency and environmental safety.
[0003] In recent years, with the continuous expansion of drone application scenarios, drone flight attitude estimation technology has also been developing. In this regard, many scholars have proposed many control methods. For example: the traditional one uses the linear efficiency maneuverability model design of drones; the drone backstepping control, the idea is to separate the nonlinear disturbance observer and the controller; however, the above control methods are difficult to deal with the attitude out-of-control problem caused by large external interference and system failure; at the same time, there is currently a reference to neural network models in the traditional control field for auxiliary control, but single algorithm control may lead to insufficient system robustness.
[0004] Therefore, the present invention proposes a UAV attitude prediction control method based on the UAV fuzzy control system, combined with the UAV attitude data changes and the neural network model. Summary of the invention
[0005] The present invention aims to solve the problem of whole machine instability caused by UAV's own system failure or external environmental factors, and further provide a UAV attitude prediction control method.
[0006] The present invention relates to a method for predicting and controlling the attitude of an unmanned aerial vehicle, and the method mainly comprises the following steps:
[0007] Step 1: SSA (singular spectrum analysis) data preprocessing;
[0008] Step 2: Improve LSTM model construction;
[0009] Step 3: Construction of fuzzy neural PID controller;
[0010] Step 4: Build the drone system.
[0011] Step 1: SSA data preprocessing
[0012] The sensor collects various data generated by the drone in different environments, including speed, acceleration, pitch angle, roll angle, and heading angle. Considering that the sensor data may be subject to various interferences during the flight of the drone, such as electromagnetic interference and mechanical vibration, signal processing technology is used to pre-process the data. The SSA algorithm can extract trends, periodic oscillations, and noise components from the original time series data, thereby analyzing and denoising the time series generated by the sensor, and is suitable for analyzing time series with potential regularities. SSA is used to pre-process the original data to improve the LSTM model's ability to grasp the data. Singular spectrum analysis includes matrix construction, singular value decomposition, feature grouping, and main component reconstruction.
[0013] (1) Constructing a matrix: By constructing a matrix, the original sequence data is converted into a matrix form to prepare for the subsequent singular value decomposition. Suppose a time series is X N =(x1, x2, ..., x N ), N>2, and requires X N is a non-zero sequence; the time series is decomposed and embedded into a space with a window length of L to form a trajectory matrix X;
[0014]
[0015] Where: K = N-L+1, N is the length of the time series;
[0016] (2) Singular Value Decomposition
[0017] Calculate the matrix XX T And perform singular value decomposition to obtain L eigenvalues λ(λ1,λ2,...,λ L ), and the corresponding eigenvectors U1, U2, ..., U L ; Decompose X into several elementary matrices with the same structure:
[0018] X=E1+E2+...E d (2)
[0019] Where d = rank(X), E i represents the i-th singular value decomposition component, and its mathematical model is expressed as:
[0020]
[0021] Where: U i and Indicated as XX T The i-th left and right singular vectors; are the singular values of the trajectory matrix X in descending order;
[0022] (3) Feature Grouping
[0023] Cumulative contribution rate through singular values Divide the elementary matrix into k disjoint subsets and sort the matrices according to the contribution rate. The larger the contribution rate, the greater the contribution of the matrix in the time series.
[0024] (4) Reconstruction of main components
[0025] Through principal component reconstruction, each elementary matrix in equation (2) can be converted into a time series by diagonal averaging. Define Z as an L×K-order matrix whose elements are z i,j (1≤i≤L, 1≤j≤K), let L * =min(L,K),K * =max(L,K), if L<K, on the contrary The formula for calculating the diagonal average is:
[0026]
[0027] In the SSA algorithm, after multiple sensitivity analyses, the length of the original time series is 500. We try different L values and compare the stability and accuracy of the results. We select L = 240 as the optimal window length. We decompose the original sequence data and group them according to the contribution rate. We reconstruct the trajectory data with a large contribution rate into three components: trend term, period term, and noise residual term. Step 2: Improve LSTM model construction
[0028] LSTM is a special type of recurrent neural network. For the reconstructed data output by SSA, it is considered as a feature of the LSTM model δ is composed of 5 components, including velocity v, acceleration a, pitch angle Roll angle θ, heading angle ψ, the corresponding LSTM model input will have 5 features. The data collected under different wind speed and direction environments are classified, and LSTM training is performed under different wind speed and direction as prerequisites, so that LSTM learning can make accurate predictions based on past information.
[0029] (1) LSTM composition. The key components of LSTM include the cell state, the forget gate f t , input gate i t , output gate o t These gating units allow LSTM to selectively remember and forget information when processing sequence data, thereby better capturing long-term dependencies. The three gates of LSTM function as follows:
[0030] 1) Forget gate: used to control whether to forget the information in the previous memory cell state. Memory cells are the key part of LSTM responsible for storing and transmitting information. The formula is:
[0031] f t =σ(W f [h t-1 , X t ]+b f ) (5)
[0033] Where: f t represents the forget gate, W f is the weight matrix of the forget gate, [h t-1 , X t ] means to change the hidden state h of the previous moment t-1 and the current input X t Merge into a vector, b f represents the bias term of the forget gate, and σ represents the sigmoid function.
[0034] 2) Input gate: used to control whether the current input information is added to the memory cell state. The input data is controlled by the input gate to control whether it is input into the memory cell state. The formula is:
[0035] i t =σ(W i [h t-1 , X t ]+b i ) (6)
[0037] c t =f t ·c t-1 +i t tanh(W c [h t-1 , X t ]+b c (7)
[0039] Where: i t is the output of the input gate, indicating the amount of information that should be updated to the memory cell at the current moment, i t ∈(0,1);W i is the weight matrix of the input gate; W c represents the input gate weight matrix; b c represents the bias term of the output gate; b i represents the input gate bias term; c t Represents the input state of the memory cell at time t.
[0040] 3) Output gate: used to control the information output from the memory cell state to the hidden state. When using LSTM for prediction, the sensor data is input into the input gate of the LSTM model. The information extracted from the memory cell state is combined with the output of the LSTM to generate and output the posture prediction result. The formula is:
[0041] o t =σ(W o [h t-1 , X t ]+b o ) (8)
[0042] h t =o t ·tanh(c t ) (9)
[0043] In the formula: o t is the output of the output gate, W o is the weight matrix of the output gate, b o represents the bias term of the forget gate, h t represents the hidden state at time t.
[0044] (2) LSTM model improvement. In order to enhance the expressiveness and adaptability of the LSTM model for the high-precision drone system, a dynamic adjustment of the LSTM network structure is proposed. Based on the gradient signal, the connection mode between LSTM units is defined as variable. According to the different characteristics and importance of the input sequence, the number of layers and units of the LSTM network is dynamically adjusted to improve the performance of the model.
[0045] The above LSTM model is used as the initial neural network, assuming that it contains B (B is a dynamic value) hidden layers, which correspond to B-1 gate control units. Introduce a label vector m (b) , the symbol b represents the number of layers in the LSTM model, m (b) The value is 0 or 1. The gradient of the error signal is used to determine the number of layers. First, the loss function is calculated with respect to The gradient of is obtained according to the forward propagation equation of the LSTM model:
[0046]
[0047]
[0048] Calculate c t gradient:
[0049]
[0050] Where tanh′ is the tanh derivative. Based on the above formula, we can get Gradient, the formula is:
[0051]
[0052] represents the output of the forget gate, is the link parameter, according to the above formula, If it is smaller, it means that the weight of the previous layer of information is smaller, so m (b-1) If it is 0, the layer is deleted. If it is larger, it means that the weight of the current layer is larger, so m (b-1) To 1, increase the number of layers.
[0053] The above dynamic adjustment method dynamically adjusts the number of layers and units of the LSTM network according to the different characteristics of the input sequence, making the model more adaptable to different types of data and tasks. At the same time, it reduces the computing cost, so that the model can maintain performance while reducing computing resource consumption.
[0054] The components decomposed and reconstructed by SSA are predicted using the LSTM model respectively, and finally the prediction results of each component are superimposed to obtain the posture prediction value.
[0055] Step 3: Construction of Fuzzy Neural PID Controller
[0056] (1) Construct a fuzzy controller. A fuzzy system is an inference system based on fuzzy theory and fuzzy reasoning technology. Compared with traditional precise mathematical models and control methods, fuzzy systems have stronger robustness and are more suitable for the control of complex and nonlinear systems. Combining relevant UAV control literature and actual research experience in the field, a comprehensive analysis of the UAV system response speed, stability, and parameter overshoot factors is conducted to construct a UAV fuzzy control table. The PID correction formula is:
[0057]
[0058] Where k p , k i , k d They are three correction parameters, Δk p , Δk i , Δk d They are proportional, integral and differential control parameters respectively.
[0059] The fuzzy control quantity of the UAV is divided into NB (negative large), NM (negative medium), NS (negative small), ZO (zero), PS (positive small), PM (positive medium), PB (positive large), thus obtaining a seven-level fuzzy subset {NB, NM, NS, ZO, PS, PM, PB}, and the membership function is selected as a trigonometric function. According to the analysis of proportional, integral, differential action and actual control of the UAV, when the absolute value error e is large, the Δk p The value increases; Δki The value should also be increased to reduce the error; Δk d It should be appropriately increased to ensure the dynamic characteristics of the system. The same applies to other situations.
[0060] (2) Construct a fuzzy neural PID controller. Jang Roger of the University of California first proposed the adaptive neural fuzzy inference system (ANFIS) in 1993. The adaptive neural fuzzy inference system not only has the self-learning mechanism of neural networks, but also has the language reasoning ability of fuzzy logic systems. This system combines the self-learning ability of neural networks with fuzzy logic reasoning methods, focusing on the three key steps of fuzzy control systems: fuzzification, fuzzy logic reasoning, and clarification. ANFIS uses neural network algorithms to optimize fuzzy control systems, obtains numerical solutions through training and processing of sample data, and improves performance and efficiency.
[0061] Through the above steps, a fuzzy neural PID controller with automatic adjustment and control function is obtained.
[0062] Step 4: Drone system construction
[0063] The construction of the UAV system mainly includes the UAV flight control algorithm, the UAV attitude prediction control algorithm, and the hardware system configuration selection.
[0064] (1) UAV flight control algorithm. The UAV flight control algorithm includes the main algorithm and the auxiliary algorithm. The main algorithm mainly includes UAV control, navigation and positioning, path planning and trajectory tracking, and system self-stabilization control algorithm. The auxiliary algorithm mainly includes communication, filtering, data transmission, main loop, task scheduling, remote control signal data processing, PWM output module and timer, electronic compass, barometer, onboard storage chip, and laser module driver.
[0065] (2) UAV attitude control algorithm. The SSA algorithm preprocesses the data; the improved LSTM model uses the dynamic adjustment network structure method to predict P, I, and D based on the input data; the fuzzy PID controller uses the difference between the predicted value and the ideal attitude as input to adapt the PID value. The above works together to achieve system attitude prediction control.
[0066] (3) Hardware system configuration selection. The drone hardware system includes the main control system and basic accessories. The main control system includes the main processor, coprocessor and sensor unit. The main algorithm processor uses NVIDIA AGX Orin, which belongs to the edge computing platform. The coprocessor uses STM32F405, ARM Cortex-M4 32-bit RISC processor. The sensor unit mainly includes speedometer, accelerometer, gyroscope, thermometer, and GPS. Basic accessories include Tarot4012 / 320KV motor, 16-inch propeller, 680mm four-axis frame, AT92.4G remote control, 4S40A electric speed controller, and 4500mAh-4s (14.8V) battery.
[0067] Beneficial Effects
[0068] The present invention estimates the state of the system in real time and gives feedback. The SSA and improved LSTM model continuously update the attitude prediction value. The system calculates the predicted value and the ideal attitude value, and obtains e and ec by making a difference, which are input into the fuzzy controller. The P, I, and D parameter control of the drone is realized by the fuzzy neural PID controller. The above key algorithms cooperate with each other, so that the drone can effectively resist the disturbance in the system and the environment, suppress the interference caused by the outside world to the system, and improve the stability and robustness of the system. At the same time, compared with the single algorithm control method, the system stability is more prominent. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 Fuzzy controller schematic diagram
[0070] Figure 2 SSA and improved LSTM training flow chart
[0071] Figure 3 System workflow diagram
[0072] Figure 4 Comparison of attitude angles in disturbed environments DETAILED DESCRIPTION
[0073] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0074] The present invention is further described below in conjunction with embodiments. It should be noted that various modifications or additions made by technicians in the technical field to the described specific embodiments or replacements made by similar methods shall be deemed to fall within the protection scope of the present invention as long as they do not deviate from the concept of the invention or exceed the scope defined by the claims.
[0075] A method for predicting and controlling the attitude of an unmanned aerial vehicle of the present invention comprises the following steps:
[0076] Step 1: The drone's onboard sensors collect various data generated by the drone during operation, including speed, acceleration, pitch angle, roll angle, and heading angle, which are expressed as X N =(x1, x2, ..., x N ).
[0077] 1) Build the matrix
[0078] Convert the above sensor raw sequence data into matrix form:
[0079]
[0080] In the formula, K=N-L+1, N is the length of the time series.
[0081] 2) Singular Value Decomposition
[0082] Calculate the matrix XX T And perform singular value decomposition to obtain L eigenvalues λ(λ1,λ2,...,λ L ), and the corresponding eigenvectors U1, U2, ..., U L . Decompose X into several elementary matrices with the same structure:
[0083] X=E1+E2+...E d (2)
[0084] Where d = rank(X), E i represents the i-th singular value decomposition component, and its mathematical model is expressed as:
[0085]
[0086] Where: U i and Indicated as XX T The i-th left and right singular vectors; are the singular values of the trajectory matrix X in descending order.
[0087] 3) Feature Grouping
[0088] Cumulative contribution rate through singular values Divide the elementary matrix into k disjoint subsets. Sort the matrices according to the contribution rate. The larger the contribution rate, the greater the contribution of the matrix in the time series.
[0089] 4) Reconstruction of main components
[0090] Through principal component reconstruction, each elementary matrix in equation (2) can be converted into a time series by diagonal averaging. Define Z as an L×K matrix whose elements are z i,j(1≤i≤L, 1≤j≤K), let L * =min(L,K),K * =max(L,K), if L<K, on the contrary The formula for calculating the diagonal average is:
[0091]
[0092] In step 2, the data preprocessed by SSA is fed into the LSTM network and the dynamic network structure is adjusted to adapt the model to different types of data. The reconstructed data output by SSA is regarded as a feature of the LSTM model. δ is composed of 5 components, including velocity v, acceleration a, pitch angle Roll angle θ, heading angle ψ, the corresponding LSTM model input will have 5 features.
[0093] 1) Forget gate: used to control whether to forget the information in the previous memory cell state. Memory cells are the key part of LSTM responsible for storing and transmitting information. The formula is:
[0094] f t =σ(W f [h t-1 , X t ]+b f ) (5)
[0096] Where: f t represents the forget gate, W f is the weight matrix of the forget gate, [h t-1 , X t ] means to change the hidden state h of the previous moment t-1 and the current input X t Merge into a vector, b f represents the bias term of the forget gate, and σ represents the sigmoid function.
[0097] 2) Input gate: used to control whether the current input information is added to the memory cell state. The input data is controlled by the input gate to control whether it is input into the memory cell state. The formula is:
[0098] i t =σ(W i [h t-1 , X t ]+b i ) (6)
[0100] c t =f t ·ct-1 +i t tanh(W c [h t-1 , X t ]+b c (7)
[0102] Where: i t is the output of the input gate, indicating the amount of information that should be updated to the memory cell at the current moment, i t ∈(0,1);W i is the weight matrix of the input gate; W c represents the input gate weight matrix; b c represents the bias term of the output gate; b i represents the input gate bias term; c t Represents the input state of the memory cell at time t.
[0103] 3) Output gate: used to control the information output from the memory cell state to the hidden state. When using LSTM for prediction, the sensor data is input into the input gate of the LSTM model. The information extracted from the memory cell state is combined with the output of the LSTM to generate and output the posture prediction result. The formula is:
[0104] o t =σ(W o [h t-1 , X t ]+b o ) (8)
[0106] h t =o t ·tanh(c t ) (9)
[0108] In the formula: o t is the output of the output gate, W o is the weight matrix of the output gate, b o represents the bias term of the forget gate, h t represents the hidden state at time t.
[0109] At the same time, the gradient signal is introduced to define the connection mode between LSTM units as variable.
[0110] The above LSTM model is used as the initial neural network, assuming that it contains B (B is a dynamic value) hidden layers, which correspond to B-1 gate control units. Introduce a label vector m (b) , the symbol b represents the number of layers in the LSTM model, m (b)The value is 0 or 1. The gradient of the error signal is used to determine the number of layers. First, the loss function is calculated with respect to The gradient of is obtained according to the forward propagation equation of the LSTM model:
[0111]
[0112] Calculate c t gradient:
[0113]
[0114] Where tanh′ is the tanh derivative. Based on the above formula, we can get Gradient, the formula is:
[0115]
[0116] represents the output of the forget gate, is the link parameter, according to the above formula, If it is smaller, it means that the weight of the previous layer of information is smaller, so m (b-1) If it is 0, the layer is deleted. If it is larger, it means that the weight of the current layer is larger, so m (b-1) To 1, increase the number of layers.
[0117] In step 3, (1) a fuzzy controller is constructed to comprehensively analyze the response speed, stability, and parameter overshoot factors of the UAV system, and a fuzzy control table for the UAV is constructed, where the PID correction formula is:
[0118]
[0119] Where k p , k i , k d They are three correction parameters, Δk p , Δk i , Δk d They are proportional, integral and differential control parameters respectively;
[0120] The fuzzy control quantity of the UAV is divided into NB (negative large), NM (negative medium), NS (negative small), ZO (zero), PS (positive small), PM (positive medium), and PB (positive large), thereby obtaining a seven-level fuzzy subset {NB, NM, NS, ZO, PS, PM, PB}, and the membership function is selected as a trigonometric function. According to the analysis of the proportional, integral, differential action and the actual control of the UAV, it is concluded that when the absolute value error e is large, the Δk p The value increases; Δk i The value should also be increased to reduce the error; Δk d It should be appropriately increased to ensure the dynamic characteristics of the system;
[0121] (2) Construct a fuzzy neural PID controller. The adaptive neural fuzzy inference system (ANFIS) uses a neural network algorithm to optimize the fuzzy controller. By training and processing sample data to obtain a numerical solution, a fuzzy neural PID controller with automatic adjustment and control function is obtained.
[0122] The neural PID controller is introduced into fuzzy control. The fuzzy neural PID used in this method adopts a hybrid learning inference algorithm. Relying on the error back propagation algorithm introduced with the least squares method, the input and output data are systematically trained and learned and analyzed. The hybrid algorithm is applied to the training data to optimize the domain of the membership function and the fuzzy rule data respectively.
[0123] The training data comes from the input and output of the drone equipped with SSA, improved LSTM model and fuzzy neural PID controller. Since the fuzzy neural controller only supports multiple inputs and single output, P, I and D are trained separately. The data is divided into three groups, each group represents the training data of P, I and D. The input is the error e between the prediction results of SSA and improved LSTM model and the ideal posture and its change rate ec, and the output is k output of the fuzzy controller. p , k i , k d .
[0124] In step 4, build the basic flight control algorithm of the drone, the attitude prediction control algorithm of the drone, and the hardware system configuration selection. The flight control algorithm of the drone includes drone control, navigation and positioning, path planning and trajectory tracking, and system self-stabilization control algorithm; the attitude control algorithm of the drone combines the algorithms in steps 1, 2, and 3 above to realize the attitude prediction control of the system. The attitude prediction control algorithm is based on the ARM architecture, the Pytorch platform, and the Python language is used for development. The Pycharm Professional software program is compiled and the model is trained.
[0125] The research environment of the present invention is a real machine flight and a computer simulated flight environment. Since the environmental factors during the operation of the UAV cannot guarantee the integrity of the experiment, real machine flight and computer simulated flight are used together for research. The experimental scene in this example is different wind environments under the condition of the UAV hovering.
[0126] The configurations of the drones are the same in different environments. The actual flight wind is provided by the outside world, and the computer simulation flight wind is generated by the algorithm. In the study, the drone was designed to hover at a certain height. Under different wind conditions, the algorithm was triggered to perform attitude stabilization control. After the experiment lasted for a period of time, the data was recorded and the experiment was repeated in a different environment. During the entire experiment, the attitude prediction control algorithm adjusted the attitude of the drone to avoid large changes in the attitude of the drone causing the system to lose control.
[0127] In order to obtain the real reference data of the UAV attitude, 45 flight experiments were conducted in the actual outdoor test site and the Airsim-unreal simulation system. At a sampling frequency of 100Hz, a total of 54,235 sets of data generated by the UAV operating in different environments were collected. These data include speed, acceleration, pitch angle, roll angle, and heading angle values. After collection, the data was denoised and finally a total of 52,934 sets of valid data were obtained.
[0128] The historical data is preprocessed using the SSA algorithm and then input into the LSTM network for training. This method uses the SSA method to process data, improve data quality, and enhance the accuracy and stability of the subsequent improved LSTM model.
[0129] After performing singular value decomposition on the sensor time series, the contribution rate is descending, and the first item has the largest contribution rate, which is a high-frequency time series containing information, and is reconstructed as a trend item; the reconstruction components of the periodic item and the noise residual item are selected, and the sudden inflection point of the contribution rate change rate is used as the boundary. The components before (including) the inflection point are used as the reconstruction components of the periodic item, and the components after the inflection point are used as the reconstruction components of the noise residual item. Therefore, the combination matrices corresponding to the second to fourth contribution rates, which contain low-frequency time series of periodic information, are reconstructed as periodic items, and the remaining combination matrices are reconstructed as noise residual items.
[0130] In the process of establishing the improved LSTM model, these data are divided into training set, test set and validation set. Specifically, the first 20,000 groups of data are selected as training sets, the second 20,000 groups of data are selected as test sets, and the remaining 12,934 groups of data are used as model validation sets. At the same time, the gradient signal method is used to substitute the LSTM neural network model for training. After the training is completed, the performance of the model is evaluated, and the root mean square error is 0.2236, and the model performance is good; the energy consumption index is used to judge the effect of model improvement. Compared with the traditional LSTM model, the energy consumption of the improved LSTM model is reduced by about 11.18%, and the battery life of the whole machine is increased by about 5 minutes. The improved LSTM prediction model posture is obtained after training.
[0131] In the training of neural network fuzzy controller, 70% of the data is randomly selected into the training set, and the remaining data is divided into the test set and the validation set. The neural fuzzy network model trained by this division method has better prediction ability and is not prone to overfitting. The error back propagation algorithm with the least squares method is used to train the network model for P, I, and D respectively. The epochs of the training set and the test set are both 50, and the training error coefficient should be designed to reach 0.1. Since the neural network has only one output, P, I, and D are trained separately. After multiple trainings, the root mean square error of the training set and the test set is less than 0.1. The model shows a good fitting effect on the training set and the test set, which meets the design requirements.
[0132] After completing the system code design, the system is comprehensively tested. The test process includes drone hovering and flight tests in different environments, drone pull-off stability tests, system endurance tests before and after algorithm deployment, and algorithm stability tests.
[0133] After the experimental drone hardware is built, connect it to the ground station and adjust various basic parameters before taking off, so that the drone can stably complete basic hovering flight, and can record all real-time data generated during the flight of the drone in the log. Use the Origin tool to visualize and analyze the data. Set the initial drone position parameters to [0,0,0] and the attitude angle parameters to [0,0,0]. Perform a total of 50 experiments in different environments (5 experiments in each environment) and obtain the following results:
[0134] There was no problem of the drone losing control during the hovering and flight tests; in the flight test along the preset path, stable flight and stable data transmission were maintained within a range of five kilometers, and the average flight deviation error was 3.4%; in the endurance test, the flight time was reduced from 46 minutes to 39 minutes after the algorithm was deployed, a decrease of about 15.22%; in the algorithm stability experiment, the abnormal data output accounted for about 2.72% in the 12-hour simulation run, and the model prediction performance was good.
[0135] In the indoor experiment, external disturbances were artificially added to the drone, and the drone attitude angle data was collected for comparative analysis. The experimental results show that in the presence of external random disturbances, the traditional PID controller will cause the fuselage to vibrate with a relatively obvious small amplitude and several large amplitude attitude changes. In the disturbance environment, the controller in this paper controls the amplitude of the jitter angle change by 2 0 to -2 0 Within this range, the fuselage attitude oscillation caused by external disturbances can be effectively suppressed.
[0136] Under the condition of outdoor natural wind, indoor and outdoor flight experiments and hovering experiments were carried out for the drone under the action of PID controller and the controller proposed in this paper. The attitude angle of the drone under the external disturbance of PID controller and the controller proposed in this paper was compared, and the attitude angle jitter frequency and jitter amplitude were used as system stability evaluation indicators. The experimental results show that when the external disturbance is large, the position change of the traditional PID controller is larger than the position error and oscillation under the controller of this paper, and the pitch and roll angles both have large oscillations. The overall effect of the controller in this paper is good, reflecting a relatively stable and smooth control effect.
[0137] Comparing the SSA preprocessed data and the original data noise, the LSTM training loss function after preprocessing is reduced by 17% compared with the original data LSTM training loss function; by comparing the LSTM algorithm with the SSA and improved LSTM algorithms, it is found that SSA and improved LSTM can reduce interference information, provide better input representation, and improve the robustness and stability of the model as well as the LSTM's ability to grasp sequence features.
[0138] Comparing the original data curves of the attitude of the drone with the traditional PID controller and the controller in this paper, the system control lag is small and the response speed meets the system requirements. The system overshoot is within a reasonable range and the impact on the system can be ignored. The experimental results show that the controller in this paper has a good suppression effect on attitude disturbances. Compared with the traditional PID controller, the controller in this paper shows a more significant improvement in system stability in the experiment.
[0139] The above is an exemplary description of the invention. Obviously, the specific implementation of the present invention is not limited to the above-mentioned method. As long as such non-substantial improvements are made by adopting the method concept and technical solution of the present invention, or the concept and technical solution of the invention are directly applied to other occasions without improvement, they are all within the protection scope of the present invention.
Claims
1. A method for predicting and controlling the attitude of an unmanned aerial vehicle, the method mainly comprising the following steps: Step 1: SSA (singular spectrum analysis) data preprocessing; Step 2: Improve LSTM model construction; Step 3: Construction of fuzzy neural PID controller; Step 4: Build the drone system.
2. A method for predicting and controlling the attitude of an unmanned aerial vehicle according to claim 1, It is characterized in that The step one comprises: (1) Constructing a matrix: By constructing a matrix, the original sequence data is converted into a matrix form to prepare for the subsequent singular value decomposition. Suppose a time series is X N =(x 1 ,x 2 ,…,x N ), N>2, and require X N is a non-zero sequence; the time series is decomposed and embedded into a space with a window length of L to form a trajectory matrix X; Where: K = N-L+1, N is the length of the time series; (2) Singular Value Decomposition Calculate the matrix XX T And perform singular value decomposition to obtain L eigenvalues λ(λ 1 ,λ 2 ,...,λ L ), and the corresponding eigenvector U 1 ,U 2 ,...,U L ; Decompose X into several elementary matrices with the same structure: X=E 1 +E 2 +…And d (2) Where d = rank(X), E i represents the i-th singular value decomposition component, and its mathematical model is expressed as: Where: U i and Indicated as XX T The i-th left and right singular vectors; are the singular values of the trajectory matrix X in descending order; (3) Feature Grouping Cumulative contribution rate through singular values Divide the elementary matrix into k disjoint subsets and sort the matrices according to the contribution rate. The larger the contribution rate, the greater the contribution of the matrix in the time series. (4) Reconstruction of main components Through principal component reconstruction, each elementary matrix in equation (2) can be converted into a time series by diagonal averaging. Define Z as an L×K-order matrix whose elements are z i,j (1≤i≤L, 1≤j≤K), let L * =min(L,K),K * =max(L,K), if L <K, on the contrary The formula for calculating the diagonal average is: In the SSA algorithm, after multiple sensitivity analyses, the length of the original time series is 500. Different L values are tried and the stability and accuracy of the results are compared. L = 240 is selected as the optimal window length. The original sequence data is decomposed and grouped according to the contribution rate. The trajectory data with a large contribution rate is reconstructed into three components: trend term, period term and noise residual term.
3. A method for predicting and controlling the attitude of an unmanned aerial vehicle according to claim 1, It is characterized in that The second step comprises: (1) LSTM composition. The key components of LSTM include unit state, forget gate f t , input gate i t , output gate o t ; These gating units allow LSTM to selectively remember and forget information when processing sequence data, thereby better capturing long-term dependencies; The functions of the three LSTM gates are as follows: 1) Forget gate: used to control whether to forget the information in the previous memory cell state; memory cells are the key part of LSTM responsible for storing and transmitting information. The formula is: f t =σ(W f [h t-1 ,X t ]+b f ) (5) Where: f t represents the forget gate, W f is the weight matrix of the forget gate, [h t-1 ,X t ] means to change the hidden state h of the previous moment t-1 and the current input X t Merge into a vector, b f represents the bias term of the forget gate, σ represents the sigmoid function; 2) Input gate: used to control whether the current input information is added to the memory cell state; the input data is controlled by the input gate to control whether it is input into the memory cell state, the formula is: i t =σ(W i [h t-1 ,X t ]+b i ) (6) c t =f t ·c t-1 +i t ·tanh(W c [h t-1 ,X t ]+b c (7) Where: i t is the output of the input gate, indicating the amount of information that should be updated to the memory cell at the current moment, i t ∈(0,1); W i is the weight matrix of the input gate; W c represents the input gate weight matrix; b c represents the bias term of the output gate; b i represents the input gate bias term; c t Represents the input state of the memory cell at time t. 3) Output gate: used to control the information output from the memory cell state to the hidden state. When using LSTM for prediction, the sensor data is input into the input gate of the LSTM model; the information extracted from the memory cell state is combined with the output of LSTM to generate and output the posture prediction result; the formula is: the t =σ(W o [h t-1 ,X t ]+b o ) (8) h t =o t ·tanh(c t ) (9) In the formula: o t is the output of the output gate, W o is the weight matrix of the output gate, b o represents the bias term of the forget gate, h t represents the hidden state at time t; (2) Improvement of LSTM model: Dynamically adjust the LSTM network structure. Based on the gradient signal, define the connection mode between LSTM units as variable. According to the different characteristics and importance of the input sequence, dynamically adjust the number of layers and units of the LSTM network to improve the performance of the model. The above LSTM model is used as the initial neural network. It is assumed that it contains B (B is a dynamic value) hidden layers, which correspond to B-1 gate control units. A label vector m is introduced. (b) ,The symbol b represents the number of layers in the LSTM model, m (b) The value is 0 or 1; the gradient of the error signal is used to determine the number of layers. First, the loss function is calculated with respect to The gradient of is obtained according to the forward propagation equation of the LSTM model: Calculate c t gradient: Where tanh' is the derivative of tanh. Based on the above formula, we can get Gradient, the formula is: represents the output of the forget gate, is the link parameter, according to the above formula, If it is smaller, it means that the weight of the previous layer of information is smaller, so m (b-1) If it is 0, the layer is deleted. If it is larger, it means that the weight of the current layer is larger, so m (b-1) To 1, increase the number of layers; The components decomposed and reconstructed by SSA are predicted using the LSTM model respectively, and finally the prediction results of each component are superimposed to obtain the posture prediction value.
4. The method for predicting and controlling the attitude of an unmanned aerial vehicle according to claim 1, It is characterized in that The step three comprises: (1) Construct a fuzzy controller, conduct a comprehensive analysis of the UAV system response speed, stability, and parameter overshoot factors, and construct a UAV fuzzy control table, where the PID correction formula is: Where k p , k i , k d They are three correction parameters, Δk p , Δk i , Δk d They are proportional, integral and differential control parameters respectively; The fuzzy control quantity of the UAV is divided into NB (negative large), NM (negative medium), NS (negative small), ZO (zero), PS (positive small), PM (positive medium), and PB (positive large), thereby obtaining a seven-level fuzzy subset {NB, NM, NS, ZO, PS, PM, PB}, and the membership function is selected as a trigonometric function. According to the analysis of the proportional, integral, differential action and the actual control of the UAV, it is concluded that when the absolute value error e is large, the Δk p The value increases; Δk i The value should also be increased to reduce the error; Δk d It should be appropriately increased to ensure the dynamic characteristics of the system; (2) Construct a fuzzy neural PID controller. The adaptive neural fuzzy inference system (ANFIS) uses a neural network algorithm to optimize the fuzzy controller. By training and processing sample data to obtain a numerical solution, a fuzzy neural PID controller with automatic adjustment and control function is obtained.
5. The method for predicting and controlling the attitude of an unmanned aerial vehicle according to claim 1, It is characterized in that The fourth step comprises: (1) UAV flight control algorithm; UAV flight control algorithm includes main algorithm and auxiliary algorithm; main algorithm mainly includes UAV control, navigation and positioning, path planning and trajectory tracking and system self-stabilization control algorithm; auxiliary algorithm mainly includes communication, filtering, data transmission, main loop, task scheduling, remote control signal data processing, PWM output module and timer, electronic compass, barometer, onboard storage chip, laser module driver; (2) UAV attitude prediction control algorithm: The SSA algorithm preprocesses the data; the improved LSTM model uses the dynamic adjustment network structure method to predict P, I, and D based on the input data; the fuzzy PID controller uses the difference between the predicted value and the ideal attitude as input to adapt the PID value. The above collaboratively realizes the UAV attitude prediction control; (3) Selection of hardware system configuration; The drone hardware system includes the main control system and basic accessories; The main control system includes the main processor, coprocessor and sensor unit; The main algorithm processor uses NVIDIA AGX Orin; The coprocessor uses STM32F405, ARM Cortex-M4 32-bit RISC processor; The sensor unit mainly includes speedometer, accelerometer, gyroscope, thermometer, GPS; Basic accessories include Tarot4012 / 320KV motor, 16-inch propeller, 680mm four-axis frame, AT92.4G remote control, 4S40A electric speed controller, 4500mAh-4s (14.8V) battery.
Citation Information
Cited By
IMU-PID-RTK fused crawler conveyor control method and system
CN119902440A
Active vibration reduction control method based on adaptive neural fuzzy inference system
CN120029370A
