A method and system for synchronous collection and end-side compression storage of shipboard AIS and IMU data based on GNSS timing

By establishing an absolute time reference and interpolation alignment algorithm through GNSS time synchronization, the problems of inconsistent time references and storage redundancy in shipborne multi-source data acquisition were solved, achieving efficient data synchronization and storage, and improving the time consistency and stability of the data.

CN122293247APending Publication Date: 2026-06-26DALIAN MARITIME UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-20
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing low-cost shipborne data acquisition solutions suffer from problems such as inconsistent time references for multi-source data, time-domain mismatch of heterogeneous sampling frequencies, high redundancy in text storage, and poor stability during long-term recording, resulting in data that cannot be accurately matched and stored efficiently.

Method used

An absolute time reference is established using a GNSS-based time synchronization method. Interpolation alignment algorithms are used to achieve time-domain synchronization of heterogeneous data. A binary serialization protocol is used for end-side compression storage to ensure data time consistency and efficient use of storage space.

Benefits of technology

It achieves precise matching of multi-source data in the same time coordinate system, reduces storage space usage, improves the temporal resolution and continuous recording capability of the data, and enhances the stability and reliability of the data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122293247A_ABST
    Figure CN122293247A_ABST
Patent Text Reader

Abstract

This invention provides a method and system for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing, belonging to the field of ship intelligent sensing and data acquisition. The method includes: establishing an absolute time reference based on GNSS timing; initiating AIS and IMU data reception tasks based on the absolute time reference and attaching a unified timestamp; constructing a globally unified sampling and reconstruction task, achieving temporal synchronization of AIS and IMU data through linear interpolation and spherical linear interpolation algorithms; performing end-side compressed storage using a binary serialization protocol; and real-time monitoring of data integrity and execution of anomaly protection. This invention solves the technical problems of inconsistent time references for multi-source data, temporal mismatch of heterogeneous sampling frequencies, high text storage redundancy, and poor stability during long-term recording in existing shipborne data acquisition schemes. It achieves high-precision synchronous acquisition and high-efficiency persistent storage of shipborne multi-source heterogeneous data, and is applicable to fields such as intelligent ship algorithm verification and ship motion attitude analysis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of ship intelligent sensing and data acquisition technology, and more particularly to a method and system for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing. Background Technology

[0002] The attitude perception, trajectory prediction, and marine environment inversion functions of intelligent ships are crucial foundations for achieving autonomous navigation. The realization of these functions relies on continuous observation of the ship's motion state, particularly on acquiring high-precision, time-consistent ship motion data. In a ship's perception system, key data sources characterizing the ship's dynamic features typically include the Automatic Identification System (AIS) and the Inertial Measurement Unit (IMU).

[0003] AIS (Airborne Information System) is used to broadcast and exchange information such as ship position, speed, heading, and identity, and is an important means of obtaining macroscopic ship trajectory characteristics. However, the reporting frequency of AIS is affected by speed, turning, and communication mechanisms, and is characterized by low frequency and non-uniform intervals. Under typical circumstances, the update cycle varies between 2 seconds and 3 minutes, making it difficult to effectively characterize the instantaneous attitude changes during ship maneuvers. In contrast, IMU (Integrated Measurement Unit) can collect information such as three-axis acceleration and angular velocity at higher frequencies (usually 50Hz and above), and can be used to capture the short-term microscopic motion characteristics of ships during wind, waves, currents, or maneuvers. Research and verification of algorithms for maritime target intent perception, multi-source information fusion, and autonomous navigation usually require synchronized data from AIS and IMU as input. Therefore, the synchronous acquisition and quality assurance of multi-source heterogeneous data are important aspects of related algorithm testing and verification.

[0004] However, existing low-cost shipborne data acquisition solutions mainly suffer from the following technical problems:

[0005] First, there is the issue of inconsistent time references. Ordinary offline acquisition devices typically rely on internal crystal oscillators for timing, lacking an absolute time reference. AIS data and IMU data often come from different devices / interfaces, resulting in inconsistent timestamp sources and making it impossible to accurately correspond multi-source data. During long-term recording, the device time will drift, causing the acquired data to not accurately correspond to external real-world time (UTC) or data from other observation devices (such as radar and video surveillance) on the timeline.

[0006] Second, there is the issue of time-domain mismatch in heterogeneous sampling frequencies. Inertial Measurement Unit (IMU) data is typically high-frequency data (e.g., 50Hz-200Hz), while AIS data is low-frequency and not fixed-frequency data. Since the two are triggered independently by different sensors, direct fusion will result in misalignment and missing sampling, causing data at the same moment to be misaligned in physical time, which will bring interpolation errors and processing difficulties to the subsequent data fusion.

