An unmanned ship trajectory tracking method based on flow matching learning dynamics model

By learning the dynamic model through flow matching, generating a multimodal predicted trajectory set and evaluating the cost, the stability problem of trajectory tracking control of unmanned vessels in complex water environments is solved, and stable tracking under extreme conditions is achieved.

CN122431343APending Publication Date: 2026-07-21HUZHOU INST OF ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUZHOU INST OF ZHEJIANG UNIV
Filing Date
2026-04-22
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing unmanned surface vessel trajectory tracking and control methods cannot effectively characterize multimodal uncertainties in complex water environments, leading to steady-state errors or closed-loop instability in the control system under complex sea conditions. Furthermore, existing data-driven dynamic networks suffer from decreased prediction accuracy when faced with highly random and multimodal environmental disturbances, making it difficult to achieve high-frequency, adaptive, and stable tracking.

Method used

A flow matching learning dynamics model is adopted. By constructing a flow matching dynamics network and training it with a massive virtual trajectory dataset, a multimodal predicted trajectory set is generated. Combined with a comprehensive cost evaluation system, the optimal physical control command is output in a rolling manner to achieve stable tracking of complex wind and wave disturbances.

Benefits of technology

When faced with extreme and unpredictable operating conditions outside the distribution, it maintains the stability of trajectory tracking control, accurately characterizes the multimodal probability distribution under wind and wave disturbances, breaks through the limitations of traditional deterministic models, and achieves high-frequency, adaptive, and stable tracking control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122431343A_ABST
    Figure CN122431343A_ABST
Patent Text Reader

Abstract

The application discloses an unmanned ship trajectory tracking method based on a flow matching learning dynamics model, which comprises the following steps: generating a large amount of virtual trajectory data sets on a physical simulation platform; cutting the data sets into time sequence samples and inputting the time sequence samples into a flow matching dynamics network to train a continuous probability flow objective function by minimizing the difference between a predicted velocity field vector and a target velocity field vector; performing parallel inference by using the trained flow matching dynamics network to generate a multi-modal prediction trajectory set covering future various environmental uncertainties, and then integrating the multi-modal prediction trajectory set into a comprehensive cost evaluation system to perform cost integral evaluation and rollingly output optimal physical control instructions. The flow matching dynamics network accurately depicts the multi-modal probability distribution of trajectory evolution under complex wind and wave disturbance, completely breaks through the limitation that a traditional deterministic model cannot cope with high random sea conditions by means of 'point estimation', and enables the unmanned ship to maintain stable trajectory tracking control even when facing extreme harsh working conditions outside the distribution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent control technology for unmanned surface vehicles, specifically to a method for tracking the trajectory of unmanned vessels based on a flow matching learning dynamics model. Background Technology

[0002] Unmanned surface vessels (USVs) are playing an increasingly important role in fields such as marine exploration, environmental monitoring, maritime search and rescue, and autonomous patrol. Trajectory tracking control is a core underlying technology that enables USVs to achieve advanced autonomous navigation missions. Its goal is to enable the USV to accurately and stably follow a preset reference route by adjusting the USV's actuators (such as thruster throttle and rudder angle).

[0003] Currently, mainstream USV trajectory tracking control methods are mainly divided into control based on traditional mechanistic models (such as traditional model predictive control) and control based on data-driven models (such as multilayer perceptron (MLP), long short-term memory network (LSTM), and Transformer). These methods calculate and issue optimal control commands by predicting the future motion state of the USV to achieve dynamic tracking of a preset route.

[0004] However, existing deterministic dynamic models cannot effectively characterize multimodal uncertainties in complex water environments, and the accompanying stochastic predictive control algorithms struggle to balance robustness and real-time performance when onboard computing power is limited, ultimately leading to trajectory tracking control instability. The specific reasons are as follows:

[0005] First, in traditional mechanistic models, the complex nonlinear hydrodynamic effects in real waters (such as wave-making drag, nonlinear hydrodynamic damping, and added mass) as well as highly time-varying external disturbances such as wind, waves, and currents are difficult to model accurately. This model mismatch caused by unmodeled dynamics can easily lead to significant steady-state errors or even closed-loop instability in the control system under complex sea conditions.

[0006] Secondly, most existing data-driven dynamics networks are deterministic models. When faced with highly random and multimodal environmental disturbances on the real water surface, deterministic models force all possible environmental uncertainties to be averaged, collapsing into a single, definite expected value for the future trajectory. This "point estimation" method cannot effectively characterize the multimodal probability distribution of the trajectory caused by wind and wave disturbances, resulting in a sharp drop in prediction accuracy when facing extreme conditions or transient strong disturbances outside the distribution, making it difficult to support the safety avoidance and robust optimization of downstream controllers.

[0007] Finally, to address the aforementioned uncertainties at the control end, sampling-based stochastic predictive control algorithms are typically introduced. However, the need to extend the predictive horizon to improve control foresight severely conflicts with the high-frequency control loop. This imposes unbearable inference latency pressure on resource-constrained unmanned surface vessel (USV) onboard computing platforms, preventing the system from achieving high-frequency, adaptive, and stable tracking, and significantly limiting its practical engineering deployment.

[0008] Therefore, existing technologies still lack a method for unmanned vessel trajectory tracking control that can maintain stable trajectory tracking control in complex water environments. Summary of the Invention

