A method and system for predicting flight state parameters of unmanned aerial vehicle
Through the improved Transformer neural network model and timestamp encoding technology, the problem of inaccurate and poor real-time prediction of UAV flight status parameters is solved, real-time high-precision prediction of UAV flight status parameters is achieved, and the UAV's performance is improved. Control accuracy and safety.
Patent Information
- Application Number
- CN202211274667.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-18
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-10-18
AI Technical Summary
Existing UAV flight state parameter prediction methods are not accurate enough and have poor real-time performance, which affects UAV control accuracy and control frequency.
Using the improved Transformer neural network model, combined with timestamp encoding and fully connected network layers, the flight status data is processed through filtering and resampling to generate training sets, verification sets and test sets, and the Adma optimization algorithm is used to train the model to predict UAVs flight status parameters.
Real-time high-precision prediction of UAV flight status parameters is achieved, laying a solid foundation for precise UAV control, ensuring safe and reliable flight, and expanding the use of UAVs in complex scenarios.
Smart Images

Figure CN115469679B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of unmanned aerial vehicles, and in particular relates to a method and system for predicting flight state parameters of unmanned aerial vehicles. Background Art
[0002] Currently, drones have been widely used in many industries, such as aerial photography, surveying and mapping, inspection, and air patrol. Different industries require drones to complete different tasks, but the most fundamental requirement for drones is that they can be precisely controlled to complete these tasks. To precisely control a drone, the drone controller needs to obtain real-time and accurate drone status parameters, such as the drone's speed, acceleration, attitude angle, angular velocity, angular acceleration, etc.
[0003] The traditional method of estimating and predicting flight state parameters is based on the UAV dynamics model. The dynamics model calculates the acceleration and angular acceleration information of the UAV based on Newton's second law and Euler's equation under certain assumptions and simplified conditions, and then obtains other flight state parameter information such as speed, angular velocity and attitude angle through integration. The dynamics modeling method makes some assumptions and simplifications on the actual flight of the UAV, and generally ignores the unsteady parameters and some uncertain states in the flight of the UAV, such as aerodynamic characteristics. Therefore, the acceleration and angular acceleration information obtained by the UAV dynamics model is not accurate enough and has certain errors. Other flight state parameters are calculated by integrating the acceleration and angular acceleration. The integral operation will accumulate this error, so the flight state parameters of the UAV obtained by the dynamics model are not accurate enough.
[0004] In order to improve the accuracy of flight state parameter estimation, a joint model of dynamics model and convolutional neural network is currently used, in which the dynamics model predicts the deterministic part of the flight state, and the convolutional neural network predicts the uncertain part of the flight state; this method has greatly improved the accuracy of the prediction results compared with the traditional pure dynamics modeling method. However, since the flow field near the drone and the state of the drone change over time during the flight of the drone, the flight state at the historical moment will affect the current flight state, and the traditional dynamics model and this dynamics-convolutional neural network joint model do not fully consider this time-varying characteristic and fail to fully utilize the historical information of the drone to predict the current flight state parameters.
[0005] In order to make full use of the historical information of the drone to predict the current flight state parameters, the LSTM method is used alone or in combination with traditional dynamic modeling to estimate the flight state parameters of the drone. However, due to the information bottleneck of the LSTM method, when the flight state data of a long time segment is input, the previous information may be lost, resulting in this method can only use the flight state data of a shorter time segment, which will affect the accuracy of the prediction. At the same time, due to the use of deep LSTM networks, there will be gradient disappearance or explosion, the network has poor convergence, and the calculation is complex, the parallel capability is poor, and the calculation takes a long time, making it difficult to achieve real-time prediction.
[0006] Accurate prediction of UAV flight state parameters is the basis for precise control of UAVs, which in turn ensures safe and reliable flight of UAVs and the completion of tasks in more complex scenarios. Therefore, real-time and high-precision prediction of UAV flight state parameters is crucial for UAVs. Summary of the invention
[0007] The technical problem to be solved by the present invention is to provide a method and system for predicting the flight status parameters of a UAV in view of the deficiencies in the above-mentioned prior art, so as to solve the technical problem that the prediction of the flight status parameters of the UAV is not accurate enough and has poor real-time performance, thereby affecting the control accuracy and control frequency of the UAV.
[0008] The present invention adopts the following technical solutions:
[0009] A method for predicting flight state parameters of a UAV comprises the following steps:
[0010] S1. Build an improved Transformer neural network model;
[0011] S2. Obtain flight status data of a typical flight status of the UAV;
[0012] S3, preprocessing the UAV flight status data obtained in step S2;
[0013] S4, using the data preprocessed in step S3 to generate a UAV flight status data set, and then dividing the UAV flight status data set into a training set, a validation set, and a test set;
[0014] S5. Use the training set obtained in step S4 to train the Transformer neural network model obtained in step S1, use the validation set obtained in step S4 to obtain the parameters of the Transformer neural network model, input the data of the H time series t, t-1, ..., tH-1 in the test set obtained in step S4 into the trained Transformer neural network model, and predict the flight state parameters at time t+1.
[0015] Specifically, in step S1, the Transformer neural network model includes input, encoder, decoder and fully connected network layer. The time series data is passed through a linear mapping layer and then timestamp encoded as the input of the encoder and decoder. The encoder and decoder are stacked N times. The output of the encoder is used as the input of the cross-correlation attention mechanism layer in the decoder. The output of the decoder passes through the fully connected network layer and outputs the predicted data.
[0016] Furthermore, the input of the encoder and decoder is specifically:
[0017] The input H×m dimensional time series data is mapped to H×d dimensions, where H is the time series length, m and d are the dimensions of the flight state parameters, and d ≥ m.
[0018] Furthermore, the timestamp encoding is specifically:
[0019] P(k,2i)=sin(k*e -2i*ln100 / d )
[0020] P(k,2i+1)=cos(k*e -(2i+1)*ln100 / d )
[0021] Among them, P(k,2i) is the time encoding of the even-numbered dimension of the flight status data at time k, P(k,2i+1) is the time encoding of the odd-numbered dimension of the flight status data at time k, i represents the i-th dimension data, and after the linear mapping layer, the data has a total of d dimensions.
[0022] Specifically, in step S2, typical flight states of the UAV include climbing, cruising, hovering and diving, and the flight state parameters include the UAV's timestamp, control signal, speed, acceleration and angular velocity data.
[0023] Specifically, step S3 is as follows:
[0024] S301, using filtering processing to suppress noise in the UAV flight status data obtained in step S2;
[0025] S302, resample the data obtained in step S301, align the timestamps of different sensor data, and generate a time series number [T 1 ,T 2 ,…,T N ]A total of N data.
[0026] Furthermore, in step S302, the flight status data T at time k k for:
[0027]
[0028] Among them, [τ 1k ,τ2k ,τ 3k ,τ 4k ] represent the control input signals of the roll, pitch, throttle and yaw channels at time k, respectively, [v xk ,v yk ,v zk ] represents the velocity components in different directions at time k, represents the acceleration components in different directions at time k, [ω xk ,ω yk ,ω zk ] represents the angular velocity components in different directions at time k, represents the angular acceleration components in different directions at time k, represents the attitude angle at time k.
[0029] Specifically, in step S4, the N time series data obtained in step S3 are overlapped and sampled with a time interval of L and a length of H to obtain a data set D with a length of M, which is then divided into a training set accounting for 60% of the total data, a validation set accounting for 20% of the total data, and a test set accounting for 20% of the total data.
[0030] Specifically, in step S5, the Adma optimization algorithm is used to minimize the loss function LOSS to train the Transformer neural network model. The loss function LOSS is specifically:
[0031]
[0032] Among them, y k is the true value at time k, is the predicted value at time k, and n is the number of samples in the training set.
[0033] In a second aspect, an embodiment of the present invention provides a UAV flight state parameter prediction system, comprising:
[0034] Build modules and build an improved Transformer neural network model;
[0035] Parameter module, to obtain the flight state parameters of the typical flight state of the UAV;
[0036] The preprocessing module preprocesses the UAV flight status data obtained by the parameter module;
[0037] A partitioning module generates a UAV flight status dataset using the data preprocessed by the preprocessing module, and then divides the UAV flight status dataset into a training set, a validation set, and a test set;
[0038] The prediction module uses the training set obtained by the partitioning module to train the Transformer neural network model obtained by the building module, uses the validation set obtained by the partitioning module to obtain the parameters of the Transformer neural network model, and inputs the data of the H time series t, t-1, …, tH-1 in the test set obtained by the partitioning module into the trained Transformer neural network model to predict the flight state parameters at time t+1.
[0039] Compared with the prior art, the present invention has at least the following beneficial effects:
[0040] The present invention discloses a method for predicting flight state parameters of a UAV. By improving the Transformer neural network model and using flight data of a typical flight state of a UAV to train the model, the flight state parameters of the UAV can be predicted in real time with high precision, thus laying a solid foundation for precise control of the UAV and ensuring safe and reliable flight of the UAV. At the same time, the method can perform different tasks in different industries and expand the use scenarios of the UAV.
[0041] Furthermore, the improved Transformer neural network model proposes timestamp encoding and unified encoder-decoder input, which has better parallel performance and higher prediction accuracy than the original model, and can therefore achieve real-time and high-precision prediction of UAV state parameters.
[0042] Furthermore, the model maps the input H×m-dimensional time series data to H×d dimensions, that is, mapping the input data to a higher dimension, which is more conducive to learning to represent the complex relationship between drone state parameters.
[0043] Furthermore, since the attention mechanism in the Transformer neural network model does not consider the relationship between input variables, and there is a strong time order between flight data, in order to better represent this time order relationship, the present invention proposes a timestamp encoding method.
[0044] Furthermore, typical flight states of UAVs include climbing, cruising, circling and diving. The present invention collects these typical flight state data to improve the training of the Transformer neural network model, so that the model can learn the typical flight states of UAVs, which greatly expands the application scope of the present invention.
[0045] Furthermore, filtering the collected flight data can eliminate noise signals in the data; since the sampling frequencies of the collected data from different sensors on the drone are different, resampling the collected data can align the timestamps of the data from different sensors.
[0046] Furthermore, the flight data after preprocessing includes flight status parameters of all dimensions. Using flight status parameters of all dimensions as network input to train the model can enable the model to learn a global model, thereby improving the prediction accuracy of the model.
[0047] Furthermore, overlapping sampling can expand the training data and avoid overfitting of the model.
[0048] Furthermore, the use of the Adma optimization algorithm can make the model convergence more stable. It can be understood that the beneficial effects of the second aspect can be found in the relevant description of the first aspect, which will not be repeated here.
[0049] In summary, the present invention can predict the flight state parameters of the UAV in real time and with high precision, laying a solid foundation for the precise control of the UAV and ensuring the safe and reliable flight of the UAV. At the same time, it can perform different tasks in different industries and expand the use scenarios of the UAV.
[0050] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 It is a schematic diagram of the process of the present invention;
[0052] Figure 2 This is a schematic diagram of the improved Transformer neural network model of the present invention. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0054] In the description of the present invention, it should be understood that the terms “include” and “comprises” indicate the presence of described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.
[0055] It should also be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0056] It should be further understood that the term "and / or" used in the present specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects are in an "or" relationship.
[0057] It should be understood that, although the terms first, second, third, etc. may be used to describe preset ranges, etc. in the embodiments of the present invention, these preset ranges should not be limited to these terms. These terms are only used to distinguish preset ranges from each other. For example, without departing from the scope of the embodiments of the present invention, the first preset range may also be referred to as the second preset range, and similarly, the second preset range may also be referred to as the first preset range.
[0058] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0059] Various structural schematic diagrams of the embodiments disclosed in the present invention are shown in the accompanying drawings. These figures are not drawn to scale, and some details are magnified and some details may be omitted for the purpose of clear expression. The shapes of various regions and layers shown in the figures and the relative sizes and positional relationships therebetween are only exemplary, and may deviate in practice due to manufacturing tolerances or technical limitations, and those skilled in the art may additionally design regions / layers with different shapes, sizes, and relative positions according to actual needs.
[0060] The present invention provides a method for predicting the flight state parameters of a UAV, which makes full use of the historical flight state information of the UAV and avoids the use of a dynamic model method based on assumptions and simplifications, thereby achieving high-precision prediction; an improved Transformer neural network model is used with good parallel computing capabilities, so that the method can meet the requirements of real-time prediction; a solid foundation is laid for the safe and reliable flight of UAVs and the execution of complex tasks in complex environments, thereby greatly expanding the use scenarios of UAVs.
[0061] See also Figure 1 The present invention provides a method for predicting flight state parameters of an unmanned aerial vehicle, comprising the following steps:
[0062] S1. Build an improved Transformer neural network model to predict flight state parameters;
[0063] See also Figure 2 , the Transformer neural network model uses a time encoding method and a linear mapping layer, and unifies the input of the encoder and decoder; the input time series data passes through the linear mapping layer, encodes and upgrades the data to describe the complex relationship between time series data, and then adds timestamp coding as the input of the encoder and decoder. Timestamp coding can effectively describe the order relationship between time series data.
[0064] The Transformer neural network model includes input, encoder, decoder and fully connected network layers.
[0065] The encoder consists of a multi-head self-attention layer, a residual normalization layer, a feedforward network layer, and a normalization layer. The encoder can be repeated N times to better describe the complex relationship between time series data.
[0066] The input of the decoder is the same as that of the encoder. The input data passes through the multi-head self-attention and residual normalization layers. The multi-head mutual attention layer fuses the encoder output data and the decoder input data, and then passes through the residual normalization layer, the feedforward network layer and the residual normalization layer to obtain the output of the decoder. The feedforward network layer consists of two linear network layers with an activation function in the middle. The decoder is also repeated N times to better describe the complex relationship between time series data. The output of the decoder passes through the fully connected layer and finally obtains the predicted flight state parameters.
[0067] Timestamp encoding preserves the chronological order of time series data. The linear mapping layer maps the input time series to a higher dimension, increasing the dimension of the data to better represent the complex relationship between time series data.
[0068] The decoder uses the same input as the encoder, avoiding the use of autoregression for sequential prediction, reducing cumulative errors, and avoiding sequential prediction can also improve the parallel efficiency of the algorithm and speed up the prediction time.
[0069] After the time series data is dimensionally upgraded through the linear mapping layer, it is added to the time coding data as the input of the encoder and decoder. The encoder and decoder of the present invention both use the encoder and decoder of the original Transformer neural network model, and the decoder output passes through the fully connected layer to obtain the final output result.
[0070] The time codes used are as follows:
[0071] P(k,2i)=sin(k*e -2i*ln100 / d )
[0072] P(k,2i+1)=cos(k*e -(2i+1)*ln100 / d )
[0073] Wherein, k represents the timestamp data, i represents the i-th dimension data, and d represents the dimension of the data after the linear mapping layer, where d=512.
[0074] S2. Obtain flight state parameters of a typical flight state of the UAV;
[0075] Typical flight states of drones include climbing, cruising, circling, diving, etc. The timestamp, control signal, speed, acceleration, and angular velocity data of the drone are collected by different sensors and then sent to the LOG module of the flight control system for recording. The flight state history data recorded by the LOG module is read, and then the angular velocity is integrated to obtain the attitude angle data, and the angular velocity is differentiated to obtain the angular acceleration data.
[0076] For each different flight status, 25 minutes of flight data are collected, for a total of 100 minutes of data.
[0077] S3, preprocessing the UAV flight status data obtained in step S2;
[0078] S301, suppressing noise in the UAV flight status data by filtering;
[0079] Filtering includes hardware filtering and software filtering, and the filtering algorithm is not limited to Kalman filtering.
[0080] S302: Since different sensors have different sampling frequencies and different time intervals for collecting data, it is necessary to resample the data obtained in step S301 to align the timestamps of different sensor data, and then generate a time series number [T 1 ,T 2 ,…,T N ]A total of N data.
[0081] Flight status data T at time k k for:
[0082]
[0083] Among them, [τ 1k ,τ 2k ,τ 3k ,τ 4k ] represent the control input signals of the roll, pitch, throttle and yaw channels at time k, respectively, [v xk ,v yk ,v zk ] represents the velocity components in different directions at time k, represents the acceleration components in different directions at time k, [ωxk ,ω yk ,ω zk ] represents the angular velocity components in different directions at time k, represents the angular acceleration components in different directions at time k, represents the attitude angle at time k.
[0084] S4, using the data preprocessed in step S3 to generate a UAV flight status data set, and then dividing the UAV flight status data set into a training set, a validation set, and a test set;
[0085] The data set generated in S4 is obtained by preprocessing the N time series data in step S3, and performing overlapping sampling with a time interval of L and a length of H to obtain a data set D with a length of M. Then, according to the training set accounting for 60% of the total data, the validation set accounting for 20% of the total data, and the test set accounting for 20% of the total data, random sampling is performed to obtain the training set, validation set and test set.
[0086] The dataset D is:
[0087] D={[T 1 ,T 2 ,…,T H ],[T 1+L ,T 2+L ,…,T H+L ],…,[T N-H+1 ,T N-H+2 ,…,T N ]}
[0088] S5. Use the training set obtained in step S4 to train the Transformer neural network model obtained in step S1, use the validation set obtained in step S4 to obtain the parameters of the Transformer neural network model, use the data of H time series, t, t-1, ..., tH-1, in the test set obtained in step S4, and use the trained model to predict the flight state parameters at time t+1.
[0089] S501, Input and output of Transformer neural network model
[0090] The input of the Transformer neural network model is the data 1 second before time t. The time interval of the time series data after preprocessing is 0.01 second. A total of 100 time series data are input. Each time series data T k It is 19-dimensional, and the input data is a 100×19-dimensional vector.
[0091] The output T of the Transformer neural network model t+1It is the flight status parameter at time t+1, with a total of 15 dimensions, and the output data format is a 1×15-dimensional vector.
[0092] The output T of the Transformer neural network model t+1 Specifically:
[0093]
[0094] Among them, [v x,t+1 ,v y,t+1 ,v z,t+1 ] represents the velocity components in different directions at time t+1, represents the acceleration components in different directions at time t+1, [ω x,t+1 ,ω y,t+1 ,ω z,t+1 ] represents the angular velocity components in different directions at time t+1, represents the angular acceleration components in different directions at time t+1, Represents the attitude angle at time t+1.
[0095] S502: Parameter initialization
[0096] Initialize the parameters of the entire network, and select the optimal values of the network's hyperparameters based on a large number of experiments on the validation set; among them, the number of encoder and decoder layers is 8, the dimension of the linear mapping layer is 128, the number of heads of the multi-head attention layer is 8, and the dimension of the fully connected layer is 1024.
[0097] S503, model training and testing
[0098] The Relu function was selected as the activation function in the network, and the mean square error (MSE) was selected as the loss function when predicting the flight state parameters of the drone.
[0099]
[0100] Among them, y k is the true value at time k, is the predicted value at time k, and n is the number of samples in the training set.
[0101] Adma optimizer is used, the learning rate uses an adaptive adjustment strategy, the loss function is minimized, and the model is trained using the training set. The hyperparameters are selected using the validation set.
[0102] S504. Prediction accuracy evaluation
[0103] The root mean square error (RSE) is used as the prediction accuracy evaluation index, as follows:
[0104]
[0105] On the test set, the data at and before time t is used to predict the flight state parameters at time t+1 using the trained Transformer neural network model.
[0106] The predicted flight state parameters include velocities in three directions, accelerations in three directions, angular velocities in three directions, angular accelerations in three directions and three attitude angles, a total of 15 dimensions.
[0107] In another embodiment of the present invention, a UAV flight state parameter prediction system is provided, which can be used to implement the above-mentioned UAV flight state parameter prediction method. Specifically, the UAV flight state parameter prediction system includes a building module, a parameter module, a preprocessing module, a division module and a prediction module.
[0108] Among them, building modules, building improved Transformer neural network models;
[0109] Parameter module, to obtain the flight status data of the typical flight status of the UAV;
[0110] The preprocessing module preprocesses the UAV flight status data obtained by the parameter module;
[0111] A partitioning module generates a UAV flight status dataset using the data preprocessed by the preprocessing module, and then divides the UAV flight status dataset into a training set, a validation set, and a test set;
[0112] The prediction module uses the training set obtained by the partitioning module to train the Transformer neural network model obtained by the building module, uses the validation set obtained by the partitioning module to obtain the parameters of the Transformer neural network model, and inputs the data of the H time series t, t-1, …, tH-1 in the test set obtained by the partitioning module into the trained Transformer neural network model to predict the flight state parameters at time t+1.
[0113] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. The components of the embodiments of the present invention described and shown in the drawings here can usually be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0114] Since the output of the dynamic model is about acceleration in three directions and angular acceleration in three directions, the comparison of the root mean square error of the predictions of different prediction models is shown in Table 1:
[0115] Table 1 Comparison of root mean square error of predictions of different prediction models
[0116]
[0117] Table 1 compares the root mean square errors of angular velocities and angular accelerations in three directions of the dynamic model, the dynamic model-convolutional neural network hybrid model, the LSTM model and the present invention. It can be seen from Table 1 that the error of the present invention is the smallest.
[0118] At the same time, the present invention compares the time taken by different models to predict once, as shown in Table 2:
[0119] Table 2 Comparison of prediction time of different prediction models
[0120]
[0121] Table 2 compares the prediction time of the dynamic model, the dynamic model-convolutional neural network hybrid model, the LSTM model and the present invention. It can be seen from the table that the prediction time of the present invention is 9ms, which meets the real-time requirement of the drone (the control frequency of the general controller is 100Hz).
[0122] In summary, the present invention provides a method and system for predicting flight state parameters of a UAV, which can achieve high-precision real-time prediction of flight state data.
[0123] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0124] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0125] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0126] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0127] The above contents are only for explaining the technical idea of the present invention and cannot be used to limit the protection scope of the present invention. Any changes made on the basis of the technical solution in accordance with the technical idea proposed by the present invention shall fall within the protection scope of the claims of the present invention.
Claims
1. A method for predicting UAV flight state parameters, It is characterized in that The following steps are involved: S1. Build an improved Transformer neural network model. The Transformer neural network model includes input, encoder, decoder and fully connected network layer. The time series data is passed through the linear mapping layer and the timestamp encoding is used as the input of the encoder and decoder. The encoder and decoder are stacked N times. The output of the encoder is used as the input of the cross-correlation attention mechanism layer in the decoder. The output of the decoder passes through the fully connected network layer and outputs the predicted data. The input of the encoder and decoder is as follows: Map the input H×m-dimensional time series data to H×d-dimensional, where H is the length of the time series, m and d are the dimensions of the flight state parameters, and d ≥ m; The timestamp encoding is as follows: P(k,2i)=sin(k*e -2i*ln100 / d ) P(k,2i+1)=cos(k*e -(2i+1)*ln100 / d ) Wherein, P(k, 2i) is the time encoding of the even-numbered dimension of the flight status data at time k, P(k, 2i+1) is the time encoding of the odd-numbered dimension of the flight status data at time k, i represents the i-th dimension data, and after the linear mapping layer, the data has a total of d dimensions; S2. Acquire flight status data of typical flight status of the UAV. Typical flight status of the UAV includes climbing, cruising, hovering and diving. Flight status parameters include timestamp, control signal, speed, acceleration and angular velocity data of the UAV. S3, pre-processing the UAV flight status data obtained in step S2, specifically: S301, using filtering processing to suppress noise in the UAV flight status data obtained in step S2; S302, resample the data obtained in step S301, align the timestamps of different sensor data, and generate a time series number [T 1 , T 2 , ..., T N ] A total of N data, flight status data at time k T k for: Among them, [τ 1k , τ 2k , τ 3k , τ 4k ] represent the control input signals of the roll, pitch, throttle and yaw channels at time k, respectively, [v xk , v yk , v zk ] represents the velocity components in different directions at time k, represents the acceleration components in different directions at time k, [ω xk ,ω yk ,ω zk ] represents the angular velocity components in different directions at time k, represents the angular acceleration components in different directions at time k, represents the attitude angle at time k; S4. Generate a UAV flight status data set using the data preprocessed in step S3, and then divide the UAV flight status data set into a training set, a validation set, and a test set. Specifically, the N time series data obtained in step S3 are overlapped and sampled with a time interval of L and a length of H to obtain a data set D with a length of M, and then divided into a training set accounting for 60% of the total data, a validation set accounting for 20% of the total data, and a test set accounting for 20% of the total data; S5. Use the training set obtained in step S4 to train the Transformer neural network model obtained in step S1, use the validation set obtained in step S4 to obtain the parameters of the Transformer neural network model, input the data of H time series, t, t-1, ..., tH-1, in the test set obtained in step S4, into the trained Transformer neural network model, predict the flight state parameters at time t+1, and use the Adma optimization algorithm to minimize the loss function LOSS to train the Transformer neural network model. The loss function LOSS is specifically: Among them, y k is the true value at time k, is the predicted value at time k, and n is the number of samples in the training set.
2. A UAV flight state parameter prediction system, It is characterized in that include: Build the module and build the improved Transformer neural network model. The Transformer neural network model includes input, encoder, decoder and fully connected network layer. The time series data is passed through the linear mapping layer and the timestamp encoding is used as the input of the encoder and decoder. The encoder and decoder are stacked N times. The output of the encoder is used as the input of the cross-correlation attention mechanism layer in the decoder. The output of the decoder passes through the fully connected network layer and outputs the predicted data. The input of the encoder and decoder is as follows: Map the input H×m-dimensional time series data to H×d-dimensional, where H is the length of the time series, m and d are the dimensions of the flight state parameters, and d ≥ m; The timestamp encoding is as follows: P(k,2i)=sin(k*e -2i*ln100 / d ) P(k,2i+1)=cos(k*e -(2i+1)*ln100 / d ) Wherein, P(k, 2i) is the time encoding of the even-numbered dimension of the flight status data at time k, P(k, 2i+1) is the time encoding of the odd-numbered dimension of the flight status data at time k, i represents the i-th dimension data, and after the linear mapping layer, the data has a total of d dimensions; Parameter module, which obtains the flight status data of the typical flight status of the UAV. The typical flight status of the UAV includes climbing, cruising, hovering and diving. The flight status parameters include the UAV's timestamp, control signal, speed, acceleration and angular velocity data; The preprocessing module preprocesses the UAV flight status data obtained by the parameter module, specifically: S301, using filtering processing to suppress noise in the UAV flight status data obtained in step S2; S302, resample the data obtained in step S301, align the timestamps of different sensor data, and generate a time series number [T 1 , T 2 , ..., T N ] A total of N data, flight status data at time k T k for: Among them, [τ 1k , τ 2k , τ 3k , τ 4k ] represent the control input signals of the roll, pitch, throttle and yaw channels at time k, respectively, [v xk , v yk , v zk ] represents the velocity components in different directions at time k, represents the acceleration components in different directions at time k, [ω xk ,ω yk ,ω zk ] represents the angular velocity components in different directions at time k, represents the angular acceleration components in different directions at time k, represents the attitude angle at time k; The partitioning module generates a UAV flight status data set using the data preprocessed by the preprocessing module, and then divides the UAV flight status data set into a training set, a validation set, and a test set. Specifically, the N time series data obtained in step S3 are overlapped and sampled with a time interval of L and a length of H to obtain a data set D with a length of M, and then divided, with the training set accounting for 60% of the total data, the validation set accounting for 20% of the total data, and the test set accounting for 20% of the total data; The prediction module uses the training set obtained by the partitioning module to train the Transformer neural network model obtained by the building module, uses the validation set obtained by the partitioning module to obtain the parameters of the Transformer neural network model, inputs the data of the H time series t, t-1, ..., tH-1 in the test set obtained by the partitioning module into the trained Transformer neural network model, predicts the flight state parameters at time t+1, and uses the Adma optimization algorithm to minimize the loss function LOSS to train the Transformer neural network model. The loss function LOSS is specifically: Among them, y k is the true value at time k, is the predicted value at time k, and n is the number of samples in the training set.