[0007] Third, there are issues with storage redundancy and real-time performance. The original IMU and AIS text storage have high redundancy, occupy a large amount of space, and offline parsing takes a long time. If a common ASCII text format (such as CSV / TXT) is used for storage, it will not only occupy a large amount of SD card storage space, but also consume the CPU resources of the embedded main control chip due to frequent string formatting operations, resulting in frame loss or buffer overflow during high-frequency writing.

[0008] In summary, shipborne multi-source data acquisition systems need to establish a unified time reference before acquisition and maintain time consistency throughout the acquisition process. They also need to address the characteristics of AIS (low-frequency non-uniform intervals) and IMU (high-frequency uniform intervals) by achieving online timestamp alignment and fixed-frequency output. Furthermore, they need to provide an efficient storage mechanism suitable for embedded systems, reducing write overhead and storage usage through structured coding to ensure stable recording over long periods. Summary of the Invention

[0009] To address the technical problems existing in the prior art, such as inconsistent time references for multi-source data, time-domain mismatch of heterogeneous sampling frequencies, high text storage redundancy, and poor stability during long-term recording, this invention provides a method and system for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing. This invention primarily utilizes GNSS timing to establish an absolute time reference, employs an interpolation alignment algorithm to achieve time-domain synchronization of heterogeneous data, and applies a binary serialization protocol for end-side compressed storage. This achieves the technical effects of improving the time consistency of multi-source data, realizing time synchronization and structural uniformity of heterogeneous sampling sources, reducing end-side storage space occupation, and enhancing the ability to record continuously for extended periods.

[0010] The technical means employed in this invention are as follows: A method for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing includes: S1. After the device starts up, the main control unit performs hardware self-test and establishes physical layer connection with GNSS module, AIS receiver and IMU inertial sensor. It obtains UTC time through GNSS module as the absolute time reference of the system, and enables local high-stability timing source to maintain continuous time axis when GNSS module is unavailable. S2. Based on the absolute time reference, start the data reception tasks of the AIS receiver and the IMU inertial sensor respectively, configure the data interface and establish a reception queue and a circular buffer, and add a unified timestamp from the absolute time reference to each frame of AIS raw message and IMU raw sample. S3. Construct a globally unified sampling and reconstruction task. With a preset fixed frequency as the beat, perform linear interpolation to calculate dynamic feature values ​​for the AIS buffer data in each sampling period, and process the IMU attitude data using a spherical linear interpolation algorithm to achieve temporal synchronization between AIS and IMU data. S4. The aligned AIS dynamic features and IMU inertial features are encapsulated into a unified data structure, and the data structure is converted into a compact binary byte stream using a binary serialization protocol and appended to a local file. S5. Monitors the data integrity of each sensor in real time, performs end-side data anomaly handling when signal loss or interface disconnection occurs, and forces a refresh of the file buffer when recording ends or power alarm is triggered to ensure the integrity of stored data.

[0011] Further, step S1 includes: S11. The main control unit internally constructs an asynchronous communication task, configuring independent data stream listeners for the UART interface and SPI interface respectively. The UART interface is used to connect the GNSS module and the AIS receiver, and the SPI interface is used to connect the IMU inertial sensor. S12. Before recording begins, the device determines whether an available absolute time reference source is available. When the GNSS module is available, the UTC time / timing signal output by the GNSS module is used as the system time reference. When the GNSS module is unavailable or briefly loses its lock, a local high-stability timing source is enabled to maintain a continuous time axis and the mapping relationship with absolute time is recorded. S13. Obtain the UTC time information output by the GNSS module, calibrate the system clock deviation according to the UTC time information, generate and record the time synchronization quality index, and use the calibrated system clock as a unified reference time to drive subsequent acquisition and marking.

[0012] Further, step S2 includes: S21. Configure the working parameters of the AIS receiving interface. The AIS receiving interface uses UART serial communication, and configure the baud rate, data bits, stop bits and parity method. S22. Configure the operating parameters of the IMU receiving interface. The IMU receiving interface uses SPI bus communication and configures the clock frequency and transmission mode. S23. Establish independent data receiving queues and circular buffers for the AIS receiving interface and the IMU receiving interface respectively. The data receiving queue is used to buffer the raw data to be processed, and the circular buffer is used to buffer the high-frequency sampled data stream. S24. Start the AIS data receiving task, continuously monitor the AIS receiving interface and store the received raw AIS packets into the corresponding AIS data receiving queue. S25. Start the IMU data receiving task, read the IMU receiving interface at a fixed frequency and store the sampled IMU raw samples into the corresponding IMU data receiving queue. S26. When the AIS raw message or IMU raw sample enters the data receiving queue, obtain the current timestamp corresponding to the absolute time reference, and encapsulate the current timestamp and the AIS raw message or IMU raw sample into a raw data packet with a time sequence mark.