[0009] To overcome the problems of the existing technologies, this invention provides an unmanned surface vessel (USV) trajectory tracking method based on a flow-matching learning dynamics model. This method utilizes a flow-matching dynamics network to accurately characterize the multimodal probability distribution of trajectory evolution under complex wind and wave disturbances, completely overcoming the limitation of traditional deterministic models' "point estimation" in handling highly random sea conditions. This enables the USV to maintain stable trajectory tracking control even when facing extremely harsh operating conditions outside the distribution range.

[0010] This invention proposes a method for unmanned surface vessel trajectory tracking based on a flow matching learning dynamics model, comprising the following steps:

[0011] Step S1: Generate a massive virtual trajectory dataset on the physical simulation platform;

[0012] Step S2: Construct a flow matching dynamics network; divide the virtual trajectory dataset into time series samples and input them into the flow matching dynamics network. Use the objective function of minimizing the difference between the predicted velocity field vector and the target velocity field vector as the continuous probability flow objective function to train the flow matching dynamics network. After fine-tuning with real water data, the trained flow matching dynamics network is obtained.

[0013] Step S3: Collect observation data from the unmanned vessel in real time, input it into the trained flow matching dynamics network for parallel inference, and generate a multimodal predicted trajectory set covering various environmental uncertainties in the future; incorporate the multimodal predicted trajectory set into the comprehensive cost evaluation system for cost integral evaluation, and output the optimal physical control command in a rolling manner.

[0014] Preferably, step S1 includes the following steps:

[0015] Step S11: Import a model file that matches the actual ship hull size into the open-source computational fluid dynamics tool OpenFOAM;

[0016] Step S12: Design simulation scenarios for different flight states in OpenFOAM, calculate and extract the hydrodynamic parameters of the unmanned vessel based on the designed simulation scenarios, and load the hydrodynamic parameters of the unmanned vessel into the IsaacSim simulator; the hydrodynamic parameters of the unmanned vessel include the added mass matrix and the water damping coefficient matrix;

[0017] Step S13: Construct a three-dimensional virtual water surface environment based on the IsaacSim physics simulation engine and introduce a perturbation configuration; the perturbation configuration includes parameter domain randomization and environmental noise interference;

[0018] Step S14: Drive the unmanned vessel to navigate, record the state transition process of the unmanned vessel in a high-concurrency manner, and generate a massive virtual trajectory dataset.

[0019] Preferably, step S2 includes the following steps:

[0020] Step S21: In the discrete time step Record the global state vector of the unmanned surface vessel. With command control input The global state vector xt at least includes the unmanned vessel's absolute position coordinates, heading angle, and linear and angular velocities in each degree of freedom in the global coordinate system. To eliminate the unboundedness of the absolute position coordinates in the global coordinate system and its interference with dynamic generalization learning, the state changes between adjacent time steps are calculated. The absolute state is converted into time-difference state data based on the ship's coordinate system, and the preset historical window length is set to... The predicted horizon length is The massive virtual trajectory dataset is divided into segments of length using a sliding window. Fixed-length time series samples;

[0021] Step S22: Construct a flow matching dynamics network; the flow matching dynamics network uses a DiT architecture containing only decoders as the backbone network, and outputs the continuous probability flow velocity field vector corresponding to the future state by inputting the historical state sequence and the historical command control sequence into the flow matching dynamics network.

[0022] Step S23: Input the time series samples obtained in step S21 into the flow matching dynamics network, and complete the basic pre-training of the network by optimizing the objective function of the continuous probability flow;

[0023] Step S24: Collect small sample trajectory data of a real outdoor lake surface under conditions of no wind, continuous wind, gusts, and with added loads. Using the same sliding window rule as in Step S21, serialize the real data and input it into the pre-trained flow matching dynamics network for fine-tuning to compensate for unmodeled complex hydrodynamic characteristics and bridge the physical differences between simulation and reality. The trained flow matching dynamics network is then obtained.

[0024] Preferably, the objective function is a hybrid loss function. : ; ; ;

[0025] The flow matching loss term guides the model in learning multimodal probability distribution features; its formula is defined as the predicted velocity field vector. With the target velocity field vector Expected difference: setting penalty weights , . The mean squared error loss term is used to impose a strong physical consistency constraint on the network to prevent trajectory divergence. This represents the network's prediction of future trajectories. That is the corresponding actual trajectory data.

[0026] Preferably, the network dimension mapping rule of the flow matching dynamics network is as follows:

[0027] The historical state sequence is linearly projected onto a pre-defined high-dimensional latent space through a state coding layer;

[0028] Historical instruction control sequences and future instruction control sequences are mapped to the same dimension as the state encoding layer through the action encoding layer;

[0029] The temporal interpolation variables of stream matching are embedded as features using sinusoidal position encoding. Then, the above feature embeddings are concatenated and combined to generate a context feature embedding sequence.

[0030] The noisy predicted trajectory sequence is processed through an input coding layer with the same dimension as the state coding layer to extract features and generate a corresponding trajectory token sequence.

[0031] The context feature embedding sequence and the trajectory token sequence are respectively superimposed with a learnable positional encoding and then input into the DiT model block. Finally, the features are mapped to the output velocity field vector through the output projection layer. .

[0032] Preferably, during the fine-tuning stage, the network weights of the underlying state encoding layer and action encoding layer are frozen, and the parameters of the deep DiT model blocks are iteratively updated only using a decaying learning rate, thus completing the final solidification of the flow matching dynamics network.

[0033] Preferably, the DiT model block employs adaptive layer normalization combined with activation functions to inject context feature embedding sequences and complete feature interaction.

[0034] Preferably, step S3 includes the following steps:

[0035] Step S31: Control Timing Decoupling and High-Dimensional Trajectory Sampling: The discrete control closed-loop time step of the unmanned vessel is decoupled from the prediction time step of the flow matching dynamics network. Based on the pre-optimized sampling covariance matrix, multiple sets of candidate command control sequences containing distributed noise are generated in the action space. A decoupling mechanism between control and prediction time steps and a pre-optimized covariance sampling strategy are introduced to ensure exploration quality with very few samples. This enables low-latency and highly robust rolling issuance of optimal control commands on a computationally limited airborne platform.

[0036] Step S32: Multimodal future trajectory high concurrency generation: Combine the current historical state of the unmanned vessel with the multiple sets of candidate instruction control sequences, and use the flow matching dynamics network for parallel reasoning to generate a multimodal predicted trajectory set covering multiple environmental uncertainties in the future;

[0037] Step S33: Risk perception cost assessment and optimal command optimization: Based on the reference trajectory and physical obstacle avoidance constraints, the cost integral assessment of the multimodal predicted trajectory set is performed, the baseline control sequence is updated by exponential weighting, and the optimal physical execution command at the current moment is extracted and sent to the unmanned vessel.

[0038] Preferably, step S33 includes the following steps:

[0039] Step S3301: Calculation of comprehensive evaluation cost based on the motion characteristics of unmanned vessel: For each candidate predicted trajectory in the multimodal predicted trajectory set generated in step S32, the corresponding comprehensive evaluation cost of trajectory tracking is calculated based on the expected position, expected velocity, and expected heading derived from the expected velocity direction provided by the reference planner.

[0040] The specific calculation steps for the comprehensive assessment cost include:

[0041] Calculate the squared distance deviation between the predicted position and the desired position to obtain the position tracking cost;

[0042] Extract the predicted longitudinal and lateral velocities of the unmanned surface vessel. By introducing a sign term for the longitudinal velocity, determine the orientation of the actual motion. Calculate the magnitude of the resultant velocity with direction and obtain the squared deviation between the resultant velocity magnitude and the desired velocity to obtain the speed tracking cost.

[0043] Based on the cosine value of the difference between the predicted heading angle and the desired heading angle, a nonlinear penalty term, i.e., 1 minus the cosine value, is constructed to calculate the heading tracking cost in order to avoid abrupt deviations caused by periodic angular winding.

[0044] Calculate the square of the amplitude of the corresponding candidate instruction control sequence to obtain the control quantity penalty cost used to ensure the smooth operation of the actuator;

[0045] The position tracking cost, velocity tracking cost, heading tracking cost, and control penalty cost are each assigned an independent weight coefficient, and the weighted costs are linearly summed to obtain the comprehensive evaluation cost of a single trajectory.

[0046] Step S3302: Optimal sequence weighted output based on Softmax exponential transformation: Substitute the calculated comprehensive evaluation cost of each candidate predicted trajectory into the model prediction path integral control framework; use the pre-set system temperature parameter to perform negative exponential operation and normalization on each comprehensive evaluation cost to obtain the weight distribution probability of the candidate instruction control sequence corresponding to each predicted trajectory, wherein the system temperature parameter is used to control the system's sensitivity to cost differences.

[0047] Step S3303: Optimal command extraction and rolling issuance: Using the obtained weighted distribution probability, the candidate command control sequences sampled are weighted and summed to calculate the expected optimal control sequence; the first time step action in the expected optimal control sequence is extracted as a physical execution command and issued to the unmanned vessel's underlying control system, and the remaining sequence is used as the benchmark mean of the Gaussian sampling distribution for the next control cycle to achieve rolling time-domain optimization.

[0048] Preferably, step S31 includes the following steps:

[0049] Step S3101: Prediction Time Step Amplification and Interpolation Compensation: Set the prediction time step for the flow matching dynamics network. The control execution discrete time step is greater than that of the unmanned surface vessel; in each control iteration, the input reference command control sequence is linearly interpolated according to the control execution discrete time step to compensate for factors. Amplify the missing intermediate time data to reduce airborne inference latency while maintaining high-frequency control closed loop;

[0050] Step S3102: Injecting pre-optimized covariance to overcome sampling noise: To address the decrease in dynamic fidelity caused by the amplification of the prediction step size, a pre-optimized task-specific sampling covariance matrix is ​​introduced to replace the standard Gaussian variance; distributed noise is injected into the interpolated baseline command control sequence through the task-specific sampling covariance matrix to generate... A parallel sequence of candidate instruction control sequences is used to ensure that even with a small sample size... Robust exploration and high-quality sampling can still be achieved under the constraints.

[0051] Preferably, step S32 includes the following steps:

[0052] S3201, Parallel Tensor Construction: Copy and expand the current historical time difference state sequence of the unmanned vessel, and combine it with the sequence generated in step S3102. Parallel candidate instruction control sequences are concatenated and paired along the feature dimension to construct a structure of size [size missing]. High-concurrency input tensor batching;

[0053] S3202, Probabilistic Flow Ordinary Differential Equation Solving and Trajectory Evolution: In the airborne computing unit, a time interpolation integration interval is set from the prior pure noise distribution to the true trajectory distribution; using the pure noise trajectory as the initial state, the high-concurrency input tensor batch is used as the conditional feature, and a multi-step iterative forward inference is performed along the time interpolation integration interval using an ordinary differential equation solver (such as the Euler method or the midpoint method); in each iteration, the adaptive flow matching dynamics network outputs the predicted velocity field vector at the current integration step, and by numerically integrating the predicted velocity field vector, the pure noise trajectory is gradually denoised and evolved into a true trajectory. A future time-difference prediction trajectory with physical meaning;

