Attitude angle estimation method based on LSTM and Kalman filtering

By combining dynamic window LSTM and Kalman filtering for attitude angle estimation, the input window length is dynamically adjusted and the model parameters are updated in real time. This solves the accuracy and adaptability problems of attitude prediction methods in complex environments, and achieves high-precision and real-time attitude angle estimation.

CN121761892APending Publication Date: 2026-03-31西安应用光学研究所
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-02
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing attitude prediction methods have low prediction accuracy and poor adaptability in complex and ever-changing real-world environments. Traditional Kalman filters rely on accurate models and are difficult to adapt adaptively, while LSTM networks cannot dynamically adjust the range of input information when dynamic changes occur, resulting in insufficient model generalization ability.

Method used

By combining a Long Short-Term Memory (LSTM) network with dynamic windowing and incremental learning with multivariate Kalman filtering, attitude angle estimation is achieved by dynamically adjusting the input window length and updating model parameters in real time, combined with sensor measurements. This enables incremental learning and adaptive noise calculation.

Benefits of technology

It improves the accuracy and adaptability of attitude prediction, enhances the model's real-time performance and generalization ability, and ensures good prediction performance in different environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121761892A_ABST
    Figure CN121761892A_ABST
Patent Text Reader

Abstract

The invention discloses an attitude angle estimation method based on LSTM (Long Short Term Memory) and Kalman filtering. According to the method, an LSTM network of a dynamic window mechanism is adopted for attitude angle prediction, and adaptive updating of model parameters is realized in combination with incremental online learning. A prediction result of the LSTM serves as prior estimation of Kalman filtering and is fused with a real-time measurement value of a system, the filtering process is optimized through a dynamic adaptive noise calculation method, and finally attitude angle estimation with high precision, high adaptability and good real-time performance is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of unmanned surface vessel (USV) attitude angle prediction, specifically to an attitude angle estimation method based on LSTM and Kalman filtering. Background Technology

[0002] In numerous fields such as navigation, aviation, and robotics, accurate prediction of load attitude is crucial, directly impacting system stability, safety, and mission execution accuracy. Traditional attitude prediction methods are primarily categorized into model-based and data-driven approaches.

[0003] Model-based methods, such as Kalman filtering and its derivatives, establish a state-space model of the system and use the system's dynamic characteristics and measurement information to estimate and predict the state. Kalman filtering has the advantages of high computational efficiency and good real-time performance, and can process system noise to a certain extent. However, these methods heavily rely on accurate system models. In practical applications, due to the complexity and uncertainty of the system, it is difficult to establish accurate models, resulting in limited prediction accuracy. Especially in complex environments, the dynamic characteristics of the system may change, and traditional Kalman filtering methods cannot adaptively adjust parameters, thus affecting prediction performance. At the same time, because the modeling relies only on sensors or a single model, the control algorithm cannot understand and process the complex dynamic characteristics presented by multi-dimensional data, is severely affected by process noise, and cannot establish long-term correlations between data.

[0004] Data-driven methods, such as artificial neural networks, can approximate any linear or nonlinear function based on the universal approximation theorem. However, traditional simple feedforward mechanisms tend to ignore time-series characteristics. Long Short-Term Memory (LSTM) networks, which consider data-dependent time series, can automatically learn complex nonlinear relationships from large amounts of data containing complex noise without requiring an accurate system model. LSTM networks, through their special gating structure, can effectively handle long-term dependencies in time-series data, achieving good results in fields such as pose prediction. However, when dealing with dynamically changing data, LSTM networks often use a fixed window length, failing to dynamically adjust the range of input information according to real-time data changes, resulting in insufficient generalization ability under different data distributions. Furthermore, traditional LSTM training methods are usually offline, making it difficult to adapt to new data in real time; when the data distribution changes, the model's performance degrades significantly. Summary of the Invention