[0013] Further, step S3 includes: S31. Create a fixed-frequency sampling and reconstruction task, set the output frequency parameters, and trigger the data alignment operation with the output frequency parameters as the periodic beat; S32. When each cycle beat is triggered, retrieve the two AIS original messages adjacent to the timestamp of the current target time from the AIS data receiving queue, calculate the dynamic characteristic values ​​of the ship's position and speed corresponding to the current target time using a linear interpolation algorithm, and generate the reconstructed AIS sampling data. S33. Retrieve the two frames of original IMU samples adjacent to the timestamp of the current target time from the IMU data receiving queue, and use the spherical linear interpolation algorithm to interpolate the attitude data to generate reconstructed IMU sampling data. S34. Align the reconstructed AIS sampling data and the IMU sampling data according to the timestamp, and encapsulate them into a unified data structure containing the ship's geographical location information and motion information at the same time.

[0014] Further, step S4 includes: S41. Define the binary data encoding format, set the binary byte length and arrangement order of each data field, wherein the data fields include timestamp, ship position, speed, attitude angle, angular velocity and verification information; S42. Convert the data structure into a binary byte stream according to the binary data encoding format, omitting string formatting operations and delimiter encoding; S43. Write the binary byte stream to a pre-created local storage file, update the file content using an append-only writing method, check the storage medium status after writing is complete, and create a new storage file when the file rolling condition is met.

[0015] Further, step S5 includes: S51. Monitor the signal quality of the GNSS module, the connection status of the AIS receiver, the data verification results of the IMU inertial sensor, and the buffer occupancy rate in real time; S52. When a sensor malfunction is detected, the malfunction code is recorded to the log file, and a reset operation is performed on the malfunctioning interface; when the AIS receiver interface is detected to be disconnected, a UART soft reset is triggered; when IMU data verification fails, the frame data is discarded and a data gap is marked. S53. When a recording end command or a power alarm signal is received, the file system cache is forcibly refreshed to ensure that the written binary byte stream is completely written to the local storage file.

[0016] Furthermore, in step S12, the local high-stability timing source includes a monotonic clock or a local clock count. The system calculates the temperature drift coefficient to achieve dynamic drift compensation of the time axis by recording the linear mapping relationship between the monotonic clock count value and the last valid UTC time.

[0017] Furthermore, in step S13, the timing quality index includes a validity flag, an update frequency, and a timing error estimate. The timing quality index is stored along with the data frame and is used to backtrack the time accuracy during later analysis.

[0018] Furthermore, step S1 also includes: S14. After the time synchronization is completed, the main control unit synchronizes the local system clock through the PPS interrupt to eliminate accumulated errors.

[0019] This invention also provides a system for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing, implemented using a method for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing, comprising: The time reference establishment module performs hardware self-test and establishes physical layer connections with the GNSS module, AIS receiver and IMU inertial sensor. It obtains UTC time through the GNSS module as the system's absolute time reference and enables a local high-stability timing source to maintain a continuous time axis when the GNSS module is unavailable. The data receiving module, based on the absolute time reference, starts the data receiving tasks of AIS and IMU respectively, configures the data interface and establishes a receiving queue and a circular buffer, and adds a unified timestamp from the absolute time reference to each frame of AIS raw message and IMU raw sample. The data alignment module constructs a globally unified sampling and reconstruction task. It calculates dynamic feature values ​​by linear interpolation of the AIS buffer data in each sampling period with a preset fixed frequency as the beat, and processes the IMU attitude data using a spherical linear interpolation algorithm to achieve temporal synchronization between AIS and IMU data. The compressed storage module encapsulates the aligned AIS dynamic features and IMU inertial features into a unified data structure, and uses a binary serialization protocol to convert the data structure into a compact binary byte stream and append it to a local file; The anomaly protection module monitors the data integrity of each sensor in real time, performs end-side data anomaly handling when signal loss or interface disconnection occurs, and forcibly refreshes the file buffer when recording ends or power alarm is triggered to ensure the integrity of stored data.

[0020] Compared with the prior art, the present invention has the following advantages: 1. Before recording, this invention establishes an absolute time reference through GNSS timing and injects this time reference into the system clock. Even when the GNSS loses lock for a short time, the time axis can still be continuously output, thereby avoiding the cumulative drift problem caused by relying solely on local crystal oscillator timing. This enables AIS data and IMU data to be accurately matched in the same time coordinate system, improving the consistency of multi-source data in the time dimension.

