Sensor software synchronization method with constant time offset increment
The Kalman filter model is used to estimate and correct the sensor cumulative error, which solves the problem of sensor time synchronization error accumulation, achieves high-precision time synchronization, and improves the overall performance of the system and data accuracy.
Patent Information
- Application Number
- CN202510821157.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-09-09
AI Technical Summary
The accumulation of time synchronization errors between sensors leads to a decrease in system performance and data accuracy, especially in high-precision applications where effective time synchronization is difficult to achieve.
The Kalman filter model is used to estimate and correct the accumulated errors of the sensors. By recording the moment data of sensor requests and responses, the Kalman filter algorithm is used to continuously update the covariance matrix to reduce the error and achieve stable synchronization of sensor time.
It improves the accuracy of sensor time correction, reduces the impact of errors on the overall system performance, ensures that the sensor time can stably reflect the actual time, realizes time synchronization of multi-sensor systems, and improves the overall accuracy and reliability of the system.
Smart Images

Figure CN120610604A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of industrial communications, and in particular relates to a sensor software synchronization method with a constant time offset increment. Background Art
[0002] In multi-sensor integration scenarios, ensuring time synchronization among sensors is crucial. Time synchronization means that the internal clocks of all sensors must be consistent so that they collect data at the same point in time. This synchronization ensures temporal consistency in data between sensors, enabling the multi-sensor system to correctly fuse their measurements. If sensors cannot maintain temporal synchronization, the system will suffer from a lack of temporal correlation between data, potentially leading to distorted measurement results or difficulty integrating them, ultimately compromising the accuracy and reliability of the entire system.
[0003] For individual sensors, time accuracy is equally crucial. Accurate timestamps not only help record the exact moment of sensor measurement but also improve the accuracy of measurement results. Timestamp accuracy is directly related to data validity, especially in applications requiring long-term monitoring or with strict timing requirements. Whether for a single sensor or a multi-sensor system, accurate time management is a critical factor in ensuring data quality and system performance. Therefore, when designing and implementing sensor systems, time synchronization and time management should be prioritized, and effective technical means should be employed to achieve this goal.
[0004] like Figure 1 As shown, the communication between sensors and the SOC is based on a request-response mechanism. When the SOC needs sensor data, it sends a request signal to the sensor. This request signal includes the sensor ID and the request details. After receiving the request signal from the SOC, the sensor verifies that the request is for its own data and sends a response signal. This response signal includes the physical quantity measured by the sensor and, for sensors with on-chip time information, also includes time information. However, this time information is affected by the accuracy of the on-chip crystal oscillator and may contain errors. When errors occur, the deviation from the normal time gradually accumulates, forming a cumulative error.
[0005] In sensor scenarios, sensors with crystal oscillators have on-chip time functionality. A crystal oscillator is a device on a semiconductor device that controls the increment of on-chip time at a certain frequency. After initialization, the crystal oscillator updates the on-chip time based on the frequency, maintaining synchronization with real-world time. Sensors with crystal oscillators can return on-chip time, but the accuracy of the sensor's own crystal oscillator is often insufficient, resulting in errors in time updates. These errors can accumulate, causing the on-chip time to deviate further from real-world time, ultimately rendering the sensor's timestamp unreliable and making it impossible to synchronize multi-sensor systems. This situation poses a serious threat to overall system performance and data accuracy, especially in applications that rely on precise timing, where it can cause system deviations or errors.
[0006] To address sensor time synchronization, a group-based approach can be used. This effectively abandons the on-chip time functionality of the sensors. Under this approach, data read requests are distributed according to predefined groups. Sensors in each group are guaranteed to receive read requests within a specific time period and collect data within the same time period. The system then reads the data returned by the sensors according to the group and assigns the same timestamp to the data for each group, indicating that the data was collected within the same time period. This approach reduces the impact of individual sensor time errors on the overall system by simplifying the time synchronization problem to intra-group synchronization. However, the times obtained by this group-based approach are approximate, guaranteeing only that a group of sensors are within the same time period. Because the timestamps are group-based, rather than sensor-specific, slight time differences may still exist between sensors within a group. Furthermore, this approach cannot fundamentally address the issue of individual sensor time accuracy. Especially in the case of large crystal oscillator deviations, individual sensor time errors can still affect data accuracy. Therefore, while group-based approaches can alleviate multi-sensor time synchronization issues to some extent, applications requiring high precision still require more advanced synchronization technologies or more rigorous calibration of the sensor time bases. Summary of the Invention
[0007] In order to solve the above problems, the present invention provides a sensor software synchronization method with constant time offset increment, which is applied to the scenario where the sensor and the SOC end communicate through request and response. When the SOC end sends a request signal to the sensor, the SOC records this time as the time when the sensor request is sent. When the request signal reaches the sensor, the sensor returns a data packet to the SOC, which contains the on-chip time when the data is generated. , the on-chip time contains the cumulative error caused by the instability of the crystal oscillator; then, after the sensor sends the data packet to the SOC, the SOC records the response arrival time ; n represents the nth request and response to the sensor; the Kalman filter model is used to obtain the estimated value of the nth cumulative error, and the following process is included: S1, based on historical experimental data, obtain the initial value parameters required by the Kalman filter model; S2, obtains the cumulative error observation value based on the moment data obtained during the sensor request and response process; S3, based on the cumulative error observation value, input the Kalman filter model to obtain the cumulative error estimate; the specific process is: S31, based on the speed obtained Construct a state transfer matrix for prediction. The state transfer matrix F is:
[0008] The state transition equation is:
[0009] in, is the predicted value of the nth state vector through the n-1th state vector estimation value; F is the state transfer matrix, is the estimated value of the state vector at time n-1; speed is the cumulative error speed variable; The on-chip moments of the nth and n-1th times The difference, that is:
[0010] in, It is the nth on-film moment; Among them, the state transition equation of the prediction covariance is:
[0011] in, The n-th prediction covariance matrix is extrapolated by the n-1 prediction covariance matrix estimate; is the estimated value of the prediction covariance matrix for the n-1th time; S32, the state vector estimated by the Kalman filter when the sensor is requested for the n-1th time , and, the state transfer equation obtained, obtain the nth state vector prediction value :
[0012] in, is the predicted value of the nth state vector through the n-1th state vector estimation value; F is the state transfer matrix, is the estimated value of the state vector for the n-1th time; is the on-chip moment at the nth and n-1th times The difference between S33, according to the covariance transfer matrix:
[0013] in, The n-th prediction covariance matrix is extrapolated by the n-1 prediction covariance matrix estimate; S34, calculated based on as well as Calculate the Kalman gain:
[0014] in represents the nth Kalman gain, The n-th prediction covariance matrix is extrapolated by the n-1-th prediction covariance estimate. is the observation covariance matrix; S35, according to the obtained Kalman gain And the nth state vector prediction value Get the n-th state vector estimate :
[0015] in, It is the predicted value of the n-th state vector through the estimated value of the n-1-th state vector; is the observed value of the state vector; represents the nth Kalman gain; S36, according to the obtained Kalman gain And the n-1 prediction covariance estimate is used to extrapolate the n-th prediction covariance Get the nth prediction covariance estimate :
[0016] in It is the extrapolation of the n-th prediction covariance matrix through the n-1 prediction covariance matrix estimation. represents the nth Kalman gain; E is the identity matrix; S4, calculate the corrected sensor measurement time based on the estimated value of the cumulative error and the on-chip time at the nth moment .
[0017] Preferably, the initial value parameters required for the Kalman filter model are obtained in S1, specifically including: Return the obtained time data based on multiple requests in the experimental data, and obtain the initial value of the cumulative error speed , cumulative error speed The Kalman filter will be continuously updated iteratively; Based on multiple experimental data, multiple cumulative error observation data are obtained, and the observation covariance matrix is calculated based on these data. ;
[0018] in is the variance of the cumulative error observations, is the on-chip moment at the nth and n-1th times The difference between Based on multiple experimental data, multiple cumulative error prediction values are obtained, and the initial value of the prediction covariance matrix of the cumulative error is obtained based on these data. ;
[0019] in is the cumulative error forecast variance, is the on-chip moment at the nth and n-1th times The difference.
[0020] Preferably, in S2, the cumulative error observation value is obtained , calculated using the following formula:
[0021] in It is the nth on-film moment; is the sensor response arrival time; is the time when the sensor requests to send; Observed value of cumulative error velocity :
[0022] is the estimated cumulative error at time n-1; is the on-chip moment at the nth and n-1th times The difference, is the cumulative error observation; State vector By the above two 、 composed of.
[0023] Preferably, the specific process in S4 is: According to the n-th cumulative error estimate calculated in S3 , and the nth on-chip moment , and the corrected sensor measurement time is obtained :
[0024] in is the nth on-chip time; is the n-th cumulative error estimate.
[0025] Compared with the prior art, the present invention has the following beneficial effects: This paper provides a method for implementing software time synchronization for sensors. By continuously updating the covariance matrix in the Kalman filter, the algorithm gradually converges over time, bringing the error estimate closer to the actual difference between the sensor time and the NTP network time. This convergence effect not only improves the accuracy of time correction but also reduces the impact of errors on overall system performance, ensuring that the sensor time stably reflects the actual time.
[0026] During the calibration of a single sensor, Kalman filtering can effectively correct for time deviations caused by sensor errors. However, in a multi-sensor system, time synchronization becomes more complex, as the time errors of each sensor may vary. To address this issue, the method of the present invention projects the timelines of multiple sensors onto the real timeline of the SOC. This projection aligns the times of multiple sensors to the same time base, achieving time synchronization of the multi-sensor system. This synchronization not only helps improve the overall accuracy and reliability of the system but also ensures that data from different sensors can be effectively integrated and analyzed on the same time base in complex application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 Schematic diagram of the transmission method between the sensor and SOC.
[0028] Figure 2 This is a timing diagram of the communication between the sensor and the SOC.
[0029] Figure 3 It is a schematic diagram of the overall framework of the present invention.
[0030] Figure 4 This is a schematic diagram of the specific implementation process of the Kalman filter algorithm. DETAILED DESCRIPTION
[0031] Combine Figure 2 , the principle of the present invention is explained: Ts: sensor request sending time; T2: the moment when the request signal arrives at the sensor; T3: the time when the response signal sensor returns; Tr: sensor response arrival time; t1: request transmission time; t2: the time period during which sensor data may occur; t3: response transmission time; pn solid line box: represents the nth request packet; pn dotted box: represents the nth response packet.
[0032] The two times obtained on the time axis TL1 considered accurate by the data acquisition unit SOC: the sending time of the sending request , the time from receiving to returning , Will The time is regarded as the time when the sampling actually occurs on the sensor; The sensor measures the time axis TL2 with error and records the sampling time during sampling. ; and Difference It is the difference between the returned sampling time and the actual sampling time, that is, the error between the time axis TL1 and the time axis TL2; The focus of the present invention is on how to use Kalman filtering to dynamically predict the time when sampling actually occurs.
[0033] The core idea of the Kalman filter is to predict the next state based on the current state and correct the prediction using the measured value to obtain the best state estimate. It assumes that the system and measurement process follow a linear Gaussian distribution, meaning that both system noise and measurement noise follow a normal distribution.
[0034] The Kalman filter is a recursive algorithm that doesn't require extensive historical data storage, making it suitable for real-time systems. It effectively combines prediction and measurement information to provide superior state estimation in the presence of noise. Under the assumptions of linearity and Gaussian noise, the Kalman filter is the optimal state estimation algorithm. Therefore, the Kalman filter is a suitable method for handling noise errors in real-time systems and is the optimal estimate for linear systems.
[0035] Kalman filtering can have a good effect in linear systems, but from the previous data, the experimental results show that the measurement time is linearly increasing, and the difference between the measurement time and the time used for calibration SOC is It also grows linearly. In order to facilitate processing and reduce the complexity of calculation and theory, we decided to use time deviation The Kalman filter processes variables instead of time directly.
[0036] If you want the data processed by Kalman filter to be more accurate, you need to pay attention to three points: The system is linear; The noise distribution satisfies the Gaussian distribution; The preset system model is as accurate as possible; In order to make the predicted values obtained by Kalman filtering more accurate, it is necessary to determine the initial conditions of the Kalman filter and verify the accuracy of the model through experiments.
[0037] In addition, there is another very important initial condition in the application of Kalman filtering, which is the initial state and the initial covariance matrix. There are several ways to evaluate the initial state and the initial covariance matrix: 1. Set based on prior knowledge; 2. Initialization through system observation; 3. Estimated by averaging the resting phase; 4. Use training data for estimation; 5. Initialization using Bayesian method; 6. Warm-up Phase In the above way, all the prerequisites for using Kalman filtering are completed, the system is transformed into a linear system, and the system model and initial state are determined through experiments or other methods.
[0038] The method of the present invention is further described below with reference to specific embodiments.
[0039] Example 1: like Figure 3 As shown, the implementation method of the present invention is: when the SOC sends a request signal to the sensor, the SOC records the time as the sensor request sending time After the request signal reaches the sensor, the sensor obtains the on-chip time when the recorded data is obtained from the data packet. This moment includes the cumulative error caused by the instability of the crystal oscillator; at the same time, the response arrival time of the sensor sending the data packet to the SOC is recorded ; n represents the nth request and response to the sensor; the Kalman filter model is used to obtain the estimated value of the nth cumulative error, and the following process is included: S1, based on historical experimental data, obtain the initial value parameters required by the Kalman filter model; S2, obtains the observed value of the cumulative error based on the moment data obtained during the sensor request and response process; S3, based on the observed value of the cumulative error, input the Kalman filter model to obtain the estimated value of the cumulative error; S4, calculate the corrected sensor measurement time based on the estimated value of the cumulative error and the on-chip time at the nth time .
[0040] The specific implementation method is as follows Figure 4 As shown: In this embodiment, the initial value of the cumulative error speed is obtained by returning the obtained time data based on multiple requests in the experimental data. In this example, the Kalman filter is not used to Any adjustment will result in cumulative error speed Always equal to the initial value ; Based on multiple experimental data, multiple cumulative error observation data are obtained, and the covariance of the cumulative error observation values is obtained based on these data. ; Based on multiple experimental data, multiple cumulative error prediction values are obtained, and the initial value of the predicted covariance of the cumulative error is obtained based on these data. ; The initial value of the cumulative error is set to 0, that is, =0.
[0041] The specific method of S1 is: First, the sensor was tested multiple times to obtain multiple sets of returned time data ( , , ); Between two data Divide the difference between the two by the difference in network time to obtain the initial value of the cumulative delay speed. ; Calculating multiple experiments Variance ,as well as The initial value of the forecast covariance .
[0042] The specific method of S2 is: When the SOC sends a request to the sensor for the nth time, the time is recorded as , when receiving the sensor response data, record the moment as , and according to the information of the data packet returned by the sensor, according to the formula:
[0043] Conclusion value; The specific methods of S3 are: According to the output of the algorithm at the n-1th time, and , and the time interval between n and n-1 times, according to the formula:
[0044] Obtain the nth cumulative error prediction value.
[0045] The estimated value of the prediction covariance matrix when the prediction covariance matrix extrapolation remains unchanged equal to n-1 times:
[0046] The Kalman gain is calculated based on the extrapolation of the prediction covariance matrix and the observation covariance matrix:
[0047] According to the obtained Kalman gain And the nth cumulative error prediction value Get the n-th cumulative error estimate :
[0048] According to the obtained Kalman gain , and the n-1 observation covariance estimate is used to extrapolate the n-th observation covariance Get the nth prediction covariance estimate :
[0049] In this example, the specific method of S4 is: According to the on-chip time of the sensor data at the time of the nth measurement, the corrected sensor measurement time is obtained .
[0050]
[0051] in is the on-chip time when the nth sensor data is generated; is the estimated value of the cumulative error at the nth time.
[0052] Example 2: In this embodiment, the rest of the process is identical to that of Example 1. The difference is that in Example 1, the speed remains absolutely constant. However, there are cases where the initial speed measurement is inaccurate or the operating speed changes during the experiment. By adding the cumulative error speed variable to the Kalman filter and relying on the Kalman filter to converge the cumulative error speed, a more accurate cumulative delay speed can be captured. Formally, the variables become multivariable, i.e., vectors, and the operations become matrix operations.
[0053] Return the obtained time data based on multiple requests in the experimental data, and obtain the initial value of the cumulative error speed , cumulative error speed The Kalman filter will be continuously updated iteratively; Based on multiple experimental data, multiple cumulative error observation data are obtained, and the observation covariance matrix is calculated based on these data. ;
[0054] in is the variance of the cumulative error observations, is the on-chip moment at the nth and n-1th times The difference.
[0055] Based on multiple experimental data, multiple cumulative error prediction values are obtained, and the initial value of the prediction covariance matrix of the cumulative error is obtained based on these data. ;
[0056] in is the cumulative error forecast variance, is the on-chip moment at the nth and n-1th times The difference.
[0057] In this embodiment, in S2, the cumulative error observation value is obtained , calculated using the following formula:
[0058] in It is the nth on-film moment; is the sensor response arrival time; is the time when the sensor requests to send; Observed value of cumulative error velocity :
[0059] is the estimated cumulative error at time n-1; is the on-chip moment at the nth and n-1th times The difference. is the cumulative error observation.
[0060] State vector By the above two 、 composed of.
[0061]
[0062] In this embodiment, the specific process of S3 is: S31, based on the speed obtained Construct a state transfer matrix for prediction. The state transfer matrix F is:
[0063] The state transition equation is:
[0064] in, is the predicted value of the nth state vector through the n-1th state vector estimation value; F is the state transfer matrix, is the estimated value of the state vector for the n-1th time; The on-chip moments of the nth and n-1th times The difference, that is:
[0065] in, It is the nth on-film moment; Among them, the state transition equation of the prediction covariance is:
[0066] in, The n-th prediction covariance matrix is extrapolated by the n-1 prediction covariance matrix estimate; is the estimated value of the prediction covariance matrix for the n-1th time; S32, the state vector estimated by the Kalman filter when the sensor is requested for the n-1th time , and, the state transfer equation obtained, obtain the nth state vector prediction value :
[0067] in, is the predicted value of the nth state vector through the n-1th state vector estimation value; F is the state transfer matrix, is the estimated value of the state vector for the n-1th time; is the on-chip moment at the nth and n-1th times The difference between S33, according to the covariance transfer matrix:
[0068] in, The n-th prediction covariance matrix is extrapolated by the n-1 prediction covariance matrix estimate; S34, calculated based on as well as Calculate the Kalman gain:
[0069] in represents the nth Kalman gain, The n-th prediction covariance matrix is extrapolated by the n-1-th prediction covariance estimate. is the observation covariance matrix; S35, according to the obtained Kalman gain And the nth state vector prediction value Get the n-th state vector estimate :
[0070] in, It is the predicted value of the n-th state vector through the estimated value of the n-1-th state vector; is the observed value of the state vector; represents the nth Kalman gain; S36, according to the obtained Kalman gain And the n-1 prediction covariance estimate is used to extrapolate the n-th prediction covariance Get the nth prediction covariance estimate :
[0071] in It is the extrapolation of the n-th prediction covariance matrix through the n-1 prediction covariance matrix estimation. represents the n-th Kalman gain; E is the identity matrix.
[0072] In this example, the specific method of S4 is: According to the on-chip time of the sensor data at the time of the nth measurement, the corrected sensor measurement time is obtained .
[0073]
[0074] in is the nth on-chip time; is the nth estimated value of the state vector, which exists in the state vector middle.
[0075] Example 3: In this example, the rest of the process is identical to that of Example 2. The difference is that, whereas in Example 2, the speed is constant, and the cumulative error rate neither increases nor decreases continuously, this example proposes a solution for situations where the cumulative error rate changes according to a specific trend. This scenario is called an acceleration model. Formally, the variables become multivariable, i.e., vectors, and the operations are matrix operations.
[0076] Return the obtained time data based on multiple requests in the experimental data and obtain the cumulative error speed , and the initial value of the accumulated error acceleration , cumulative error speed Acceleration with cumulative error The Kalman filter will be continuously updated iteratively; Based on multiple experimental data, multiple cumulative error observation values are obtained, and the cumulative error observation covariance matrix is calculated based on these data. ;
[0077] in is the variance of the cumulative error observations, is the on-chip moment at the nth and n-1th times The difference.
[0078] Based on multiple experimental data, multiple cumulative error prediction value data are obtained, and the initial value of the cumulative error prediction covariance is obtained based on these data. ;
[0079] in is the variance of the cumulative error forecast, is the on-chip moment at the nth and n-1th times The difference.
[0080] In this embodiment, in S2, the cumulative error observation value is obtained , calculated using the following formula:
[0081] in is the nth on-chip moment; is the sensor response arrival time; is the time when the sensor requests to send; Observed value of cumulative error velocity :
[0082] is the algorithm estimate for the n-1th time; is the on-chip moment at the nth and n-1th times The difference. is the cumulative error observation.
[0083] Observed value of accumulated error acceleration :
[0084] is the estimated value of the cumulative delay speed algorithm at the n-1th time; is the on-chip moment at the nth and n-1th times The difference. is the nth cumulative delayed speed observation value.
[0085] State vector By the above three 、 、 composed of.
[0086]
[0087] In this embodiment, the specific process of S3 is: S31, based on the accumulated error speed and the cumulative error acceleration Construct a state transfer matrix for prediction. The state transfer matrix F is:
[0088] The state transition equation is:
[0089] in, is the predicted value of the n-th state vector through the n-1 estimated value; F is the state transfer matrix, is the estimated value of the state vector for the n-1th time; The on-chip moments of the nth and n-1th times The difference, that is:
[0090] in, It is the nth on-film moment; Among them, the state transition equation of the prediction covariance is:
[0091] in, The n-th prediction covariance matrix is extrapolated by the n-1 prediction covariance matrix estimate; is the estimated value of the prediction covariance matrix for the n-1th time; S32, the state vector estimated by the Kalman filter when the sensor is requested for the n-1th time , and, obtain the state transfer equation, obtain the predicted value of the nth state vector :
[0092] in, is the predicted value of the nth state vector through the n-1th state vector estimation value; F is the state transfer matrix, is the estimated value of the state vector for the n-1th time; is the on-chip moment at the nth and n-1th times The difference between S33, obtain the covariance transfer matrix according to the physical model:
[0093] in, The n-th prediction covariance matrix is extrapolated by the n-1-th prediction covariance matrix estimate; S34, calculated based on and the observation covariance matrix Calculate the Kalman gain:
[0094] in represents the nth Kalman gain, It is the extrapolation of the n-th prediction covariance matrix by the n-1-th prediction covariance estimate. is the cumulative error observation covariance matrix; S35, according to the obtained Kalman gain And the cumulative error prediction value of the nth time Get the n-th cumulative error estimate :
[0095] in, It is the predicted value of the nth state vector through the n-1th state vector estimation value; is the cumulative error observation; represents the nth Kalman gain; S36, according to the obtained Kalman gain And the n-1th prediction covariance estimate is extrapolated to the nth prediction covariance Get the nth prediction covariance estimate :
[0096] in The n-th prediction covariance matrix is estimated by extrapolating the n-th prediction covariance matrix. represents the n-th Kalman gain; E is the identity matrix.
[0097] In this embodiment, the specific method of S4 is: According to the on-chip time of the sensor data at the time of the nth measurement, the corrected sensor measurement time is obtained .
[0098]
[0099] in is the on-chip time when the nth sensor data is generated; is the estimated value of the n-th cumulative error, which exists in the state vector middle.
[0100] The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.
[0101] Although the above describes the specific implementation methods of the present invention, it does not limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.
Claims
1. A sensor software synchronization method with constant time offset increment, characterized by: Applicable to scenarios where sensors and SOCs communicate through request and response. When the SOC sends a request signal to the sensor, the SOC records this as the time the sensor request is sent. When the request signal reaches the sensor, the sensor returns a data packet to the SOC, which contains the on-chip time when the data is generated. , the on-chip time contains the accumulated error due to the instability of the crystal oscillator; then, after the sensor sends the data packet to the SOC, the SOC records the response arrival time ; n represents the nth request and response to the sensor; the Kalman filter model is used to obtain the estimated value of the nth cumulative error, and the following process is included: S1, based on historical experimental data, obtain the initial value parameters required by the Kalman filter model; S2, obtains the cumulative error observation value based on the moment data obtained during the sensor request and response process; S3, based on the cumulative error observation value, input the Kalman filter model to obtain the cumulative error estimate; the specific process is: S31, based on the speed obtained Construct a state transfer matrix for prediction. The state transfer matrix F is: The state transition equation is: in, is the predicted value of the nth state vector through the n-1th state vector estimation value; F is the state transfer matrix, is the estimated value of the state vector at time n-1; speed is the cumulative error speed variable; The on-chip moments of the nth and n-1th times The difference, that is: in, It is the nth on-film moment; Among them, the state transition equation of the prediction covariance is: in, The n-th prediction covariance matrix is extrapolated by the n-1 prediction covariance matrix estimate; is the estimated value of the prediction covariance matrix for the n-1th time; S32, the state vector estimated by the Kalman filter when the sensor is requested for the n-1th time , and, the state transfer equation obtained, obtain the nth state vector prediction value : in, is the predicted value of the nth state vector through the n-1th state vector estimation value; F is the state transfer matrix, is the estimated value of the state vector for the n-1th time; is the on-chip moment at the nth and n-1th times The difference between S33, according to the covariance transfer matrix: in, The n-th prediction covariance matrix is extrapolated by the n-1 prediction covariance matrix estimate; S34, calculated based on as well as Calculate the Kalman gain: in represents the nth Kalman gain, The n-th prediction covariance matrix is extrapolated by the n-1-th prediction covariance estimate. is the observation covariance matrix; S35, according to the obtained Kalman gain And the nth state vector prediction value Get the n-th state vector estimate : in, It is the predicted value of the n-th state vector through the estimated value of the n-1-th state vector; is the observed value of the state vector; represents the nth Kalman gain; S36, according to the obtained Kalman gain And the n-1 prediction covariance estimate is used to extrapolate the n-th prediction covariance Get the nth prediction covariance estimate : in It is the extrapolation of the n-th prediction covariance matrix through the n-1 prediction covariance matrix estimation. represents the nth Kalman gain; E is the identity matrix; S4, calculate the corrected sensor measurement time based on the estimated value of the cumulative error and the on-chip time at the nth moment .
2. The sensor software synchronization method with constant time offset increment according to claim 1, characterized in that: The initial value parameters required for the Kalman filter model are obtained in S1, specifically including: Return the obtained time data based on multiple requests in the experimental data, and obtain the initial value of the cumulative error speed , cumulative error speed The Kalman filter will be continuously updated iteratively; Based on multiple experimental data, multiple cumulative error observation data are obtained, and the observation covariance matrix is calculated based on these data. ; in is the variance of the cumulative error observations, is the on-chip moment at the nth and n-1th times The difference between Based on multiple experimental data, multiple cumulative error prediction values are obtained, and the initial value of the prediction covariance matrix of the cumulative error is obtained based on these data. ; in is the cumulative error forecast variance, is the on-chip moment at the nth and n-1th times The difference.
3. The sensor software synchronization method with constant time offset increment according to claim 1, characterized in that: In S2, the cumulative error observation value is obtained , calculated using the following formula: in It is the nth on-film moment; is the sensor response arrival time; is the time when the sensor requests to send; Observed value of cumulative error velocity : is the estimated cumulative error at time n-1; is the on-chip moment at the nth and n-1th times The difference, is the cumulative error observation; State vector By the above two 、 composed of.
4. The sensor software synchronization method with constant time offset increment according to claim 1, characterized in that: The specific process in S4 is: According to the n-th cumulative error estimate calculated in S3 , and the nth on-chip moment , and the corrected sensor measurement time is obtained : in is the nth on-chip time; is the n-th cumulative error estimate.