[0005] To address the shortcomings of existing attitude prediction methods, such as low prediction accuracy and poor adaptability in complex and ever-changing real-world environments, this invention combines the advantages of model-driven and data-driven approaches. It proposes a joint attitude angle estimation method that integrates a Long Short-Term Memory (LSTM) network based on dynamic windows and incremental learning with a multivariate Kalman filter based on dynamic adaptive noise. This method fully leverages the powerful nonlinear modeling capabilities of the LSTM network and the real-time estimation advantages of the Kalman filter to achieve accurate attitude prediction, thereby improving the accuracy and adaptability of attitude prediction.

[0006] The technical solution of this invention is as follows:

[0007] An attitude angle estimation method based on LSTM and Kalman filtering includes the following steps:

[0008] Step 1: Acquire and preprocess the status data of the unmanned surface vessel (USV) during navigation; the status data includes USV attitude angle information, speed information, and navigation mode information; the data preprocessing includes: supplementing missing values ​​for USV attitude angle information and speed information, removing obvious erroneous or abnormal data points, and performing normalization processing; the navigation mode data is then concatenated with the USV attitude angle information and speed information according to time steps.

[0009] Step 2: Establish and train an LSTM model using the collected state data, and use the LSTM prediction model to predict the attitude angle of the unmanned surface vessel;

[0010] Step 3: Use the LSTM prediction as the prior estimate of the Kalman filter, use the real-time data collected by the system as the measurement value, and fuse the Kalman filter output prediction result;

[0011] Step 4: Rolling Training and Joint Prediction: Use the LSTM output as a prior estimate for the Kalman filter, and combine it with sensor measurements to filter and output the final prediction result. Collect new data at data intervals and update the historical queue. The LSTM window length is dynamically adjusted, incremental learning is performed to update the model parameters, Kalman filter noise parameters are estimated, and the state is updated.

[0012] Furthermore, in step 2, the LSTM model is trained and updated using incremental online learning. When new data arrives, the new data is added to the existing dataset, and the model is fine-tuned without retraining the entire model.

[0013] Furthermore, in step 2, an LSTM network with a dynamic window length is used for prediction. During training and prediction, the length of the input window is dynamically adjusted according to the complexity and trend of the data. When the data complexity is high, the window length is increased to capture more historical information, and when the data complexity is low, the window length is decreased to improve the real-time performance of the model.

[0014] Furthermore, the specific process in step 2 is as follows:

[0015] Step 2.1: Build the LSTM model and set the model hyperparameters;

[0016] Step 2.2: Train the LSTM model according to the set hyperparameters and loop period. The entire training dataset is traversed multiple times.

[0017] Step 2.3: Update the input window by adding one data point at each time step to complete the attitude angle prediction; this step does not calculate gradients or update model parameters.

[0018] Step 2.4: Online training of model parameters using incremental learning: After accumulating a certain time step, preprocess the newly added data points within the accumulated time step to obtain input data and label data, based on the new training rounds. Fine-tune the model during training and update the model parameters;

[0019] Step 2.5: The LSTM prediction model continuously outputs attitude angle predictions.

[0020] Furthermore, in step 2, the input window size is based on the standard deviation of the current window data. Make dynamic adjustments:

[0021] when This indicates that the data is fluctuating significantly and the window needs to be increased. The new window size is [size missing]. ,in To set the preset maximum value, This is the upper limit of the preset threshold range;

[0022] when This indicates that the window size can be reduced if the data fluctuation is small. ,in To preset the minimum value, This is the lower limit of the preset threshold range.

[0023] Furthermore, in step 3, during the Kalman filtering process, a dynamic adaptive method is used to calculate process noise and measurement noise; based on the system state changes and the statistical characteristics of the measurement data, the process noise matrix and measurement noise matrix are adjusted in real time.

[0024] Furthermore, the specific process of step 3 is as follows:

[0025] Step 3.1: Establish the state equations

[0026]

[0027] in The LSTM model is used to predict the output state vector, specifically the predicted heading angle, pitch angle, and roll angle. Here is the state transition matrix. To control the input matrix, To control the input, This is process noise;

[0028] Step 3.2: Establish the observation equation

[0029]

[0030] in The observed values ​​are vectors composed of the three original values ​​of the actual measured attitude angles. For the observation matrix, For measuring noise;