[0021] 2. This invention constructs a unified standard time axis and introduces interpolation and resampling mechanisms to map non-fixed-frequency and low-frequency AIS data and high-frequency and fixed-frequency IMU data to the same output frequency, thereby achieving time synchronization and structural unification of heterogeneous sampling sources. This avoids the problems of complex and poor real-time performance in traditional offline post-processing and solves the time-domain mismatch problem between low-frequency non-fixed-frequency AIS and high-frequency fixed-frequency IMU.

[0022] 3. This invention fuses the aligned AIS position, speed, and heading information with the IMU attitude and angular velocity information. Even with large AIS update intervals, it can use high-frequency IMU information to compensate for and reconstruct the ship's short-term motion state, thereby obtaining a ship motion feature sequence with higher temporal resolution and stronger continuity, and improving the ability to characterize ship maneuvering behavior.

[0023] 4. This invention uses a structured binary serialization method to replace the traditional ASCII text (such as CSV / TXT) storage mode, so that floating-point data is saved in a compact binary form, thereby significantly reducing the amount of data stored per unit time and extending the continuous recording time of the end device under limited storage conditions.

[0024] 5. This invention avoids frequent string formatting and text concatenation operations, and only performs simple binary packaging and writing of data, effectively reducing the computational burden and IO call count of the edge processor, thereby reducing the probability of blocking or frame loss during high-frequency data writing and improving the overall stability of the system.

[0025] 6. By introducing a unified timestamp, quality flag and verification information into the data frame, and combining it with the time base, field definition and version information recorded in the file header, this invention enables each record to be traced back to its collection time, source and validity status, which is beneficial for subsequent data filtering, anomaly removal and quality assessment.

[0026] 7. The method of the present invention does not strictly limit the data interface form and sampling frequency of AIS and IMU, but only relies on timestamps and a unified time axis for alignment processing. Therefore, it can be adapted to different models of AIS receivers, inertial measurement units and storage media, and has good versatility and engineering feasibility.

[0027] 8. This invention can generate datasets with a unified time base, fixed output frequency and high-resolution motion features, providing high-quality experimental data support for algorithms such as ship collision avoidance, target intent recognition and autonomous navigation control, thereby improving the accuracy and objectivity of algorithm testing and performance evaluation.

[0028] In summary, the technical solution of this invention can solve the technical problems existing in current low-cost shipborne data acquisition schemes, such as inconsistent time references for multi-source data, time-domain mismatch of heterogeneous sampling frequencies, high redundancy in text storage, and poor stability during long-term recording. Therefore, the technical solution of this invention solves the problem of difficulty in achieving high-precision synchronous acquisition and high-efficiency persistent storage of shipborne multi-source heterogeneous data in the prior art.

[0029] Based on the above reasons, this invention can be widely applied in fields such as intelligent ships, unmanned ship algorithm verification, ship motion attitude analysis, and marine environment inversion research. Attached Figure Description

[0030] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0031] Figure 1 This is a flowchart of the method of the present invention.

[0032] Figure 2 This is a schematic diagram of a hardware architecture embodiment of the system of the present invention.

[0033] In the diagram: 1. Single-board computer (Raspberry Pi 4B); 2. IMU inertial sensor; 3. Miniature AIS receiver; 4. Extension cable; 5. AIS PILOT PLUG; 6. PLA housing base; 7. PLA housing top cover; 8. Cooling fan. Detailed Implementation

[0034] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. 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 should fall within the scope of protection of the present invention.

[0035] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0036] This invention provides a method for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing, including: S1. After the device starts up, the main control unit performs hardware self-test and establishes physical layer connection with GNSS module, AIS receiver and IMU inertial sensor. It obtains UTC time through GNSS module as the absolute time reference of the system, and enables local high-stability timing source to maintain continuous time axis when GNSS module is unavailable. S2. Based on the absolute time reference, start the data reception tasks of the AIS receiver and the IMU inertial sensor respectively, configure the data interface and establish a reception queue and a circular buffer, and add a unified timestamp from the absolute time reference to each frame of AIS raw message and IMU raw sample. S3. Construct a globally unified sampling and reconstruction task. With a preset fixed frequency as the beat, perform linear interpolation to calculate dynamic feature values ​​for the AIS buffer data in each sampling period, and process the IMU attitude data using a spherical linear interpolation algorithm to achieve temporal synchronization between AIS and IMU data. S4. The aligned AIS dynamic features and IMU inertial features are encapsulated into a unified data structure, and the data structure is converted into a compact binary byte stream using a binary serialization protocol and appended to a local file. S5. Monitors the data integrity of each sensor in real time, performs end-side data anomaly handling when signal loss or interface disconnection occurs, and forces a refresh of the file buffer when recording ends or power alarm is triggered to ensure the integrity of stored data.