[0054] S3203, Global Coordinate Recovery: Based on the absolute position coordinates and heading angle of the unmanned vessel at the current moment, the evolved coordinates are recovered. The predicted future time difference trajectories are converted into a multimodal absolute trajectory sequence set in the global coordinate system through inverse coordinate system transformation, for use in subsequent cost assessment.

[0055] Compared with the prior art, the beneficial effects of the present invention are:

[0056] (1) Existing deterministic deep learning models are prone to prediction collapse (i.e., inaccurate point estimation) when facing unknown wind and waves. This invention introduces a flow-matching generative dynamics network, which accurately characterizes the multimodal probability distribution of trajectory evolution under complex wind and wave disturbances. By predicting the continuous probabilistic flow field of future states, it can generate a predicted trajectory envelope containing the multimodal uncertainty of the system in one go, completely breaking through the limitation of the traditional deterministic model's "point estimation" in dealing with highly random sea conditions. This enables unmanned vessels to still perform risk perception cost assessment and maintain trajectory tracking control stability when facing extreme and adverse conditions outside the distribution (such as continuous strong winds, sudden gusts, etc.), completely breaking through the technical bottleneck of traditional deterministic models being prone to instability under strong disturbances.

[0057] 2. Precisely compensates for unmodeled dynamics, perfectly bridging the physical gap between simulation and reality: Traditional mechanistic models struggle to accurately characterize complex damping and wave-making drag, easily leading to severe steady-state errors. This invention pioneers a progressive learning pipeline of "fluid simulation parameter extraction - physics engine domain randomization - real water area fine-tuning".

[0058] 3. Ensure the smooth and safe operation of the underlying actuators and avoid non-physical prediction and control oscillations: the hybrid objective function of this invention ( This ensures the underlying physical fidelity of the generated trajectory, avoiding the divergence that is prone to occur in traditional generative large models.

[0059] 4. In the real data fine-tuning stage, a hybrid loss function and weight solidification mechanism were introduced. While retaining large-scale basic physical prior knowledge, it greatly absorbed and compensated for the mismatch caused by nonlinear hydrodynamic residuals and changes in ship load in real waters, giving the model a strong cross-domain generalization and adaptive capability.

[0060] 5. Overcoming the bottleneck of onboard computing power to achieve high-frequency real-time control with long prediction horizons: Addressing the computing power conflict between extending the prediction horizon and high-frequency control loops in stochastic predictive control, this invention boldly abandons the time-consuming cross-attention mechanism at the network layer (replacing it with AdaLN for feature interaction), and innovatively implements a "decoupling mechanism between control and prediction time steps" and a "pre-optimized sampling covariance matrix" at the control layer. These hardware and software collaborative mechanisms enable the system to maintain high-quality action space exploration even with a very small number of samples, successfully achieving a balance between "long prediction horizon prediction" and "high-frequency, low-latency closed-loop control" on resource-constrained edge computing platforms.

[0061] 6. Furthermore, considering the underactuated characteristics of USVs, this application cleverly introduces a signed resultant velocity term and a nonlinear bow error term based on cosine values ​​into the cost function. It elegantly solves the problem of severe oscillation of control commands caused by periodic entanglement of angles (such as a jump from 359 degrees to 1 degree) in traditional Euler angle deviation control, making the issued physical commands exceptionally smooth and effectively reducing energy consumption. Attached Figure Description

[0062] Figure 1 This is a schematic diagram of data acquisition using the method of the present invention.

[0063] Figure 2 This is a schematic diagram of the control closed loop of the method of the present invention.

[0064] Figure 3 This is a schematic diagram of the network architecture and control calculation process of the method of the present invention.

[0065] Figure 4 This is a diagram showing the actual trajectory tracking effect of the method of the present invention in a real interference environment.

[0066] Figure 5 It is a graph showing the position and velocity tracking errors of each method in a comparative experiment under real interference environment.

[0067] Figure 6 This is a diagram showing the state control of the method of the present invention in a real interference environment. Detailed Implementation

[0068] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0069] This invention proposes a trajectory tracking method for unmanned surface vessels (USVs) based on a flow-matching learning dynamics model. This method combines flow-matching learning with model-predicted path integral control for adaptive trajectory tracking of USVs. The detailed implementation steps are as follows:

[0070] Step S1: Extract hydrodynamic parameters using OpenFOAM and implement large-scale parameter domain randomization using a physical simulation platform to generate massive amounts of virtual trajectory data for model pre-training. Specific execution details include the following:

[0071] S11. This embodiment uses the NanoApril small experimental catamaran unmanned surface vessel as an example, with a total hull length of approximately 0.6m and a width of approximately 0.4m. First, a high-precision 3D geometric model of this model is constructed, and surface and volume meshes are generated, ensuring local mesh refinement near the waterline and in the wake region. Then, the high-quality mesh file is imported into the open-source computational fluid dynamics tool OpenFOAM, and the water density in the fluid domain is set to 1000 kg / m³. 3 and initial kinematic viscosity boundary conditions.

[0072] S12. Design simulation scenarios in OpenFOAM that cover different flight conditions (e.g., longitudinal straight speed varying between 0 and 2.0 m / s, different yaw angles, and forced rolling motion). Calculate and extract the basic nominal hydrodynamic parameters. In a specific example, extract the added mass matrix. Includes: longitudinal added mass Approximately 12.8 kg, lateral additional mass Approximately 24.1 kg; extracted water damping coefficient matrix Includes first-order linear damping (such as longitudinal linear damping coefficient) Approximately 0.1 Ns / m) and the corresponding second-order nonlinear damping term. S13. A three-dimensional virtual water surface environment is constructed based on the NVIDIA IsaacSim physics simulation engine. To bridge the gap between simulation and reality, three types of disturbance configurations are forcibly introduced:

[0073] 1) Parameter domain randomization: Random sampling of the nominal mass of the unmanned vessel (6.7 kg) within a uniform distribution range of 5 to 9 kg (simulating an additional 1 to 2 kg real load), and applying an offset of ± 0.05 m to the center of mass position to simulate structural mismatch;

[0074] 2) Environmental noise interference: A spatially varying sinusoidal interference field is constructed to simulate wind and waves. The interference frequency is randomly sampled between 0.1 Hz and 2.0 Hz, and the maximum disturbance force amplitude is set to 30% of the thruster's ultimate thrust (approximately 8 N).

[0075] 3) High concurrency settings: Utilize the GPU parallel computing architecture to simultaneously instantiate 4096 independent variant simulation scenarios containing the above perturbations.

[0076] S14. Set the global control update step size of the simulation environment to 0.1 s (i.e., model prediction frequency 10 Hz), and establish a mapping from the normalized command interval [-1, 1] to the maximum thrust of the physical thruster (30 N). Input random Gaussian throttle sequences into each variant of the unmanned surface vessel and record its state transition trajectory. Finally, summarize and clean the data to obtain a large-scale virtual unmanned surface vessel motion dataset containing approximately 200 million time point samples.

[0077] Step S2: The virtual dataset is segmented into sequence data for training. The input stream matching dynamics model network is pre-trained and then fine-tuned on the real dataset. Specific execution details include the following:

[0078] S21, at discrete time step Record the global state vector With command control input ,in, This represents the position information of the unmanned surface vessel in the world coordinate system. Indicates the ship's heading. These represent the forward velocity, lateral velocity, and angular velocity in the ship's coordinate system, respectively. To eliminate the interference of the unbounded global absolute position on the generalization, it is transformed into a time-difference state. Set the history window length. (Corresponding to a 10.0s observation), predict the horizon length. (Corresponding to a 2.5 s future prediction), the sample is divided into fixed-length sequences of 126 using a sliding window.

[0079] S22. Construct a deep neural network that takes historical state sequences and instruction control sequences as conditional inputs and outputs a vector field predicting the probability flow of future states. This implementation uses a DiT architecture containing only a decoder as the backbone network. The specific network dimension mapping rules are as follows:

[0080] 1) Pass the historical state sequence in the condition information through the state coding layer Linear projection onto a 128-dimensional high-dimensional latent space;

[0081] 2) Transform historical and future action sequences through a motion encoding layer Mapped to the same dimension;

[0082] 3) Time interpolation variables for stream matching ( Feature embedding is performed using sinusoidal position encoding; the above embeddings are concatenated to form a size of... (Right now ) context feature embedding matrix ;

[0083] 4) Predicted trajectories with noise By input encoding layer The code is for the size of (Right now The trajectory token sequence ;

[0084] To meet the requirements of real-time inference onboard, the cross-attention layer is abandoned in the DiT model block, and instead, adaptive layer normalization combined with the SiLU activation function is used to inject the context information matrix. Finally, through the output projection layer The feature is mapped to the output velocity field vector. .

[0085] S23. Define the target velocity field that evolves from standard Gaussian prior noise to the true data distribution. Set penalty weights. , Construct a hybrid loss function:

[0086] Among them, the flow matching loss term Used to guide the model in learning multimodal probability distribution features, its formula is defined as the expectation of the difference between the predicted velocity field vector and the target velocity field vector. .

[0087] Mean squared error loss term Used to impose strong physical consistency constraints on the network to prevent trajectory divergence.

[0088]

[0089] in, This represents the network's prediction of future trajectories. This corresponds to the actual trajectory data. The AdamW optimizer (initial learning rate) is used. (Batch size is 512) Iterative training for 300 epochs.

[0090] S24. Collect small sample trajectory data of the actual outdoor lake surface under conditions of no wind, continuous wind (3.2 m / s), gusts (5.0 m / s), and the addition of a load-bearing block. Serialize the real data using the same sliding window rule as in step S21, and input it into the pre-trained model for secondary optimization and update. To prevent the model from "catastrophic forgetting" of prior knowledge from large-scale virtual pre-training when fitting small sample data of the real lake surface, implement fine-tuning constraints on training parameters: during the fine-tuning phase, freeze the bottom state encoding layer. and action coding layer The network weights are determined using a decaying learning rate (e.g., set to 0). Only the parameters of the deep DiT model block are updated in a lightweight iteration over 50 epochs; thus, while preserving the global physical kinematics, the real nonlinear hydrodynamic residuals not modeled in the simulation are accurately compensated, and the adaptive flow matching dynamics network is finally solidified.

[0091] Step S3: Incorporate the multimodal predicted trajectory set generated by the flow matching network into a comprehensive cost evaluation system that includes position, symbol velocity, and heading tracking; combine the decoupling mechanism of control and prediction time steps and pre-optimized covariance sampling to continuously output the optimal physical control command. Specifically, this includes the following execution details:

[0092] S31. Adjust the time step of the bottom-level control closed loop. The network prediction time step is set to 0.02s (50 Hz). The timeframe is set to 0.1 s (10 Hz). In each control iteration, the input reference control sequence is... Linear interpolation compensation is performed at 0.02s intervals, thus without increasing the length of the network computation sequence. Under the premise of [previous conditions], the physical prediction horizon is significantly extended (2.5 s). Meanwhile, to overcome the sensitivity to sampling noise caused by step size amplification, this invention introduces a pre-optimized block diagonal covariance matrix. Using only a very small number of samples (far lower than the thousands of samples required by traditional MPPI), generating 100 sets of candidate instruction sequences, significantly reducing computing power overhead.

[0093] S32, Connecting historical states with The candidate instruction sets are batches of input tensors of size [100, 126, 128]. A 10-step numerical integration using the Euler method is performed on the onboard GPU, followed by iterative network accumulation and denoising to generate 100 future temporal difference trajectories at once. These are then inversely transformed into a set of multimodal absolute prediction trajectories in the global coordinate system. .

[0094] S33. To address the underactuated and hydrodynamically coupled drift characteristics of unmanned surface vessels, a comprehensive evaluation cost function incorporating multiple nonlinear physical constraints is constructed. The calculation formula is as follows:

[0095]

[0096] Among them: 1) velocity tracking cost Introducing a sign term for longitudinal velocity to determine the actual direction of motion, distinguishing between forward and reverse / drift states:

[0097] 2) Heading tracking cost : Construct a penalty term based on the cosine function to avoid The calculation error of abrupt changes caused by angular periodic winding:

[0098] In the formula, , , , These are the predicted trajectory's position, longitudinal velocity, lateral velocity, and heading angle, respectively. , , The expected value of the reference trajectory; To control the amplitude of the input command, in this embodiment, the weights are specifically configured as follows: position weights. Speed ​​weight Heading weights Controlling the smoothing penalty weights .

[0099] Based on the inverse variance weighting principle of the model prediction path integral, the optimal control sequence of the final output is calculated through the Softmax exponential transformation. , .

[0100] In the formula, For system temperature parameters (settings) This is used to control the system's sensitivity to high-cost trajectories. Finally, the updated optimal sequence is extracted. The first action in (Including thruster speed and rudder angle / dual-engine throttle difference), the optimal physical execution command for the current 0.02 s control cycle is issued to the underlying actuator, and the remaining action sequence is used as the reference sequence for the next cycle. The initial value is used to achieve rolling time-domain optimization.

[0101] 5.2 Experimental Results

[0102] The robustness, tracking accuracy, and generalization ability of the adaptive model prediction trajectory tracking method based on flow matching proposed in this invention for closed-loop control under complex disturbances in real waters were verified.

[0103] Experimental environment and conditions:

[0104] Hardware platform: The NanoApril catamaran unmanned surface vessel was used as the real physical test platform.

[0105] Operating conditions: It covers a variety of real-world environmental disturbance conditions, including: different wind and wave levels (no wind, light wind of about 1.5 m / s, strong wind of about 3.2 m / s), different speeds (low-speed conditions are dominated by environmental disturbances, and high-speed conditions are dominated by strong nonlinear hydrodynamic effects), and physical structure mismatch conditions (additional loads).

[0106] Comparison with baseline algorithms: 1) Traditional nonlinear model predictive control (NMPC); 2) Traditional deterministic deep learning baseline model (Transformer) with similar sequence-to-sequence (Seq2Seq) network structure and model size.

[0107] 3) Traditional data-driven model predictive control methods, namely residual network-based model predictive control (RM-MPC) and Gaussian process-based model predictive control (GP-MPC).

[0108] Experimental results and mechanism analysis:

[0109] Table 1. Quantitative Comparison of Tracking Indicators and Calculation Latency

[0110]