[0031] Step 3.3: Adaptive Dynamic Noise Parameters

[0032] Noise statistical characteristics are estimated based on historical measurement data; the process noise covariance matrix is ​​calculated using the sliding window method. and measurement noise covariance matrix :

[0033]

[0034]

[0035] in For process noise, To measure noise, and For the corresponding mean, The sliding window size; process noise samples are estimated using state prediction error estimation: The noise samples are estimated by observing the residuals: ;

[0036] Step 3.4: Update Steps

[0037] Kalman gain:

[0038] Status Update:

[0039] Error covariance update:

[0040] in, For Kalman gain, Let be the error covariance matrix. To predict the state, This is the prediction error covariance matrix.

[0041] Furthermore, in step 1, the navigation modes include remote control mode, autonomous patrol mode, autonomous pursuit mode, autonomous interception mode, and autonomous return mode. The navigation mode information is converted into a 5-dimensional binary vector that the model can process using one-hot encoding.

[0042] Beneficial effects

[0043] This invention proposes an attitude angle estimation method based on LSTM and Kalman filtering, which has the following advantages:

[0044] 1. High prediction accuracy:

[0045] LSTM's nonlinear modeling capabilities: LSTM networks can automatically learn complex nonlinear relationships from large amounts of data and accurately predict changes in the pose of objects; especially when dealing with complex dynamic systems, LSTM can capture long-term dependency information in the data, improving the accuracy of predictions.

[0046] Real-time estimation using Kalman filtering: Kalman filtering can estimate the state of a system in real time based on its dynamic characteristics and measurement information. By combining the prediction results of LSTM with Kalman filtering, the advantages of both can be fully utilized to further improve the accuracy of prediction.

[0047] 2. Enhanced adaptability:

[0048] Dynamic window length: LSTM networks with dynamic window length can dynamically adjust the length of the input window according to the complexity and changing trends of the data; this allows the model to maintain good performance under different data distributions and improves the model's generalization ability.

[0049] Incremental online learning: Incremental online learning enables the model to quickly adapt to new data. When the data distribution changes, the model can adjust its parameters in a timely manner to maintain good predictive performance.

[0050] Dynamic adaptive noise calculation: The Kalman filter employs a dynamic adaptive method to calculate process noise and measurement noise, enabling real-time adjustment of the noise matrix based on system state changes and the statistical characteristics of measurement data. This allows the Kalman filter to maintain good performance under different environments, improving the accuracy and stability of the filtering.

[0051] 3. Good real-time performance:

[0052] Incremental online learning: Incremental online learning avoids the overhead of retraining the entire model and can quickly update the model when new data arrives, improving the model's real-time performance.

[0053] The high efficiency of Kalman filtering: Kalman filtering has the advantage of high computational efficiency, enabling rapid state estimation and prediction in real-time systems. Combined with the prediction results of LSTM, it can meet real-time requirements while ensuring prediction accuracy.

[0054] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0055] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:

[0056] Figure 1 It is a control method diagram;

[0057] Figure 2 This is an effect estimation diagram. Detailed Implementation

[0058] The embodiments of the present invention are described in detail below. These embodiments are exemplary and intended to explain the present invention, and should not be construed as limiting the present invention.

[0059] This embodiment focuses on unmanned surface vessel (USV) attitude prediction as the mission requirement. The USV is equipped with marine inertial navigation equipment and computing processing equipment. Specifically, it proposes an attitude angle estimation method based on LSTM and Kalman filtering, which includes the following steps:

[0060] Step 1: Acquire and preprocess the status data of the unmanned surface vessel during its navigation process;