[0037] In this embodiment, as Figure 1 As shown, after the device is powered on, it first executes the "GNSS Time Reference Synchronization" program. This program uses a fixed frequency to cyclically check whether time synchronization is successful. Each cycle first reads the satellite signal and calibrates the system clock, then checks the synchronization status. If normal, the cycle continues; if abnormal, it enters the "Abnormal Repair" sub-process. After successful time synchronization, the "Data Interface" module is started, entering the continuous recording stage. This stage processes five sub-modules in parallel: raw data parsing, end-side abnormal handling, AIS / IMU alignment, data compression, and local storage. Within each sub-module, each cycle first executes the corresponding function code, then self-checks for abnormalities—if normal, it continues; if abnormal, it reports to the "Status Monitoring" program. The status monitoring program summarizes all abnormalities. If recovery is needed, the corresponding sub-module is restarted; if global recovery is not possible, "Recording Ended" is marked, and finally, the device is shut down and the entire process ends.

[0038] In a specific implementation, as a preferred embodiment of the present invention, step S1 includes: S11. The main control unit (using an ARM Cortex-A53 processor) internally constructs an asynchronous communication task, configuring independent data stream listeners for the UART interface and SPI interface respectively. The UART interface is used to connect the GNSS module (u-bloxF9P) and the AIS receiver (AIS Pilot), and the SPI interface is used to connect the IMU inertial sensor (ADIS16507). In this embodiment, the system configures the UART interface with a baud rate of 38,400bps and an 8N1 frame format, and the SPI interface with a clock frequency of 10MHz, and creates independent data stream listeners for each. Asynchronous data reception is achieved using DMA, reducing CPU utilization.

[0039] S12. Before recording begins, the device determines whether an available absolute time reference source is available. When the GNSS module output is detected to be valid (the number of satellite locks is greater than 4 and an RMC message is available), the UTC time / timing signal output by the GNSS module is used as the system time reference. When the GNSS module is in the startup blind zone or loses lock for a short time, a local high-stability timing source (such as a monotonic clock / local clock count) is enabled to maintain a continuous time axis. The system automatically records the linear mapping relationship between the monotonic clock count value and the last valid UTC time, and realizes dynamic drift compensation of the time axis by calculating the temperature drift coefficient.

[0040] S13. Obtain the UTC time information output by the GNSS module, calibrate the system clock deviation based on the UTC time information, generate and record time synchronization quality metrics, and use the calibrated system clock as a unified reference time to drive subsequent data acquisition and labeling. In this embodiment, the time synchronization quality metrics include a validity flag, update frequency, and estimated time synchronization error. These metrics are stored along with the data frame for later analysis to check the time accuracy.

[0041] S14. After the GNSS module successfully synchronizes the time, the main control unit synchronizes the local system clock via the PPS interrupt to eliminate accumulated errors. Thereafter, all data acquisition tasks are driven by a unified time base.

[0042] In a specific implementation, as a preferred embodiment of the present invention, step S2 includes: S21. Configure the working parameters of the AIS receiving interface. The AIS receiving interface uses UART serial communication, and configure the baud rate, data bits, stop bits and parity method. S22. Configure the operating parameters of the IMU receiving interface. The IMU receiving interface uses SPI bus communication and configures the clock frequency and transmission mode. S23. Establish independent data receiving queues and circular buffers for the AIS receiving interface and the IMU receiving interface respectively. The data receiving queue is used to buffer the raw data to be processed, and the circular buffer is used to buffer the high-frequency sampled data stream. S24. Start the AIS data receiving task, continuously monitor the AIS receiving interface and store the received raw AIS packets into the corresponding AIS data receiving queue. S25. Start the IMU data receiving task, read the IMU receiving interface at a fixed frequency and store the sampled IMU raw samples into the corresponding IMU data receiving queue. S26. When the AIS raw message or IMU raw sample enters the data receiving queue, the current timestamp corresponding to the absolute time reference is obtained, and the current timestamp and the AIS raw message or IMU raw sample are encapsulated into a raw data packet with a time sequence mark. In this embodiment, a "monotonically increasing time and absolute time mapping" method is preferably adopted to ensure that time continuity is maintained even if a short GNSS interruption occurs during the recording process.

[0043] In this embodiment, the AIS receiving thread continuously listens to the UART port and stores VDM messages in a 512KB circular buffer; the IMU receiving thread reads the SPI bus at a frequency of 1kHz and stores triaxial acceleration, angular velocity, and quaternion data in a 1MB double-buffered queue. A 64-bit timestamp (high 32 bits for UTC seconds and low 32 bits for nanoseconds) is immediately appended to each data frame upon arrival, forming a raw data packet with timing marks.

