Sensor timing synchronization method and system in local area network
By using the IO port and time synchronization packets of the domain controller and sensor in the LAN system, the sensor timing synchronization is achieved, and the problem of insufficient time stamp accuracy of multi-sensor data is solved, and the time accuracy and data fusion accuracy are improved.
Patent Information
- Application Number
- CN202510503284.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-22
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2045-04-22
AI Technical Summary
In the prior art, when it is necessary to collect data at the same time of multiple sensors at the same time, the time stamp accuracy of the data is insufficient, and it is impossible to achieve accurate data fusion and joint judgment at the same time.
In the LAN system, the domain controller controls the IO port to output a preset level and sends a time synchronization message to the sensor. The sensor records the time stamp and calculates the time compensation value to realize the timing synchronization of the sensor.
Reduce the time error to the microsecond level, improve time accuracy, and realize accurate fusion and joint judgment of multi-sensor data, making hardware deployment simple and highly implementable.
Smart Images

Figure CN120049992A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of electronic digital data processing, and in particular, to a method and system for sensor time calibration and synchronization in a local area network. Background Art
[0002] Currently, assisted driving technologies rely on multiple sensors to perceive the surrounding environment and make safe driving decisions. Time synchronization is a prerequisite for multi-sensor data fusion. In a complex multi-sensor system, each sensor may operate according to its own clock reference and has different sampling frequencies. This can lead to the sampling data being out of sync in time, thereby affecting the accuracy and effectiveness of data fusion. Through time synchronization, the data of different sensors can be unified to the same timestamp, so as to achieve precise data fusion and provide strong support for subsequent decision-making and analysis.
[0003] In related technologies, most sensor systems perform time calibration through gateways. The network often has non-fixed congestion delays at the millisecond level. Therefore, the time error between sensors is at the millisecond level. In this way, when it is necessary to collect data of multiple sensors at the same moment, the timestamp accuracy of the data is insufficient, and precise fusion and joint determination of data at the same moment cannot be achieved. Summary of the Invention
[0004] The present application provides a method and system for sensor time calibration and synchronization in a local area network, which solves the problem in the prior art that when it is necessary to collect data of multiple sensors at the same moment, the timestamp accuracy of the data is insufficient, and precise fusion and joint determination of data at the same moment cannot be achieved. It can reduce the time error to the microsecond level, improve the time accuracy, and has simple hardware deployment and strong feasibility.
[0005] In a first aspect, the present application provides a method for sensor time calibration and synchronization in a local area network, which is applied to a local area network system. The local area network system includes a domain controller and multiple sensors. The domain controller is connected to each of the sensors through a control line. The method includes: When sensor time calibration and synchronization is triggered, the domain controller controls the IO port to output a first preset level and transmits it to each of the sensors, and sends a time synchronization message to each of the sensors. The time synchronization message includes the local time of the domain controller; When each of the sensors detects the first preset level, record the first timestamp corresponding to the current time; When each of the sensors receives the time synchronization message, record the second timestamp corresponding to the current time, and calculate a time compensation value according to the second timestamp and the first timestamp; Each of the sensors adds the local time to the respective corresponding time compensation value to obtain the calibrated system time.
[0006] Optionally, after each of the sensors adds the local time to the respective corresponding time compensation value to obtain the calibrated system time, the following steps are further included: Each of the sensors sends a response message to the domain controller; After receiving the response messages sent by each of the sensors, the domain controller controls the IO port to output a second preset level to end the sensor time calibration and synchronization. The second preset level has a different rising and falling edge level from the first preset level.
[0007] Optionally, before triggering the sensor time calibration and synchronization, the following steps are further included: The domain controller controls the IO port to output the second preset level and transmits it to each of the sensors.
[0008] Optionally, the calculating the time compensation value according to the second timestamp and the first timestamp includes: Determining the difference between the second timestamp and the first timestamp as the time compensation value.
[0009] Optionally, the calculating the time compensation value according to the second timestamp and the first timestamp includes: Calculating the difference between the first timestamp and the second timestamp, and adding the difference to the pre-stored correction coefficient to obtain the time compensation value. The pre-stored correction coefficient is the total inherent delay inside the sensor.
[0010] Optionally, after recording the first timestamp corresponding to the current time, the following steps are further included: If the time synchronization message is not received within the preset time window, delete the first timestamp and send a timeout message to the domain controller for the domain controller to re-control the level of the IO port and re-send the time synchronization message.
[0011] Optionally, after each of the sensors sends a response message to the domain controller, the following steps are further included: In the case that the domain controller does not receive the response messages sent by each of the sensors, re-control the level of the IO port and re-send the time synchronization message.
[0012] In a second aspect, the present application further provides a sensor time calibration and synchronization system in a local area network, including a domain controller and multiple sensors: The domain controller is used to control the IO port to output a first preset level and transmit it to each of the sensors, and send a time synchronization message to each of the sensors when triggering sensor time calibration synchronization. The time synchronization message includes the local time of the domain controller. Each of the sensors is used to record a first timestamp corresponding to the current time when detecting the first preset level, and record a second timestamp corresponding to the current time when receiving the time synchronization message, calculate a time compensation value according to the second timestamp and the first timestamp, and obtain the calibrated system time by adding the local time with the respective corresponding time compensation value.
[0013] In a third aspect, the present application further provides a sensor time calibration synchronization device in a local area network. The device includes: One or more processors; A storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the sensor time calibration synchronization method in the local area network described in the present application.
[0014] In a fourth aspect, the present application further provides a storage medium storing computer-executable instructions. The computer-executable instructions are used to execute the sensor time calibration synchronization method in the local area network described in the present application when executed by a computer processor.
[0015] In the present application, when triggering sensor time calibration synchronization, the domain controller controls the IO port to output a first preset level and transmit it to each sensor, and sends a time synchronization message to each sensor. The time synchronization message includes the local time of the domain controller. When each sensor detects the first preset level, it records a first timestamp corresponding to the current time. When each sensor receives the time synchronization message, it records a second timestamp corresponding to the current time. A time compensation value is calculated according to the second timestamp and the first timestamp. Each sensor obtains the calibrated system time by adding the local time with the respective corresponding time compensation value. This solution realizes sensor time calibration synchronization by connecting the domain controller and each sensor through a control line, solves the problem that in the prior art, when it is necessary to collect data of multiple sensors at the same moment, the timestamp accuracy of the data is insufficient and precise fusion and joint determination of data at the same moment cannot be achieved, can reduce the time error to the microsecond level, improve the time accuracy, and has simple hardware deployment and strong feasibility. Description of the Drawings
[0016] Figure 1 It is a flowchart of a sensor time calibration synchronization method in a local area network provided by an embodiment of the present application. Figure 2Flowchart of a sensor time synchronization method in a local area network including ending sensor time synchronization calibration provided by an embodiment of the present application; Figure 3 Schematic diagram of the timing of the IO port level change provided by an embodiment of the present application; Figure 4 Flowchart of a sensor time synchronization method in a local area network including calculating a time compensation value provided by an embodiment of the present application; Figure 5 Flowchart of another sensor time synchronization method in a local area network including calculating a time compensation value provided by an embodiment of the present application; Figure 6 Flowchart of a sensor time synchronization method in a local area network including sending a timeout message provided by an embodiment of the present application; Figure 7 Block diagram of the module structure of a sensor time synchronization system in a local area network provided by an embodiment of the present application; Figure 8 Schematic diagram of the structure of a sensor time synchronization device in a local area network provided by an embodiment of the present application. Detailed implementation manners
[0017] The following further describes the embodiments of the present application in detail with reference to the drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the embodiments of the present application, rather than limiting the embodiments of the present application. In addition, it should be noted that for the sake of description, only parts related to the embodiments of the present application are shown in the drawings, rather than all the structures.
[0018] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are usually of the same category, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally means that the related objects before and after are in an "or" relationship.
[0019] A sensor time synchronization method in a local area network provided by an embodiment of the present application can be applied to assisted driving scenarios such as intelligent driving vehicles, drones, and robots. In a sensor time synchronization method in a local area network provided by an embodiment of the present application, the execution subject of each step is a domain controller or a sensor.
[0020] Figure 1The flowchart of a method for sensor time calibration and synchronization in a local area network provided by an embodiment of this application is as follows: Figure 1 As shown, it specifically includes: Step S101: When sensor time calibration and synchronization is triggered, the domain controller controls the IO port to output a first preset level and transmits it to each sensor, and sends a time synchronization message to each sensor. The time synchronization message includes the local time of the domain controller.
[0021] Among them, the domain controller is a device responsible for collecting data from each sensor, performing arithmetic fusion, and outputting the arithmetic result. The domain controller is connected to each sensor through a control line. The domain controller can control the IO port to output a first preset level and transmit it to each sensor, and send a time synchronization message to each sensor when sensor time calibration and synchronization is triggered. The IO port is an input / output interface for information exchange between the domain controller and each sensor. Among them, in the initialization stage (system startup / sensor wake-up), dynamic environment (real-time guarantee under high speed / complex road conditions), fault recovery (clock source switching / sensor restart), etc., sensor time calibration and synchronization can be triggered. The first preset level is used to represent the preset level state that the IO port needs to switch when sensor time calibration and synchronization is triggered, which can be a low level state or a high level state. The time synchronization message is a message used to synchronize the clocks of each sensor in the network. The time synchronization message is sent synchronously when the domain controller controls the IO port to output the first preset level, and it contains the local time of the domain controller. The local time can be the time corresponding to when the domain controller controls the IO port to output the first preset level. Exemplarily, the first preset level is a low level, and currently it is the initialization stage, triggering sensor time calibration and synchronization. The domain controller controls the IO port to output a low level and transmits it to each sensor. The local time corresponding to when the domain controller controls the IO port to output a low level is 12:00, then a time synchronization message containing this local time is generated and sent to each sensor.
[0022] Step S102: When each sensor detects the first preset level, record the first timestamp corresponding to the current time. When each sensor receives the time synchronization message, record the second timestamp corresponding to the current time.
[0023] Among them, the first preset level is transmitted through the control line, while the time synchronization message is transmitted through the local area network. The physical transmission delay of the control line is much lower than the processing delay of the local area network. The physical transmission delay of the control line can be accurate to the microsecond level. Data is sent in byte form in the local area network, and there are congestion, occupancy, etc. in the local area network. Therefore, the time when each sensor receives the time synchronization message is after the time when the first preset level is detected, that is, the second timestamp is greater than the first timestamp. A timestamp is a data format representing a specific time point. Exemplarily, after the domain controller controls the IO port to output a low level (the first preset level) and transmits it to each sensor and sends a time synchronization message to each sensor, sensor a detects the low level at 12:00.000001 and records the timestamp corresponding to 12:00.000001. Sensor a receives the time synchronization message at 12:00.0002 and records the timestamp corresponding to 12:00.0002.
[0024] In one embodiment, after each sensor detects the first preset level, in the presence of other non-real-time tasks, the non-real-time task is paused and the time calibration task of the system time of the sensor is preferentially performed.
[0025] Step S103: Calculate the time compensation value according to the second timestamp and the first timestamp. Each sensor adds the local time of the domain controller in the time synchronization message to its respective corresponding time compensation value to obtain the calibrated system time.
[0026] Among them, the time compensation value can be the time consumed when the time synchronization message is transmitted to the sensor through the local area network. The time compensation value can be calculated using the second timestamp and the first timestamp. Adding this time compensation value to the local time can obtain the calibrated system time of the corresponding sensor. Exemplarily, sensor a calculates the time compensation value to be 0.000199 seconds according to the second timestamp and the first timestamp. The local time of the domain controller in the time synchronization message is 12:00. Adding the local time of the domain controller in the time synchronization message to this time compensation value, the calibrated system time of sensor a is 12:00.000199.
[0027] As described above, when triggering sensor time calibration and synchronization, the domain controller controls the IO port to output a first preset level and transmit it to each sensor, and sends a time synchronization message to each sensor. The time synchronization message includes the local time of the domain controller. When each sensor detects the first preset level, it records the first timestamp corresponding to the current time. When each sensor receives the time synchronization message, it records the second timestamp corresponding to the current time. The time compensation value is calculated based on the second timestamp and the first timestamp. Each sensor adds its respective corresponding time compensation value to the local time to obtain the calibrated system time. This solution realizes sensor time calibration and synchronization by connecting the domain controller and each sensor through a control line, solves the problem in the prior art that when it is necessary to collect data of multiple sensors at the same moment, the timestamp accuracy of the data is insufficient, and accurate fusion and joint determination of data at the same moment cannot be achieved. It can reduce the time error to the microsecond level, improve the time accuracy, and has simple hardware deployment and strong feasibility.
[0028] Figure 2 The figure is a flowchart of a sensor time calibration and synchronization method in a local area network including ending sensor time calibration and synchronization provided by an embodiment of the present application. As Figure 2 shown, it specifically includes: Step S201: When triggering sensor time calibration and synchronization, the domain controller controls the IO port to output a first preset level and transmit it to each sensor, and sends a time synchronization message to each sensor, where the time synchronization message includes the local time of the domain controller.
[0029] Step S202: When each sensor detects the first preset level, it records the first timestamp corresponding to the current time. When each sensor receives the time synchronization message, it records the second timestamp corresponding to the current time.
[0030] Step S203: Calculate the time compensation value based on the second timestamp and the first timestamp. Each sensor adds the local time of the domain controller in the time synchronization message and its respective corresponding time compensation value to obtain the calibrated system time.
[0031] Step S204: Each sensor sends a response message to the domain controller. After the domain controller receives the response messages sent by each sensor, it controls the IO port to output a second preset level to end the sensor time calibration and synchronization. The second preset level and the first preset level are different rising and falling edge levels.
[0032] Among them, the response message is the message sent by the sensor after time calibration, which is used to feedback the time synchronization status of the sensor to the domain controller. By using this response message, the domain controller can be instructed to control the IO port to output a second preset level to end the sensor time calibration synchronization. The second preset level is a level with a state different from that of the first preset level. For example, if the first preset level is a low level, the second preset level is a high level. Optionally, before triggering the sensor time calibration synchronization, the domain controller controls the IO port to output the second preset level and transmits it to each sensor. Exemplarily, as Figure 3 shown, Figure 3 is a schematic diagram of the timing of the IO port level change provided by an embodiment of the present application. Among them, T0 is the moment when the domain controller pulls down the level and sends the time synchronization message. At this T0 moment, the sensor synchronously detects the low level and records the corresponding timestamp. Before the T0 moment, the domain controller controls the IO port to output a high level and transmits it to each sensor. T1 is the moment when the sensor receives the time synchronization message and performs time calibration. The IO port remains in the low level state between T0 and T2. T2 is the moment when the domain controller receives the response messages sent by each sensor and controls the IO port to return to the high level state.
[0033] Optionally, after each sensor sends a response message to the domain controller, in the case that the domain controller does not receive the response messages sent by each sensor, the level of the IO port is re-controlled and the time synchronization message is re-sent. In another embodiment, after each sensor sends a response message to the domain controller, in the case that the domain controller does not receive the response messages sent by any one or more sensors, the level of the IO port is re-controlled and the time synchronization message is re-sent.
[0034] As can be seen from the above, after each sensor adds the local time of the domain controller in the time synchronization message to its respective corresponding time compensation value to obtain the calibrated system time, each sensor sends a response message to the domain controller. After the domain controller receives the response messages sent by each sensor, it controls the IO port to output a second preset level to end the sensor time calibration synchronization. The second preset level and the first preset level are different rising and falling edge levels. This solution can reduce the time error to the microsecond level by controlling the level state of the IO port for sensor time calibration synchronization.
[0035] Figure 4 is a flowchart of a method for sensor time calibration synchronization in a local area network including calculating a time compensation value provided by an embodiment of the present application. As Figure 4 shown, it specifically includes: Step S301, in the case of triggering sensor time calibration synchronization, the domain controller controls the IO port to output a first preset level and transmits it to each sensor, and sends a time synchronization message to each sensor, where the time synchronization message includes the local time of the domain controller.
[0036] Step S302: When each sensor detects the first preset level, record the first timestamp corresponding to the current time. When each sensor receives the time synchronization message, record the second timestamp corresponding to the current time.
[0037] Step S303: Determine the difference between the second timestamp and the first timestamp as the time compensation value. Each sensor adds the local time of the domain controller in the time synchronization message to its respective corresponding time compensation value to obtain the calibrated system time.
[0038] Among them, the first timestamp is the timestamp corresponding to the time when the sensor detects the first preset level. Since the physical transmission delay of the control line can be accurate to the microsecond level, this first timestamp can be equivalent to the timestamp corresponding to the time when the domain controller controls the IO port to output the first preset level. When the domain controller controls the IO port to output the first preset level, it immediately sends a time synchronization message, that is, the time when the domain controller sends the time synchronization message is the same as the time when it controls the IO port to output the first preset level. This first timestamp can be equivalent to the time when the domain controller sends the time synchronization message. Taking the difference between the second timestamp corresponding to the time when the sensor receives the time synchronization message and this first timestamp can obtain the transmission time of the time synchronization message, that is, the time compensation value. Exemplarily, the first timestamp of sensor a is the timestamp corresponding to 12:00.000001, and the second timestamp is the timestamp corresponding to 12:00.0002. The calculated difference between the second timestamp and the first timestamp is 0.000199 seconds, so the time compensation value corresponding to sensor a is 0.000199 seconds.
[0039] As can be seen from the above, after recording the first timestamp and the second timestamp, determine the difference between the second timestamp and the first timestamp as the time compensation value. Each sensor adds the local time of the domain controller in the time synchronization message to its respective corresponding time compensation value to obtain the calibrated system time. This solution determines the difference between the second timestamp and the first timestamp as the time compensation value, and can determine the time used for the transmission of the time synchronization message.
[0040] Figure 5 The following is a flowchart of another method for calibrating and synchronizing sensors in a local area network that includes calculating the time compensation value provided by an embodiment of the present application. As Figure 5 shown, it specifically includes: Step S401: When triggering sensor calibration and synchronization, the domain controller controls the IO port to output the first preset level and transmits it to each sensor, and sends a time synchronization message to each sensor, where the time synchronization message includes the local time of the domain controller.
[0041] Step S402: When each sensor detects the first preset level, record the first timestamp corresponding to the current time. When each sensor receives the time synchronization message, record the second timestamp corresponding to the current time.
[0042] Step S403: Calculate the difference between the first timestamp and the second timestamp, and superimpose the difference and the pre-stored correction coefficient to obtain the time compensation value. Each sensor adds the local time of the domain controller in the time synchronization message and its respective corresponding time compensation value to obtain the calibrated system time. The pre-stored correction coefficient is the total of the inherent delays inside the sensor.
[0043] Among them, the pre-stored correction coefficient is the total of the inherent delays inside the sensor. This inherent delay can be a fixed characteristic of the sensor itself, such as inherent characteristics like hardware response delay, interrupt processing delay, communication parsing delay, etc. Among them, the hardware response delay can be the response time of the hardware circuit when the sensor detects the change in the IO port level. The interrupt processing delay can be the software processing time required for the sensor firmware to trigger an interrupt and record the timestamp after detecting the change in the IO port level. The communication parsing delay can be the processing time required for the sensor to parse the content of the time synchronization message after receiving it. Using this pre-stored correction coefficient can correct the difference between the first timestamp and the second timestamp to make it closer to the true value. Exemplarily, the hardware response delay of sensor a is 1 microsecond, the interrupt processing delay is 2 microseconds, and the communication parsing delay is 5 microseconds. Then the total of the inherent delays inside sensor a, that is, the pre-stored correction coefficient, is 8 microseconds. Calculate that the difference between the first timestamp and the second timestamp of sensor a is 199 microseconds, and superimpose this difference and the pre-stored correction coefficient to obtain the time compensation value of 207 microseconds.
[0044] As can be seen from the above, after recording the first timestamp and the second timestamp, calculate the difference between the first timestamp and the second timestamp, superimpose the difference and the pre-stored correction coefficient to obtain the time compensation value. Each sensor adds the local time of the domain controller in the time synchronization message and its respective corresponding time compensation value to obtain the calibrated system time. The pre-stored correction coefficient is the total of the inherent delays inside the sensor. This solution corrects the difference between the second timestamp and the first timestamp through the stored correction coefficient to obtain the time compensation value, which can improve the accuracy of the time compensation value and make the calibrated system time of the sensor closer to the true value.
[0045] Figure 6 This is a flowchart of a method for calibrating and synchronizing sensors in a local area network including sending timeout messages provided by an embodiment of the present application. As Figure 6 shown, it specifically includes: Step S501: When triggering sensor calibration time synchronization, the domain controller controls the IO port to output a first preset level and transmits it to each sensor, and sends a time synchronization message to each sensor, where the time synchronization message includes the local time of the domain controller.
[0046] Step S502: When each sensor detects the first preset level, record the first timestamp corresponding to the current time. If the time synchronization message is not received within the preset time window, delete the first timestamp and send a timeout message to the domain controller for the domain controller to re-control the level of the IO port and re-send the time synchronization message.
[0047] Among them, the preset time window is the maximum allowable waiting time set in advance from when the sensor detects the first preset level to when it receives the time synchronization message, which can prevent system blockage caused by infinite waiting. This preset time window can be dynamically set according to network latency, clock accuracy, system real-time requirements, etc. When the sensor does not receive the time synchronization message sent by the domain controller within this preset time window, it deletes the first timestamp recorded when it detects the first preset level and sends a timeout message to the domain controller. When the domain controller receives this timeout message, it re-controls the level of the IO port and re-sends the time synchronization message to each sensor. Exemplarily, the preset time window is 50ms. After the sensor detects the first preset level and records the first timestamp corresponding to the current time, it waits for the time synchronization message sent by the domain controller. After waiting for 50ms and still not receiving the time synchronization message, the sensor deletes the recorded first timestamp and sends a timeout message to the domain controller so that the domain controller can re-control the level of the IO port and re-send the time synchronization message.
[0048] Step S503: When each sensor receives the time synchronization message, record the second timestamp corresponding to the current time, calculate the time compensation value based on the second timestamp and the first timestamp, and each sensor adds the local time of the domain controller in the time synchronization message to its respective corresponding time compensation value to obtain the calibrated system time.
[0049] As can be seen from the above, when each sensor detects the first preset level, record the first timestamp corresponding to the current time. If the time synchronization message is not received within the preset time window, delete the first timestamp and send a timeout message to the domain controller for the domain controller to re-control the level of the IO port and re-send the time synchronization message. This solution can prevent system blockage caused by infinite waiting by setting a reasonable waiting time for the time synchronization message in the time window.
[0050] Figure 7This is a block diagram of the module structure of a sensor time calibration and synchronization system in a local area network provided by an embodiment of the present application. This system is used to execute a sensor time calibration and synchronization method provided by the above embodiment, and has corresponding functional modules and beneficial effects for executing the method. As Figure 7 shown, the system specifically includes a domain controller 101 and multiple sensors 102: The domain controller 101 is configured to, when triggering sensor time calibration and synchronization, control the IO port to output a first preset level and transmit it to each of the sensors, and send a time synchronization message to each of the sensors, where the time synchronization message includes the local time of the domain controller; Each of the sensors 102 is configured to record a first timestamp corresponding to the current time when detecting the first preset level, and record a second timestamp corresponding to the current time when receiving the time synchronization message, calculate a time compensation value according to the second timestamp and the first timestamp, and obtain the calibrated system time by adding the local time with the respective corresponding time compensation values.
[0051] Among them, the sensor 102 refers to multiple sensors.
[0052] As can be seen from the above solution, when triggering sensor time calibration and synchronization, the domain controller controls the IO port to output a first preset level and transmit it to each sensor, and sends a time synchronization message to each sensor. The time synchronization message includes the local time of the domain controller. When each sensor detects the first preset level, it records a first timestamp corresponding to the current time. When each sensor receives the time synchronization message, it records a second timestamp corresponding to the current time. The time compensation value is calculated according to the second timestamp and the first timestamp. Each sensor obtains the calibrated system time by adding the local time with the respective corresponding time compensation values. This solution realizes sensor time calibration and synchronization by connecting the domain controller and each sensor through a control line, solves the problem in the prior art that when it is necessary to collect data of multiple sensors at the same moment, the timestamp accuracy of the data is insufficient, and accurate fusion and joint determination of data at the same moment cannot be achieved. It can reduce the time error to the microsecond level, improve the time accuracy, and has simple hardware deployment and strong feasibility.
[0053] In a possible embodiment, each of the sensors 102 is specifically configured to: Send an acknowledgment message to the domain controller; The domain controller 101 is specifically configured to: After receiving the acknowledgment messages sent by each of the sensors, control the IO port to output a second preset level to end the sensor time calibration and synchronization, where the second preset level and the first preset level are different rising and falling edge levels.
[0054] In a possible embodiment, the domain controller 101 is further configured to: Control the IO port to output the second preset level and transmit it to each of the sensors.
[0055] In a possible embodiment, the compensation value calculation module 104 is specifically configured to: Determine the difference between the second timestamp and the first timestamp as the time compensation value.
[0056] In a possible embodiment, each of the sensors 102 is further configured to: Calculate the difference between the first timestamp and the second timestamp, and superimpose the difference with a pre-stored correction coefficient to obtain the time compensation value, where the pre-stored correction coefficient is the total inherent delay inside the sensor.
[0057] In a possible embodiment, each of the sensors 102 is further configured to: If the time synchronization message is not received within a preset time window, delete the first timestamp and send a timeout message to the domain controller for the domain controller to re-control the level of the IO port and re-send the time synchronization message.
[0058] In a possible embodiment, the domain controller 101 is further configured to: In the case where the response messages sent by each of the sensors are not received, re-control the level of the IO port and re-send the time synchronization message.
[0059] Figure 8 The figure is a schematic structural diagram of a sensor time calibration and synchronization device in a local area network provided by an embodiment of the present application. As Figure 8 shown, the device includes a processor 201, a memory 202, an input device 203, and an output device 204; the number of processors 201 in the device may be one or more. Figure 8 Taking one processor 201 as an example; the processor 201, the memory 202, the input device 203, and the output device 204 in the device may be connected through a bus or other means. Figure 8Take the bus connection as an example. The memory 202, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions or modules corresponding to the sensor time calibration and synchronization method in a local area network in an embodiment of the present application. The processor 201 executes various functional applications and data processing of the device by running the software programs, instructions, and modules stored in the memory 202, that is, to implement the above-mentioned sensor time calibration and synchronization method in the local area network. The input device 203 can be used to receive input digital or character information, and generate key signal inputs related to the user settings and function controls of the device. The output device 204 may include display devices such as a display screen.
[0060] An embodiment of the present application also provides a storage medium containing computer-executable instructions, and the computer-executable instructions are used to execute a sensor time calibration and synchronization method in a local area network when executed by a computer processor. The method includes: In the case of triggering sensor time calibration and synchronization, the domain controller controls the IO port to output a first preset level and transmits it to each sensor, and sends a time synchronization message to each sensor. The time synchronization message includes the local time of the domain controller. When each sensor detects the first preset level, record the first timestamp corresponding to the current time. When each sensor receives the time synchronization message, record the second timestamp corresponding to the current time, and calculate the time compensation value according to the second timestamp and the first timestamp. Each sensor adds the local time to the respective time compensation value to obtain the calibrated system time.
[0061] It should be noted that in the embodiments of the above-mentioned sensor time calibration and synchronization method system in the local area network, the included units and modules are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of mutual distinction and do not limit the protection scope of the embodiments of the present application.
[0062] Note that the above is only the preferred embodiment of the embodiments of the present application and the applied technical principle. Those skilled in the art will understand that the embodiments of the present application are not limited to the specific embodiments described here, and various obvious changes, re-adjustments, and substitutions can be made by those skilled in the art without departing from the protection scope of the embodiments of the present application. Therefore, although the embodiments of the present application have been described in more detail through the above embodiments, the embodiments of the present application are not limited to the above embodiments. Without departing from the concept of the embodiments of the present application, more other equivalent embodiments can be included, and the scope of the embodiments of the present application is determined by the scope of the appended claims.
Claims
1. A sensor timing synchronization method in a local area network, applied to a local area network system, wherein the local area network system comprises a domain controller and a plurality of sensors, wherein the domain controller is connected to each of the sensors via a control line, wherein: The method comprises: In the case of triggering sensor time synchronization, the domain controller controls the IO port to output a first preset level to each of the sensors, and sends a time synchronization message to each of the sensors, wherein the time synchronization message includes the local time of the domain controller; When each of the sensors detects the first preset level, recording a first timestamp corresponding to the current time; When each of the sensors receives the time synchronization message, it records a second timestamp corresponding to the current time, and calculates a time compensation value according to the second timestamp and the first timestamp; Each of the sensors adds the local time to its own corresponding time compensation value to obtain the calibrated system time.
2. The sensor timing synchronization method in a local area network according to claim 1, characterized in that: After each of the sensors adds the local time to the corresponding time compensation value to obtain the calibrated system time, the method further includes: Each of the sensors sends a response message to the domain controller; After receiving the response message sent by each of the sensors, the domain controller controls the IO port to output a second preset level to end the sensor timing synchronization, and the second preset level and the first preset level are different rising and falling edge levels.
3. The sensor timing synchronization method in a local area network according to claim 2, characterized in that: Before the trigger sensor timing synchronization, the method further includes: The domain controller controls the IO port to output the second preset level and transmits it to each of the sensors.
4. The sensor timing synchronization method in a local area network according to any one of claims 1 to 3, characterized in that: The calculating the time compensation value according to the second timestamp and the first timestamp includes: A difference between the second timestamp and the first timestamp is determined as a time compensation value.
5. The sensor timing synchronization method in a local area network according to any one of claims 1 to 3, characterized in that: The calculating the time compensation value according to the second timestamp and the first timestamp includes: The difference between the first timestamp and the second timestamp is calculated, and the difference is superimposed with a pre-stored correction coefficient to obtain a time compensation value, where the pre-stored correction coefficient is the sum of the inherent delays in the sensor.
6. The sensor timing synchronization method in a local area network according to any one of claims 1 to 3, characterized in that: After recording the first timestamp corresponding to the current time, the method further includes: If the time synchronization message is not received within the preset time window, the first timestamp is deleted, and a timeout message is sent to the domain controller, so that the domain controller can re-control the level of the IO port and re-send the time synchronization message.
7. The sensor timing synchronization method in a local area network according to claim 2, characterized in that: After each of the sensors sends a response message to the domain controller, the method further includes: When the domain controller does not receive the response message sent by each of the sensors, the level of the IO port is re-controlled and the time synchronization message is re-sent.
8. A sensor timing synchronization system in a local area network, characterized in that: Includes domain controller and multiple sensors: The domain controller is used to control the IO port to output a first preset level to each of the sensors and send a time synchronization message to each of the sensors when the sensor time synchronization is triggered, and the time synchronization message includes the local time of the domain controller; Each of the sensors is used to record the first timestamp corresponding to the current time when detecting the first preset level, and to record the second timestamp corresponding to the current time when receiving the time synchronization message, calculate the time compensation value based on the second timestamp and the first timestamp, and add the local time to the corresponding time compensation value to obtain the system time after time calibration.
9. A sensor timing synchronization device in a local area network, the device comprising: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the sensor timing synchronization method in a local area network as described in any one of claims 1-7.
10. A storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the sensor timing synchronization method in a local area network as claimed in any one of claims 1 to 7 when executed by a computer processor.
Citation Information
Patent Citations
IEEE1588 clock synchronization system and implementation method therefor
CN104836630A
Time synchronization method, multi-sensor system and movable platform
CN112119365A
Time synchronization method and system for wireless deterministic network
CN119172029A
Time synchronization method, system and device, and storage medium
WO2020135857A1
Clock synchronization method, apparatus and system, and chip
WO2023004576A1