[0061] The data includes attitude angle information (heading angle and angular velocity, pitch angle and angular velocity, roll angle and angular velocity), speed information, and navigation mode information output by the onboard inertial navigation equipment under different operating conditions and environments. The navigation modes include five categories: remote control mode, autonomous patrol mode, autonomous pursuit mode, autonomous interception mode, and autonomous return mode. These modes are converted into 5-dimensional binary vectors that the model can process using a one-hot encoding method. [ 1,0,0,0,0 ] 、 [ 0,1,0,0,0 ] 、 [ 0,0,1,0,0 ] 、 [ 0,0,0,1,0 ] 、 [ 0,0,0,0,1 ] Strictly preserving category independence. Data was collected at intervals of 50Hz, the frequency of the inertial navigation device's output data, and the raw data was stored in time series order. This dataset serves as system observation data, describing the motion states of objects within the system.

[0062] Data preprocessing includes: supplementing missing values ​​for unmanned surface vessel (USV) attitude angle and speed information, removing obvious errors or abnormal data points, and performing normalization; and stitching the navigation mode data with the USV attitude angle and speed information according to time steps.

[0063] The complement value is obtained by using linear interpolation to handle missing values ​​in the dataset; it corresponds to a specific missing value in the time series. Take its adjacent points and To estimate Outlier detection is performed using the statistical Z-score method to identify outliers in the data, for each data point. Calculate its Z-score value ,in It is the mean of the dataset. It is the standard deviation. When it exceeds twice the preset threshold, the point is identified as an outlier and treated as a missing value.

[0064] The min-max normalization method is employed, where the maximum and minimum values ​​of each feature dimension are independently calculated on the dataset to avoid cross-dimensional mixed calculations; for a given feature... ,calculate ,in and These are the minimum and maximum values ​​of the feature in the dataset, respectively.

[0065] An adaptive window mechanism is used to convert the historical data sequence, which is composed of multiple preprocessed attitude angles, speeds and navigation patterns, into the input data format that meets the requirements of the LSTM model, thus obtaining the training dataset. The input data format that meets the requirements of the LSTM model adopts a 3D tensor mode, specifically the number of samples, time steps and the number of features. This allows for the sliding and truncation of samples on the time series dataset through a window that dynamically adjusts its size based on the data.

[0066] Set window size to To ensure the time-series correlation of the data, reduce computational load, and avoid overfitting, this embodiment initially selects a relatively small window size of 50; corresponding to the time-series data. X = [ x 1 , x 2 , ⋯ , x W ] ,in x i = [ h i , p i , r i , hv i , pv i , rv i , v i , cm i ] T It is the first Input data at any given time, including heading angle Pitch angle Roll angle angular velocity of heading Pitch angular velocity Roll rate speed Navigation mode The input data is 12-dimensional data, composed of 7-dimensional data consisting of attitude angles and speed, and 5-dimensional data consisting of operating modes. The input data sample format is as follows: X = [ x 1 , x 2 , ⋯ , x W ] The corresponding target output is , as label data.

[0067] Step 2: Establish and train an LSTM model using the collected state data, and use the LSTM prediction model to predict the attitude angle of the unmanned surface vessel.

[0068] This invention employs incremental online learning to train and update the LSTM model. When new data arrives, it is added to the existing dataset, and the model is fine-tuned instead of retraining the entire model. This allows the model to quickly adapt to data changes, improving its real-time performance and adaptability. A dynamically sized LSTM network is used for prediction. During training and prediction, the input window length is dynamically adjusted based on the data complexity and trends. Specifically, by calculating complexity metrics such as the standard deviation of the data, the window length is increased when the data complexity is high to capture more historical information; when the data complexity is low, the window length is decreased to improve the model's real-time performance.

[0069] The specific process is as follows:

[0070] Step 2.1: Build the LSTM model and set its hyperparameters. This model is built using existing PyTorch tools. The model input is a 3D tensor (number of samples, time step, number of features), and the output is a 2D tensor (number of samples, number of features). The model hyperparameters include the number of input features. Hidden layer Number of model layers Output feature number In this embodiment, the input feature number 12. Hidden layer Number of model layers: 64 2. Output feature number The value is 3.

[0071] Step 2.2: Train the LSTM model, according to the settings of various hyperparameters ( , , , ) and cycle period (Choose a value of 2500) Iterate through the entire training dataset multiple times. In each cycle, perform the following processes sequentially:

[0072] (1) Forward propagation: passing a window of training data The data is input into the model, which processes the input dataset based on the current parameters and outputs the prediction results.

[0073] The LSTM model includes an input gate, a forget gate, an output gate, and cell states. The specific calculation process is as follows:

[0074] For time step t, the input is the current input. The hidden state of the previous time step and cell state :

[0075] Input Gate:

[0076] Forgotten Gate:

[0077] Cell candidates:

[0078] Output gate:

[0079] Cell state:

[0080] Hidden state:

[0081] in It is the sigmoid function. This indicates element-wise multiplication. , , , , , , , , , , , , , , and These are the model parameters. The hidden state at the last time step after processing by the LSTM layers. The output is obtained through a fully connected layer: ,in and These are parameters for the fully connected layer.

[0082] (2) Calculate the loss: The mean squared error (MSE) is used as the loss function to calculate the predicted output. and Differences between them:

[0083]

[0084] in It is the output dimension. It is the predicted output of the first One element, It is the first of the real labels Each element.

[0085] (3) Backpropagation: Based on the calculated loss value, the gradient of each parameter in the model is calculated using the chain rule:

[0086] Calculate the gradient of the loss with respect to the output:

[0087] Calculate the gradient of the fully connected layer:

[0088]

[0089]

[0090] The gradients of each parameter in the LSTM layer, including the gradients of the input gate, forget gate, output gate, and cell state-related weights and biases, are calculated using the backpropagation time-to-time (BPTT) algorithm.

[0091] (4) Parameter update: The model parameters are updated using the calculated gradient. The optimizer uses the Adam algorithm to adjust the parameter values ​​with a step size of 0.001 to ensure that the loss function decreases continuously after each iteration. The Adam algorithm can adaptively adjust the learning rate of each parameter.

[0092] Initialize Adam algorithm parameters, including setting the first moment estimate. Set the second moment estimate to zero. Set to zero, set the number of iterations. Zero;

[0093] During the backpropagation calculation, the gradient of each parameter... The gradient attribute of the parameter has been calculated and stored:

[0094]

[0095] Number of update iterations, first-order moment estimate, and second-order moment estimate:

[0096]

[0097]

[0098]

[0099] in and These are the hyperparameters of the Adam optimizer; we selected the default values ​​of 0.9 and 0.999.

[0100] Correcting deviations to prevent them in the early stages of training. and It will tend to be 0:

[0101]

[0102]

[0103] Update parameters: based on the corrected first moment estimate and second-order moment estimation Update model parameters :

[0104]

[0105] in This is the learning rate, which is 0.001 in this embodiment. It is a very small constant, and in this embodiment, it takes the value of This is used to avoid the denominator being zero.

[0106] In addition, since the gradient is accumulated during each backpropagation, the gradient must be cleared at the beginning of each cycle to avoid continuous gradient accumulation and parameter update errors caused by not clearing the gradient.

[0107] Step 2.3: Add one data point at each time step. The input window is updated in this way to complete the attitude angle prediction. This step does not calculate gradients or update model parameters.