[0044] In a specific implementation, as a preferred embodiment of the present invention, step S3 includes: S31. Create a fixed-frequency sampling and reconstruction task, set the output frequency parameters, and trigger data alignment operations with the output frequency parameters as the periodic beat. In this embodiment, in order to solve the problem of non-fixed frequency (non-fixed frequency) AIS data, the system constructs a globally unified sampling and reconstruction task. This task uses a preset fixed frequency (e.g., 10Hz or 20Hz) as the beat and periodically retrieves the original AIS and IMU data of adjacent time points from the buffer.

[0045] S32. When each cycle beat is triggered, retrieve the two AIS original messages adjacent to the timestamp of the current target time from the AIS data receiving queue, calculate the dynamic characteristic values ​​of the ship's position and speed corresponding to the current target time using a linear interpolation algorithm, and generate the reconstructed AIS sampling data. S33. Retrieve the two frames of original IMU samples adjacent to the current target time timestamp from the IMU data receiving queue, and use the spherical linear interpolation algorithm to interpolate the attitude data to generate reconstructed IMU sample data. Compared with ordinary linear interpolation, the Slerp algorithm can effectively avoid the singularity problem caused by attitude change, and ensure that the aligned ship pitch, roll and heading data have extremely high smoothness and accuracy. S34. Align the reconstructed AIS sampling data with the IMU sampling data according to the timestamp, encapsulate them into a unified data structure, which includes the ship's geographical location information (latitude and longitude) and motion maneuver information (angular velocity, acceleration, attitude angle) at the same time, forming a standardized set of ship full-state motion vectors.

[0046] In this embodiment, the system creates a sampling and reconstruction task at a fixed frequency of 10Hz. Within each 100ms period, the following operations are performed: the two most recent messages before and after the target time are retrieved from the AIS buffer, and the longitude, latitude, and speed are calculated using linear interpolation; spherical linear interpolation (Slerp) is applied to the IMU quaternion data to avoid Euler angle singularities, and the ship's pitch, roll, and heading angles are extracted after interpolation to ensure a smooth attitude transition.

[0047] In a specific implementation, as a preferred embodiment of the present invention, step S4 includes: S41. Define the binary data encoding format, set the binary byte length and arrangement order of each data field, wherein the data fields include timestamp, ship position, speed, attitude angle, angular velocity and verification information; S42. In order to reduce storage overhead, the system abandons the traditional ASCII text storage and adopts a binary serialization protocol. The aligned data structure is converted into a binary byte stream according to the binary data encoding format, omitting string formatting operations and delimiter encoding; In this embodiment, the aligned AIS and IMU data are encapsulated into a unified binary structure ShipStateVector, which includes: timestamp (8 bytes), latitude and longitude (double type), three-dimensional velocity (float type), quaternion (float[4]), angular velocity (float[3]) and checksum (4 bytes). The total length of a single structure is fixed at 64 bytes, which facilitates random access and parsing.

[0048] S43. Write the binary byte stream to a pre-created local storage file (local txt or bin file), updating the file content using an append-only method. After writing is complete, check the storage medium status, and create a new storage file when the file rolling condition is met. In this embodiment, the structure is directly serialized into a binary byte stream and written to solid-state storage (eMMC5.1). This method reduces storage space while significantly reducing I / O write pressure on the embedded side, preventing recording frame drops due to CPU formatting strings. Compared to traditional CSV text storage, storage space is reduced by approximately 70%, and the write latency is consistently below 2ms, avoiding frame drops caused by formatting strings. The file naming rule is YYYYMMDD_HHMMSS.bin, and a new file is created every hour.

[0049] In a specific implementation, as a preferred embodiment of the present invention, step S5 includes: S51. Monitor the signal quality of the GNSS module, the connection status of the AIS receiver, the data verification results of the IMU inertial sensor, and the buffer occupancy rate in real time; S52. When a sensor malfunction is detected, the malfunction code is recorded to the log file, and a reset operation is performed on the malfunctioning interface; when the AIS receiver interface is detected to be disconnected, a UART soft reset is triggered; when IMU data verification fails, the frame data is discarded and a data gap is marked. S53. When a recording end command or a power alarm signal is received, the main control unit immediately calls fsync() to force refresh the file system cache, ensuring that the written binary byte stream is completely written to the local storage file to prevent the timestamp sequence from being broken.