[0111] 1. Significantly Improved Tracking Accuracy and Real-Time Verification: Experimental data from actual ship trajectory tracking show that, under various disturbance conditions covering calm to strong winds, the method of this invention (Ours) significantly improves tracking accuracy compared to the traditional nonlinear model predictive control (NMPC) method, with a relatively lower tracking error (…). The absolute position error was significantly reduced by 57%, while maintaining an extremely low absolute position error throughout. ) and absolute velocity error ( Furthermore, although the introduction of the stream matching generative architecture brings some additional computational overhead, thanks to the control and prediction timing decoupling mechanism proposed in this invention, the overall control latency of the system remains strictly within the real-time requirements of the onboard computing power.

[0112] 2. Robustness and Out-of-Distribution Generalization under Extreme Conditions: USVs face two major extreme physical challenges in real waters: at low speeds, they are easily dominated by environmental disturbances such as wind and waves, while at high speeds, they induce strong nonlinear hydrodynamic coupling effects. Experimental results show that, facing these drastically different operating conditions and mismatched conditions with additional loads, the method of this invention achieves the lowest error variation in all test scenarios. It exhibits extremely strong closed-loop control robustness and distributed out-generalization ability.

[0113] 3. Demonstrating the Core Advantages of Deterministic Models (Verifying the Multimodal Representation Mechanism) This embodiment deeply compares the performance gap between the method of this invention and the deterministic baseline model (Transformer). Its experiments demonstrate the effectiveness of the core mechanism of this invention: As a sampling-based control method, MPPI relies on trajectory unfolding to evaluate candidate control sequences. When airborne computing power limits the number of samples, the controller is extremely sensitive to model prediction bias. Traditional deterministic deep learning models (such as Transformer) can only approximate the desired state transitions, outputting a single "point estimate," completely failing to represent the uncertainties in system dynamics. This deficiency leads to biased trajectory evaluations when facing complex environmental conditions, resulting in a sharp degradation of closed-loop performance. In contrast, the method of this invention learns the probability distribution of underlying state transitions through continuous flow matching, accurately capturing the system dynamic variability caused by complex environmental disturbances. This multimodal representation capability based on probability flow enables the model to generate a predicted trajectory envelope that truly reflects environmental uncertainties, thus providing MPPI with a highly reliable risk-aware cost assessment. Therefore, even with similar network structures and parameter scales, this invention can still issue more robust physical control commands, completely widening the performance gap with traditional deterministic models.

[0114] 4. Stability Analysis of Dynamic Execution Behavior In the real-time state acquisition of dynamic tracking behavior, due to the kinematic constraints and thruster limits of the catamaran unmanned surface vessel, all test methods exhibit a brief speed drop during sharp turns. However, observation of the absolute tracking error and real-time state curves shows that the method of this invention generates the smoothest actual tracking trajectory. Simultaneously, the recorded real-time speed state and the underlying throttle command curve exhibit reasonable high-frequency fluctuation characteristics. This objectively reflects that the control framework of this invention is performing active, high-frequency adaptive control adjustments to accurately suppress and resist continuous external physical disturbances, effectively ensuring the safe and stable operation of the underlying actuators under harsh sea conditions.

[0115] While the invention has been described herein with reference to specific embodiments, it should be understood that these embodiments are merely examples of the principles and applications of the invention. Therefore, it should be understood that many modifications can be made to the exemplary embodiments, and other arrangements can be designed without departing from the spirit and scope of the invention as defined by the appended claims. It should be understood that different dependent claims and features described herein can be combined in ways different from those described in the original claims. It is also understood that features described in conjunction with individual embodiments can be used in other described embodiments.

Claims

1. A method for unmanned surface vessel trajectory tracking based on a flow matching learning dynamics model, characterized in that, Includes the following steps: Step S1: Generate a massive virtual trajectory dataset on the physical simulation platform; Step S2: Construct the flow matching dynamics network; The virtual trajectory dataset is segmented into time series samples and input into the flow matching dynamics network. The flow matching dynamics network is trained with the objective function of minimizing the difference between the predicted velocity field vector and the target velocity field vector as the continuous probability flow objective function. After fine-tuning with real water data, the trained flow matching dynamics network is obtained. Step S3: Collect observation data from the unmanned vessel in real time, input it into the trained flow matching dynamics network for parallel inference, and generate a multimodal predicted trajectory set covering various environmental uncertainties in the future; incorporate the multimodal predicted trajectory set into the comprehensive cost evaluation system for cost integral evaluation, and output the optimal physical control command in a rolling manner.

2. The unmanned vessel trajectory tracking method based on a flow matching learning dynamics model according to claim 1, characterized in that, Step S1 includes the following steps: Step S11: Import a model file that matches the actual ship hull size into the open-source computational fluid dynamics tool OpenFOAM; Step S12: Design simulation scenarios for different flight states in OpenFOAM, calculate and extract the hydrodynamic parameters of the unmanned vessel based on the designed simulation scenarios, and load the hydrodynamic parameters of the unmanned vessel into the IsaacSim simulator; the hydrodynamic parameters of the unmanned vessel include the added mass matrix and the water damping coefficient matrix; Step S13: Construct a three-dimensional virtual water surface environment based on the IsaacSim physics simulation engine and introduce a perturbation configuration; the perturbation configuration includes parameter domain randomization and environmental noise interference; Step S14: Drive the unmanned vessel to navigate, record the state transition process of the unmanned vessel in a high-concurrency manner, and generate a massive virtual trajectory dataset.

3. The unmanned vessel trajectory tracking method based on a flow matching learning dynamics model according to claim 1, characterized in that, Step S2 includes the following steps: Step S21: In the discrete time step Record the global state vector of the unmanned surface vessel. With command control input Calculate the state changes between adjacent time steps. The absolute state is converted into time-difference state data based on the ship's coordinate system, and the preset historical window length is set to... The predicted horizon length is The massive virtual trajectory dataset is divided into segments of length using a sliding window. Fixed-length time series samples; Step S22: Construct a flow matching dynamics network; the flow matching dynamics network uses a DiT architecture containing only decoders as the backbone network, and outputs the continuous probability flow velocity field vector corresponding to the future state by inputting the historical state sequence and the historical command control sequence into the flow matching dynamics network. Step S23: Input the time series samples obtained in step S21 into the flow matching dynamics network, and complete the basic pre-training of the network by optimizing the objective function of the continuous probability flow; Step S24: Collect small sample trajectory data of the actual outdoor lake surface under conditions of no wind, continuous wind, gusts, and the addition of a load block. After serializing the actual data using the same sliding window rule as in step S21, input it into the pre-trained flow matching dynamics network for fine-tuning to obtain the trained flow matching dynamics network.

4. The unmanned vessel trajectory tracking method based on a flow matching learning dynamics model according to claim 3, characterized in that, The objective function is a hybrid loss function. : ; ; ; The flow matching loss term guides the model in learning multimodal probability distribution features; its formula is defined as the predicted velocity field vector. With the target velocity field vector Expected difference: setting penalty weights , ; The mean squared error loss term is used to impose a strong physical consistency constraint on the network to prevent trajectory divergence. This represents the network's prediction of future trajectories. That is the corresponding actual trajectory data.

5. The unmanned vessel trajectory tracking method based on a flow matching learning dynamics model according to claim 4, characterized in that, The network dimension mapping rules of the flow matching dynamics network are as follows: The historical state sequence is linearly projected onto a pre-defined high-dimensional latent space through a state coding layer; Historical instruction control sequences and future instruction control sequences are mapped to the same dimension as the state encoding layer through the action encoding layer; The temporal interpolation variables of stream matching are embedded as features using sinusoidal position encoding. Then, the above feature embeddings are concatenated and combined to generate a context feature embedding sequence. The noisy predicted trajectory sequence is processed through an input coding layer with the same dimension as the state coding layer to extract features and generate a corresponding trajectory token sequence. The context feature embedding sequence and the trajectory token sequence are respectively superimposed with a learnable positional encoding and then input into the DiT model block. Finally, the features are mapped to the output velocity field vector through the output projection layer. .

6. The unmanned vessel trajectory tracking method based on a flow matching learning dynamics model according to claim 5, characterized in that: During the fine-tuning phase, the network weights of the underlying state encoding layer and action encoding layer are frozen, and the parameters of the deep DiT model blocks are iteratively updated only using a decaying learning rate, thus completing the final solidification of the flow matching dynamics network.

7. The unmanned vessel trajectory tracking method based on a flow matching learning dynamics model according to claim 5, characterized in that: In the DiT model block, an adaptive layer normalization combined with an activation function is used to inject context feature embedding sequences and complete feature interaction.

8. The unmanned vessel trajectory tracking method based on a flow matching learning dynamics model according to claim 7, characterized in that, Step S3 includes the following steps: Step S31: Control timing decoupling and high-dimensional trajectory sampling: Decouple the discrete control closed-loop time step of the unmanned vessel from the predicted time step of the flow matching dynamics network, and generate multiple sets of candidate command control sequences containing distributed noise in the action space based on the pre-optimized sampling covariance matrix. Step S32: Multimodal future trajectory high concurrency generation: Combine the current historical state of the unmanned vessel with the multiple sets of candidate instruction control sequences, and use the flow matching dynamics network for parallel reasoning to generate a multimodal predicted trajectory set covering multiple environmental uncertainties in the future; Step S33: Risk perception cost assessment and optimal command optimization: Based on the reference trajectory and physical obstacle avoidance constraints, the cost integral assessment of the multimodal predicted trajectory set is performed, the baseline control sequence is updated by exponential weighting, and the optimal physical execution command at the current moment is extracted and sent to the unmanned vessel.

9. The unmanned vessel trajectory tracking method based on a flow matching learning dynamics model according to claim 8, characterized in that, Step S33 includes the following steps: Step S3301: Calculation of comprehensive evaluation cost based on the motion characteristics of unmanned vessel: For each candidate predicted trajectory in the multimodal predicted trajectory set generated in step S32, the corresponding comprehensive evaluation cost of trajectory tracking is calculated based on the expected position, expected velocity, and expected heading derived from the expected velocity direction provided by the reference planner. The specific calculation steps for the comprehensive assessment cost include: Calculate the squared distance deviation between the predicted position and the desired position to obtain the position tracking cost; Extract the predicted longitudinal and lateral velocities of the unmanned surface vessel. By introducing a sign term for the longitudinal velocity, determine the orientation of the actual motion. Calculate the magnitude of the resultant velocity with direction and obtain the squared deviation between the resultant velocity magnitude and the desired velocity to obtain the speed tracking cost. Based on the cosine value of the difference between the predicted heading angle and the desired heading angle, a nonlinear penalty term, i.e., 1 minus the cosine value, is constructed to calculate the heading tracking cost in order to avoid abrupt deviations caused by periodic angular winding. Calculate the square of the amplitude of the corresponding candidate instruction control sequence to obtain the control quantity penalty cost used to ensure the smooth operation of the actuator; The position tracking cost, velocity tracking cost, heading tracking cost, and control penalty cost are each assigned an independent weight coefficient, and the weighted costs are linearly summed to obtain the comprehensive evaluation cost of a single trajectory. Step S3302: Optimal sequence weighted output based on Softmax exponential transformation: Substitute the calculated comprehensive evaluation cost of each candidate predicted trajectory into the model prediction path integral control framework; use the pre-set system temperature parameter to perform negative exponential operation and normalization on each comprehensive evaluation cost to obtain the weight distribution probability of the candidate instruction control sequence corresponding to each predicted trajectory, wherein the system temperature parameter is used to control the system's sensitivity to cost differences. Step S3303: Optimal command extraction and rolling issuance: Using the obtained weighted distribution probability, the candidate command control sequences sampled are weighted and summed to calculate the expected optimal control sequence; the first time step action in the expected optimal control sequence is extracted as a physical execution command and issued to the unmanned vessel's underlying control system, and the remaining sequence is used as the benchmark mean of the Gaussian sampling distribution for the next control cycle to achieve rolling time-domain optimization.

10. The unmanned vessel trajectory tracking method based on a flow matching learning dynamics model according to claim 8, characterized in that, Step S31 includes the following steps: Step S3101: Prediction Time Step Amplification and Interpolation Compensation: Set the prediction time step for the flow matching dynamics network. The control execution discrete time step is greater than that of the unmanned surface vessel; in each control iteration, the input reference command control sequence is linearly interpolated according to the control execution discrete time step to compensate for factors. Amplify the missing intermediate time data to reduce airborne inference latency while maintaining high-frequency control closed loop; Step S3102: Injecting pre-optimized covariance to overcome sampling noise: To address the decrease in dynamic fidelity caused by the amplification of the prediction step size, a pre-optimized task-specific sampling covariance matrix is ​​introduced to replace the standard Gaussian variance; distributed noise is injected into the interpolated baseline command control sequence through the task-specific sampling covariance matrix to generate... A parallel sequence of candidate instruction control sequences is used to ensure that even with a small sample size... Robust exploration and high-quality sampling can still be achieved under the constraints.