[0108] Step 2.4: Train the model parameters online using an incremental learning model. After accumulating a certain time step, preprocess the newly added data points within the accumulated time step to obtain the input data and label data, based on the new training epochs. ( Fine-tune the model using the same training method as step 2.2, update the model parameters, and ensure that the update of the input window affects the model training results.

[0109] Step 2.5: Continuously output the prediction for one time step. and will Attitude angles spliced ​​into a 2D tensor mode Output.

[0110] In this embodiment, the window size is based on the standard deviation of the data, which reflects the degree of data dispersion and complexity. Dynamic adjustments are necessary. High data complexity indicates drastic data changes, requiring a larger window to capture long-term dependencies. Conversely, lower data complexity necessitates a smaller window. The selection is based on the current window data. [ x 1 , x 2 , ⋯ , x W ] Its standard deviation is:

[0111]

[0112] in, It is the average of the data within the window.

[0113] when This indicates that the data is fluctuating significantly and the window needs to be increased. The new window size is [size missing]. Among them, preset For 100, It is 1.0;

[0114] when This indicates that the window size can be reduced if the data fluctuation is small. Among them, preset It is 10. It is 0.1.

[0115] The dynamic window updates at a time based on a cumulative step size. After each step, new data points are added, the change index within the window is recalculated, and the window size is adjusted. Immediately after the window size is adjusted, samples are input, and the model retraining step 2.4 is triggered. This process is called cyclically and the window size is dynamically adjusted in this method.

[0116] Step 3: Use the LSTM prediction as the prior estimate for the Kalman filter, and the real-time collected data as the measured values, then fuse them with the Kalman filter output to achieve the final prediction result. Perform multivariate Kalman filtering using the output data obtained in Step 2, including the data output from the LSTM model. Construct the state equation and use the first three columns of data input to the LSTM model as a subset. Construct the observation equation.

[0117] In this step, a dynamic adaptive method is used to calculate process noise and measurement noise during the Kalman filtering process. The process noise matrix and measurement noise matrix are adjusted in real time based on system state changes and the statistical characteristics of the measurement data. Specifically, the statistical characteristics of the noise are estimated by calculating the covariance matrix of historical measurement data, and the noise matrix is ​​dynamically updated based on the current measurement data and prediction results to improve the accuracy and stability of the Kalman filter. The prediction results of the LSTM are used as the initial state estimate for the Kalman filter. Combined with the current measurement data, the final attitude prediction result is obtained through the prediction and update steps of the Kalman filter. The Kalman filter can effectively fuse the prediction information of the LSTM and the measurement data, further improving the accuracy and reliability of the prediction.

[0118] The specific process is as follows:

[0119] Step 3.1: Establish the state equations

[0120]

[0121] in Predict the output state vector (3-dimensional data, specifically the predicted heading angle, pitch angle, and roll angle) for the LSTM model. Let the state transition matrix be (set as the identity matrix). ), To control the input matrix, For control input (angular velocity information). This is process noise.

[0122] Step 3.2: Establish the observation equation

[0123]

[0124] in The observed values ​​(the vector composed of the three original values ​​of the actual measured attitude angles). The observation matrix (set as the identity matrix) ), For measuring noise.

[0125] Step 3.3: Adaptive Dynamic Noise Parameters

[0126] To adapt to real-time changes in system status and measured values, process noise and measurement noise are dynamically adjusted.

[0127] Noise statistical characteristics are estimated based on historical measurement data. The process noise covariance matrix is ​​calculated using the sliding window method. and measurement noise covariance matrix :

[0128]

[0129]

[0130] in For process noise, To measure noise, and For the corresponding mean, The sliding window size. Process noise samples are estimated using state prediction error estimation: The noise samples are estimated by observing the residuals: .

[0131] The noise covariance matrix is ​​dynamically updated based on the latest prediction and measurement data to improve the accuracy and stability of Kalman filtering.

[0132] Step 3.4: Update Steps

[0133] Kalman gain:

[0134] Status Update:

[0135] Error covariance update:

[0136] in, For Kalman gain, Let be the error covariance matrix. To predict the state, This is the prediction error covariance matrix.

[0137] Step 4: Rolling training and joint prediction. The LSTM output is used as the prior estimate for the Kalman filter, and combined with the sensor measurements (true values) to output the final prediction result. Collect new data at data intervals and update the historical queue. The LSTM window length is dynamically adjusted, incremental learning is performed to update model parameters (weights and biases of input gates, forget gates, output gates, and parameters of fully connected layers), Kalman filter noise parameters are estimated, and the state is updated.

[0138] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention without departing from the principles and spirit of the present invention.

Claims