[0050] This invention also provides a system for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing, implemented using a method for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing, comprising: The time reference establishment module performs hardware self-test and establishes physical layer connections with the GNSS module, AIS receiver and IMU inertial sensor. It obtains UTC time through the GNSS module as the system's absolute time reference and enables a local high-stability timing source to maintain a continuous time axis when the GNSS module is unavailable. The data receiving module, based on the absolute time reference, starts the data receiving tasks of AIS and IMU respectively, configures the data interface and establishes a receiving queue and a circular buffer, and adds a unified timestamp from the absolute time reference to each frame of AIS raw message and IMU raw sample. The data alignment module constructs a globally unified sampling and reconstruction task. It calculates dynamic feature values ​​by linear interpolation of the AIS buffer data in each sampling period with a preset fixed frequency as the beat, and processes the IMU attitude data using a spherical linear interpolation algorithm to achieve temporal synchronization between AIS and IMU data. The compressed storage module encapsulates the aligned AIS dynamic features and IMU inertial features into a unified data structure, and uses a binary serialization protocol to convert the data structure into a compact binary byte stream and append it to a local file; The anomaly protection module monitors the data integrity of each sensor in real time, performs end-side data anomaly handling when signal loss or interface disconnection occurs, and forcibly refreshes the file buffer when recording ends or power alarm is triggered to ensure the integrity of stored data.

[0051] One hardware architecture scheme corresponding to this embodiment is shown in the appendix. Figure 2As shown, the system includes a single-board computer (Raspberry Pi 4B) 1, an IMU inertial sensor 2, a miniature AIS receiver 3, an extension cable 4, an AIS PILOT PLUG 5, a PLA housing base 6, a PLA housing top cover 7, and a cooling fan 8. The single-board computer (Raspberry Pi 4B) 1 and the AIS PILOT PLUG 5 are connected via an SPI bus for touchscreen virtual button interaction. The IMU inertial sensor 2 is connected to the AIS PILOT PLUG 5 via an analog signal line for generating propeller control information. The miniature AIS receiver 3 and the AIS PILOT PLUG 5 are connected via the extension cable 4 to send environmental disturbance variables and ship maneuvering variables to the ROS node program on the Raspberry Pi.

[0052] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing, characterized in that, include: S1. After the device starts up, the main control unit performs hardware self-test and establishes physical layer connection with GNSS module, AIS receiver and IMU inertial sensor. It obtains UTC time through GNSS module as the absolute time reference of the system, and enables local high-stability timing source to maintain continuous time axis when GNSS module is unavailable. S2. Based on the absolute time reference, start the data reception tasks of the AIS receiver and the IMU inertial sensor respectively, configure the data interface and establish a reception queue and a circular buffer, and add a unified timestamp from the absolute time reference to each frame of AIS raw message and IMU raw sample. S3. Construct a globally unified sampling and reconstruction task. With a preset fixed frequency as the beat, perform linear interpolation to calculate dynamic feature values ​​for the AIS buffer data in each sampling period, and process the IMU attitude data using a spherical linear interpolation algorithm to achieve temporal synchronization between AIS and IMU data. S4. The aligned AIS dynamic features and IMU inertial features are encapsulated into a unified data structure, and the data structure is converted into a compact binary byte stream using a binary serialization protocol and appended to a local file. S5. Monitors the data integrity of each sensor in real time, performs end-side data anomaly handling when signal loss or interface disconnection occurs, and forces a refresh of the file buffer when recording ends or power alarm is triggered to ensure the integrity of stored data.

2. The method for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing according to claim 1, characterized in that, Step S1 includes: S11. The main control unit internally constructs an asynchronous communication task, configuring independent data stream listeners for the UART interface and SPI interface respectively. The UART interface is used to connect the GNSS module and the AIS receiver, and the SPI interface is used to connect the IMU inertial sensor. S12. Before recording begins, the device determines whether an available absolute time reference source is available. When the GNSS module is available, the UTC time / timing signal output by the GNSS module is used as the system time reference. When the GNSS module is unavailable or briefly loses its lock, a local high-stability timing source is enabled to maintain a continuous time axis and the mapping relationship with absolute time is recorded. S13. Obtain the UTC time information output by the GNSS module, calibrate the system clock deviation according to the UTC time information, generate and record the time synchronization quality index, and use the calibrated system clock as a unified reference time to drive subsequent acquisition and marking.

3. The method for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing according to claim 1, characterized in that, Step S2 includes: S21. Configure the working parameters of the AIS receiving interface. The AIS receiving interface uses UART serial communication, and configure the baud rate, data bits, stop bits and parity method. S22. Configure the operating parameters of the IMU receiving interface. The IMU receiving interface uses SPI bus communication and configures the clock frequency and transmission mode. S23. Establish independent data receiving queues and circular buffers for the AIS receiving interface and the IMU receiving interface respectively. The data receiving queue is used to buffer the raw data to be processed, and the circular buffer is used to buffer the high-frequency sampled data stream. S24. Start the AIS data receiving task, continuously monitor the AIS receiving interface and store the received raw AIS packets into the corresponding AIS data receiving queue. S25. Start the IMU data receiving task, read the IMU receiving interface at a fixed frequency and store the sampled IMU raw samples into the corresponding IMU data receiving queue. S26. When the AIS raw message or IMU raw sample enters the data receiving queue, obtain the current timestamp corresponding to the absolute time reference, and encapsulate the current timestamp and the AIS raw message or IMU raw sample into a raw data packet with a time sequence mark.

4. The method for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing according to claim 1, characterized in that, Step S3 includes: S31. Create a fixed-frequency sampling and reconstruction task, set the output frequency parameters, and trigger the data alignment operation with the output frequency parameters as the periodic beat; S32. When each cycle beat is triggered, retrieve the two AIS original messages adjacent to the timestamp of the current target time from the AIS data receiving queue, calculate the dynamic characteristic values ​​of the ship's position and speed corresponding to the current target time using a linear interpolation algorithm, and generate the reconstructed AIS sampling data. S33. Retrieve the two frames of original IMU samples adjacent to the timestamp of the current target time from the IMU data receiving queue, and use the spherical linear interpolation algorithm to interpolate the attitude data to generate reconstructed IMU sampling data. S34. Align the reconstructed AIS sampling data and the IMU sampling data according to the timestamp, and encapsulate them into a unified data structure containing the ship's geographical location information and motion information at the same time.

5. The method for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing according to claim 1, characterized in that, Step S4 includes: S41. Define the binary data encoding format, set the binary byte length and arrangement order of each data field, wherein the data fields include timestamp, ship position, speed, attitude angle, angular velocity and verification information; S42. Convert the data structure into a binary byte stream according to the binary data encoding format, omitting string formatting operations and delimiter encoding; S43. Write the binary byte stream to a pre-created local storage file, update the file content using an append-only writing method, check the storage medium status after writing is complete, and create a new storage file when the file rolling condition is met.

6. The method for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing according to claim 1, characterized in that, Step S5 includes: S51. Monitor the signal quality of the GNSS module, the connection status of the AIS receiver, the data verification results of the IMU inertial sensor, and the buffer occupancy rate in real time; S52. When a sensor malfunction is detected, the malfunction code is recorded to the log file, and a reset operation is performed on the malfunctioning interface; when the AIS receiver interface is detected to be disconnected, a UART soft reset is triggered; when IMU data verification fails, the frame data is discarded and a data gap is marked. S53. When a recording end command or a power alarm signal is received, the file system cache is forcibly refreshed to ensure that the written binary byte stream is completely written to the local storage file.

7. The method for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing according to claim 2, characterized in that, In step S12, the local high-stability timing source includes a monotonic clock or a local clock count. The system calculates the temperature drift coefficient to achieve dynamic drift compensation of the time axis by recording the linear mapping relationship between the monotonic clock count value and the last valid UTC time.

8. The method for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing according to claim 2, characterized in that, In step S13, the timing quality index includes a validity flag, update frequency, and timing error estimate. The timing quality index is stored along with the data frame and is used to backtrack the time accuracy during later analysis.

9. A method for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing, as described in claim 2, is characterized in that... Step S1 also includes: S14. After the time synchronization is completed, the main control unit synchronizes the local system clock through the PPS interrupt to eliminate accumulated errors.

10. A system for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on GNSS timing, implemented using the method for synchronous acquisition and end-side compressed storage of shipborne AIS and IMU data based on any one of claims 1-9, characterized in that, include: The time reference establishment module performs hardware self-test and establishes physical layer connections with the GNSS module, AIS receiver and IMU inertial sensor. It obtains UTC time through the GNSS module as the system's absolute time reference and enables a local high-stability timing source to maintain a continuous time axis when the GNSS module is unavailable. The data receiving module, based on the absolute time reference, starts the data receiving tasks of AIS and IMU respectively, configures the data interface and establishes a receiving queue and a circular buffer, and adds a unified timestamp from the absolute time reference to each frame of AIS raw message and IMU raw sample. The data alignment module constructs a globally unified sampling and reconstruction task. It calculates dynamic feature values ​​by linear interpolation of the AIS buffer data in each sampling period with a preset fixed frequency as the beat, and processes the IMU attitude data using a spherical linear interpolation algorithm to achieve temporal synchronization between AIS and IMU data. The compressed storage module encapsulates the aligned AIS dynamic features and IMU inertial features into a unified data structure, and uses a binary serialization protocol to convert the data structure into a compact binary byte stream and append it to a local file; The anomaly protection module monitors the data integrity of each sensor in real time, performs end-side data anomaly handling when signal loss or interface disconnection occurs, and forcibly refreshes the file buffer when recording ends or power alarm is triggered to ensure the integrity of stored data.