1. A method for estimating attitude angles based on LSTM and Kalman filter, characterized in that: The method comprises the following steps: Step 1: obtaining and preprocessing the state data of the unmanned ship during sailing; The state data comprises attitude angle information, sailing speed information and sailing mode information of the unmanned ship; The preprocessing of the data comprises: supplementing missing values, eliminating obvious error or abnormal data points, and normalizing the attitude angle information and sailing speed information of the unmanned ship; and splicing the sailing mode data according to time steps with the attitude angle information and sailing speed information of the unmanned ship; Step 2: training an LSTM model by using the collected state data, and predicting the attitude angle of the unmanned ship by using the LSTM prediction model; Step 3: taking the LSTM prediction as a priori estimation of Kalman filtering, taking the real-time collected values as measurement values, and fusing the prediction results output by Kalman filtering. Step 4: Rolling training and joint prediction: use LSTM output as priori estimation of Kalman filter, combine with sensor measurement to filter and output final prediction result ; collect new data according to data interval and update history queue , dynamically adjust the length of LSTM window, perform incremental learning to update model parameters, estimate Kalman filter noise parameters and update state.

2. The method of claim 1, wherein the method is based on LSTM and Kalman filter. In step 2, the LSTM model is trained and updated in an incremental online learning manner, when new data arrives, the new data is added to the existing data set, and the model is fine-tuned, without retraining the entire model.

3. The method of claim 1, wherein the method is based on LSTM and Kalman filter. In step 2, a dynamic window length LSTM network is used for prediction, in the training and prediction process, the length of the input window is dynamically adjusted according to the complexity and trend of the data, when the data complexity is high, the window length is increased to capture more historical information, when the data complexity is low, the window length is reduced to improve the real-time performance of the model.

4. The method of claim 1, wherein the method is based on LSTM and Kalman filter. The specific process in step 2 is as follows: Step 2.1: establishing an LSTM model and setting model hyperparameters; Step 2.2: Train the LSTM model with the set hyperparameters and cycle period Multiple passes over the entire training dataset; Step 2.3: updating the input window in the manner of adding one data point per time step, and completing the attitude angle prediction; This step does not calculate the gradient and does not update the model parameters; Step 2.4: Online learning of the training model parameters by the incremental learning model: after accumulating a certain time step, the newly added data points in the accumulated time step are preprocessed to obtain input data and label data, and the new training round number Fine-tuning the model and updating the model parameters; Step 2.5: the LSTM prediction model continuously outputs the attitude angle prediction.

5. The method of claim 1, wherein: In step 2, the input window size is dependent on the standard deviation of the current window data Dynamic adjustment: When , it indicates that the data fluctuation is large and the window needs to be increased, and the new window size is , wherein is a preset maximum value, is an upper limit of a preset threshold range; When , indicates that the data fluctuation is small, the window can be reduced, and the new window size , wherein is a preset minimum value, is a lower limit of a preset threshold range.

6. The method of claim 1, wherein: In the Kalman filtering process in step 3, a dynamic adaptive method is used to calculate the process noise and measurement noise; According to the state change of the system and the statistical characteristics of the measurement data, the process noise matrix and the measurement noise matrix are adjusted in real time.

7. The method of claim 6, wherein the method is based on LSTM and Kalman filter. The specific process in step 3 is as follows: Step 3.1: establishing a state equation wherein is the LSTM model prediction output state vector, specifically the predicted heading angle, pitch angle, and roll angle, is the state transition matrix, is the control input matrix, is the control input, is the process noise; Step 3.2: establishing an observation equation wherein is the vector of 3 -dimensional raw values of the actual measured attitude angles, is the measurement matrix, is the measurement noise; Step 3.3: dynamic noise parameter adaptation Estimate noise statistics from historical measurement data; use a sliding window approach to compute process noise covariance matrix and measurement noise covariance matrix : wherein is the process noise, is the measurement noise, and is the corresponding mean, is the size of the sliding window; Process noise samples are estimated by state prediction errors: Measurement noise samples are estimated by observation residuals: ; Step 3.4: update step Kalman gain: Status update: Error covariance update: wherein, is the Kalman gain, is the error covariance matrix, is the predicted state, is the predicted error covariance matrix. 8.The method of claim 1, wherein: In step 1, the sailing mode comprises remote control mode, autonomous patrol mode, autonomous pursuit mode, autonomous interception mode and autonomous return mode, and the sailing mode information is converted into a 5-dimensional binary vector in a one-hot encoding mode.