Time synchronization method and device and computer equipment

By receiving and processing time information from standard devices, time synchronization is achieved inside the vehicle and synchronized to the target device, which solves the problems of high time synchronization cost and poor compatibility in the existing technology, and improves the scalability and compatibility of time synchronization. sex.

CN118784133APending Publication Date: 2024-10-15AVATR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410959645.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

Existing vehicle time synchronization technology is based on a universal precision time protocol, resulting in high development costs and poor scalability and compatibility, making it difficult to meet the time synchronization needs between multiple electronic control units.

Method used

By receiving two messages sent by the standard device, the relative time is determined, and the relative time is maintained locally, and then the time is synchronized to the target device through the transfer method, avoiding direct time synchronization between the target device and the standard device, reducing costs and improving efficiency. compatibility.

Benefits of technology

It achieves cost reduction and improved compatibility of vehicle time synchronization. It can synchronize time with multiple standard devices and synchronize its relative time to the target device, which enhances the scalability and compatibility of time synchronization technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118784133A_ABST
    Figure CN118784133A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of vehicle control, and provides a time synchronization method and device and computer equipment, and the method comprises the steps: receiving a first message and a second message sent by standard equipment, and determining a first relative moment of the standard equipment according to the time information in the first message and the second message; maintaining the first relative time of the standard equipment based on the first relative moment; and sending a third message and a fourth message to a target device, so that the target device determines a second relative moment of the standard device according to time information in the third message and the fourth message, and the second relative moment is used for the target device to maintain the second relative time of the standard device. According to the technical scheme provided by one or more embodiments of the invention, the time synchronization cost can be reduced, and the time synchronization compatibility can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of vehicle control technology, and in particular to a time synchronization method, device and computer equipment. Background Art

[0002] For modern cars, especially new energy vehicles, the vehicle may have multiple Electronic Control Units (ECUs). In order to ensure that the time bases of multiple ECUs are the same, it is generally necessary to synchronize the time of multiple ECUs. In this way, it can ensure that when the vehicle obtains sensor data and fusion data, it has smaller data delay and higher data accuracy.

[0003] Most of the existing time synchronization technology solutions in the vehicle field are based on the Generalized Precision Time Protocol (gPTP) to achieve time synchronization between electronic control units. However, the use of gPTP to achieve time synchronization usually requires professional hardware support and precise network configuration. With the development of the industry, more electronic control units in vehicles need to be synchronized. If all solutions based on gPTP are used, the development cost will be greatly increased. Summary of the invention

[0004] In view of this, one or more embodiments of the present disclosure provide a time synchronization method, apparatus, and computer device, which can reduce the cost of time synchronization and improve the compatibility of time synchronization.

[0005] In a first aspect, the present disclosure provides a time synchronization method, the method comprising: receiving a first message and a second message sent by a standard device, and determining a first relative moment of the standard device based on time information in the first message and the second message; maintaining the first relative time of the standard device based on the first relative moment; sending a third message and a fourth message to a target device, so that the target device determines a second relative moment of the standard device based on time information in the third message and the fourth message, the second relative moment being used for the target device to maintain the second relative time of the standard device.

[0006] In a second aspect, the present disclosure provides a time synchronization device, comprising: a first synchronization module, used to receive a first message and a second message sent by a standard device, and determine a first relative moment of the standard device according to the time information in the first message and the second message; a first management module, used to maintain the first relative time of the standard device based on the first relative moment; a second synchronization module, used to send a third message and a fourth message to a target device, so that the target device determines the second relative moment of the standard device according to the time information in the third message and the fourth message, and the second relative moment is used for the target device to maintain the second relative time of the standard device.

[0007] In a third aspect, the present disclosure provides a computer device, the electronic device comprising a memory and a processor, the memory being used to store a computer program, and the computer program, when executed by the processor, implements the above-mentioned time synchronization method.

[0008] In a fourth aspect, the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the above-mentioned time synchronization method is implemented.

[0009] In a fifth aspect, the present disclosure provides a computer program product, including computer instructions, and the computer instructions are used to enable a computer to execute the above-mentioned time synchronization method.

[0010] The technical solution provided by one or more embodiments of the present disclosure can perform time synchronization with a standard device by receiving two messages. The relative time of the standard device can be maintained locally by using the result of the time synchronization. By sending two messages, time synchronization can be performed with a target device, and then the relative time of the locally maintained standard device can be synchronized to the target device.

[0011] The technical solution provided by one or more embodiments of the present disclosure, on the one hand, synchronizes the relative time of the standard device to the target device by means of transfer, and the target device no longer needs to synchronize time with the standard device directly, which can break away from the limitations of the general precision time protocol and reduce the overall cost of the time synchronization technology. On the other hand, the implementation subject of the time synchronization method can synchronize time with multiple standard devices, maintain the relative time of multiple standard devices locally, and synchronize the relative time of any standard device maintained locally with the target device, which greatly improves the scalability and compatibility of the time synchronization technology.

[0012] The above description is only an overview of the technical solution of the embodiment of the present invention. In order to more clearly understand the technical means of the embodiment of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The accompanying drawings are only used to illustrate the embodiments and are not to be considered as limiting the present invention. In addition, the same reference symbols are used to represent the same components throughout the accompanying drawings. In the accompanying drawings:

[0014] Figure 1 A schematic diagram showing the steps of a time synchronization method in one embodiment of the present disclosure is shown;

[0015] Figure 2 A schematic diagram of a process of performing time synchronization with a standard device in one embodiment of the present disclosure is shown;

[0016] Figure 3 A schematic diagram of data interaction of a time synchronization method in one embodiment of the present disclosure is shown;

[0017] Figure 4 A schematic diagram of a process of performing time synchronization with a target device in one embodiment of the present disclosure is shown;

[0018] Figure 5 A schematic diagram of the application process of the second relative time in one embodiment of the present disclosure is shown;

[0019] Figure 6 A schematic diagram of a process of transmitting a feedback timestamp from an application software to a standard device in one embodiment of the present disclosure is shown;

[0020] Figure 7 A schematic diagram of functional modules of a time synchronization device in one embodiment of the present disclosure is shown;

[0021] Figure 8 A schematic diagram of the hardware structure of a computer device in one embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0022] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0023] In related technologies, a vehicle may have multiple electronic control units, including an autonomous driving domain controller, a cockpit domain controller, a body domain controller, a power domain controller, a chassis domain controller, etc. Different electronic control units may need to exchange data or fuse data. To ensure the reliability and accuracy of data, time synchronization is usually required between different electronic control units.

[0024] In the related technology, the cockpit domain controller (CDC) is a relatively important electronic control unit in the vehicle. The cockpit domain controller may contain a microcontroller unit (MCU) and a system on a chip (SOC). Using the universal precision time protocol, the cockpit domain controller can synchronize time with other electronic control units in the vehicle. However, this means that a universal precision time protocol needs to be developed between various electronic control units, and high-cost chips need to be selected, which can easily increase the development cost of the vehicle.

[0025] In view of this, one or more embodiments of the present disclosure propose a time synchronization method, which can reduce the cost of time synchronization and improve the compatibility of time synchronization. Figure 1 , an implementation of the present disclosure can perform time synchronization according to the following multiple steps.

[0026] S1: receiving a first message and a second message sent by a standard device, and determining a first relative time of the standard device according to time information in the first message and the second message.

[0027] In this embodiment, the standard device may represent a clock source for providing a time reference. The standard device may be a mobile data center (MDC) that can provide a common time reference for multiple electronic control units.

[0028] In this embodiment, the implementation subject of the time synchronization method, that is, the method execution device, can be an electronic control unit, or a specified module inside the electronic control unit. For example, the time synchronization method can be executed by a cockpit domain controller, specifically, by a microcontroller unit in the cockpit domain controller.

[0029] In this embodiment, the method execution device may sequentially receive a first message and a second message sent by a standard device. Both the first message and the second message may carry time information related to the standard device. The standard device may send the second message after sending the first message at a preset time interval.

[0030] Optionally, the first message and the second message may be a synchronization (SYNC) message and a follow-up (FUP) message respectively. After sending the synchronization message, the standard device may wait for a preset time and then send the follow-up message.

[0031] In this embodiment, the method execution device can determine the first relative time of the standard device after extracting the time information carried by the first message and the time information carried by the second message. The first relative time can represent the time information used to complete a time synchronization during the time synchronization process between the standard device and the method execution device. According to the first relative time, the method execution device can determine the current standard time value of the standard device.

[0032] In this embodiment, considering that the data transmission path between the standard device and the method execution device may be far, the method execution device can receive the first message and the second message sent by the standard device through some network layer communication protocols, which can ensure the real-time data transmission and the anti-interference of the communication process.

[0033] For example, there may be a long data transmission path between the mobile data center and a microcontroller unit of an electronic control unit. In this case, a controller area network (CAN) communication protocol may be used so that the microcontroller unit receives the first message and the second message sent by the mobile data center in real time. Using the CAN communication protocol can also reduce the overall cost of the method.

[0034] In some embodiments, the method execution device may receive a first message sent by the standard device. The first message may carry first time information. The first time information may include a first moment. The first moment may represent a reference standard moment determined by the standard device. The method execution device may read the first time information in the first message, and then read the first moment included in the first time information.

[0035] The method execution device may also receive a second message sent by the standard device. The second message may carry second time information. The second time information may include a first time difference. The first time difference may be determined by the first moment and the second moment. The second moment may represent the standard moment when the standard device sends the first message. The method execution device may read the second time information in the second message, and then read the first time difference included in the second time information.

[0036] According to the first time point and the first time difference, the method execution device may determine a first relative time point of the standard device.

[0037] Specifically, in a time synchronization process between a standard device and a method execution device, the standard device may first determine a reference standard moment in its own time system, that is, a first moment. The standard device may write information of the first moment into a first message, and send the first message to the method execution device. The standard device may record the standard moment after sending the first message, that is, a second moment. Since the first moment and the second moment belong to the same time system of the standard device, the standard device may perform a subtraction operation on the second moment from the first moment to obtain a first time difference. The standard device may write information of the first time difference into a second message, and send the second message to the method execution device.

[0038] The method execution device may receive a first message. The method execution device may record the time when the first message is received as a third time. The method execution device may read information included in the first message to obtain the first time. The method execution device may also receive a second message. The method execution device may read information included in the second message to obtain the first time difference.

[0039] The method execution device can calculate the first relative moment at the fourth moment and record the fourth moment. Since the third moment and the fourth moment belong to the same time system of the method execution device, the method execution device can subtract the fourth moment from the third moment to obtain the second time difference. On this basis, the method execution device can jointly determine the first relative moment of the standard device based on the second time difference, the first moment and the first time difference. For example, the method execution device can add the second time difference, the first moment and the first time difference. Obviously, the result of the addition operation is a moment value, and the method execution device can use the moment value as the first relative moment.

[0040] It should be noted that, during the time synchronization process, the method execution device and the standard device may use the same clock frequency, so that the first time difference and the second time difference may represent the same time difference value information in the method execution device and the standard device.

[0041] See also Figure 2 In a practical application example, the standard device may be an MDC, and the method execution device may be an MCU. The process of step S1 may be specifically as follows:

[0042] The MDC can record a reference standard time t0 in the MDC time system and write the time information containing the time t0 into the SYNC message. Subsequently, the MDC can send a SYNC message to the MCU. The MDC can record the standard time t1 after sending the SYNC message through the underlying interrupt. The MCU can receive the SYNC message at the time t2 in the MCU time system and record the time t2 through the underlying interrupt. The MCU can read the reference standard time t0 in the SYNC message.

[0043] After sending the SYNC message, the MDC can write the time difference t4 between time t1 and time t0 into the FUP message at an interval of 40ms. The formula for the time difference t4 can be t4=t1-t0. Subsequently, the MDC can send a FUP message to the MCU. The MCU can receive the FUP message and read the time difference t4 in the FUP message.

[0044] At time t3 of the MCU time system, the MCU can calculate the first relative time by a formula such as t3-t2+t0+t4. The MCU can confirm the first relative time as the current standard time of the MDC.

[0045] S2: Based on the first relative moment, maintain the first relative time of the standard device.

[0046] In this embodiment, the method execution device may determine the first relative time as the current standard time value of the standard device. Afterwards, the method execution device may use its own timer to maintain the first relative time with the first relative time as the starting node. The first relative time maintained by the method execution device may correspond to the standard time of the standard device. For example, at a certain time point after time synchronization is completed, the time value obtained from the first relative time may be considered as the standard time value of the standard device at that time point.

[0047] It is worth noting that the first relative time maintained by the method execution device can be independent of the system time of the method execution device itself. The time synchronization between the method execution device and the standard device will not affect the system time of the method execution device. In this way, the method execution device can simultaneously maintain the first relative time of multiple standard devices and the time information of multiple clock sources, so that the method of the present disclosure has scalability and compatibility.

[0048] In a practical application example, refer to the above Figure 2 For example, the MCU can obtain the first relative time, which is represented by t3-t2+t0+t4. Then, the MCU can maintain the time of the MDC in the MCU according to the tick of its own system and the value of the first relative time.

[0049] S3: Send a third message and a fourth message to the target device so that the target device determines the second relative time of the standard device according to the time information in the third message and the fourth message, and the second relative time is used for the target device to maintain the second relative time of the standard device.

[0050] In this embodiment, the target device may be an electronic control unit, or a specified module inside the electronic control unit. The target device and the method execution device may be located inside the same electronic control unit. For example, the method execution device may be a microcontroller unit in a cockpit domain controller, and the target device may be a system-on-chip in the same cockpit domain controller.

[0051] In this embodiment, the method execution device may send a third message and a fourth message to the target device in sequence. The third message may carry time information related to the standard device maintained by the method execution device. The fourth message carries time information related to the method execution device.

[0052] Optionally, the third message and the fourth message may be in the form of buffer data.

[0053] In this embodiment, the method execution device may run a real-time operating system and complete the operation according to the operation cycle. The method execution device may send the third message in one operation cycle and send the fourth message in the next operation cycle.

[0054] In this embodiment, the target device can determine the second relative time of the standard device after extracting the time information carried in the third message and the time information carried in the fourth message. The second relative time can represent the time information used to complete a time synchronization during the time synchronization process between the method execution device and the target device.

[0055] In this embodiment, since the method execution device has maintained the first relative time of the standard device, the method execution device can determine the reference time information of the standard device from the first relative time. The method execution device can send the reference time information to the target device so that the target device can obtain the time information of the standard device. In this way, the target device can indirectly synchronize the time with the standard device only by communicating with the method execution device. There is no need for direct communication between the target device and the standard device, and no need to configure a dedicated communication protocol.

[0056] In this embodiment, after determining the second relative moment, the target device can use the timer of the target device to maintain the second relative time with the second relative moment as the starting node. The second relative time maintained by the target device can correspond to the first relative time maintained by the method execution device, and further can correspond to the standard time of the standard device. For example, at a certain time point after the time synchronization is completed, the time value obtained from the second relative time can be considered as the relative time value of the first relative time at that time point, and thus can be considered as the standard time value of the standard device at that time point.

[0057] It is worth noting that the second relative time maintained by the target device can be independent of the system time of the target device itself. The method execution device synchronizes the time with the target device without affecting the system time of the target device. In this way, the method execution device can synchronize the first relative time of multiple standard devices maintained locally to the target device. The target device can simultaneously maintain the second relative time of multiple standard devices and the time information of multiple clock sources, so that the method disclosed in the present invention has scalability and compatibility.

[0058] In this embodiment, considering that the data transmission path between the method execution device and the target device may be close, the method execution device can send the third message and the fourth message to the target device through some interface layer communication protocols, which can ensure the data transmission rate and increase the scalability of the method.

[0059] For example, there may be a shorter data transmission path between the microcontroller unit and the system-level chip in the same electronic control unit. In this case, the Serial Peripheral Interface (SPI) communication protocol can be used to enable the microcontroller unit to simply and efficiently send the third message and the fourth message to the system-level chip. The SPI communication protocol can also be applied to target devices of more device types.

[0060] See also Figure 3 In a practical application example, the standard device may be an MDC, the method execution device may be an MCU, and the target device may be an SOC. The MCU and the SOC may both be located in the CDC. The MDC and the MCU may communicate via CAN to transmit the first message and the second message to complete time synchronization. The MCU and the SOC may communicate via SPI to transmit the third message and the fourth message to complete time synchronization.

[0061] In some embodiments, the method execution device may receive a first query instruction sent by the target device. In response to the first query instruction, the method execution device may send a third message to the target device. The third message may carry third time information. The third time information may include a fifth moment. The fifth moment may represent a reference relative moment determined from the first relative time.

[0062] After sending the third message, the method execution device may send a fourth message to the target device. The fourth message may carry fourth time information. The fourth time information may include a third time difference. The third time difference may be determined by a sixth moment and a seventh moment. The sixth moment may represent a moment corresponding to the fifth moment. The seventh moment may represent a moment when the third message is sent.

[0063] Since the method execution device has maintained the first relative time of the standard device, the method execution device can determine the reference relative time from the first relative time at a time node. Under the premise that the first relative time is accurate, the reference relative time can be equal to the standard time value of the standard device at the time node. The method execution device can send the reference relative time to the target device so that the target device can obtain the time information of the standard device.

[0064] Specifically, during a time synchronization process between a method execution device and a target device, the method execution device can determine a reference relative moment, that is, the fifth moment, from the first relative time at the time node when the first query instruction is received; at the same time, the method execution device can query its own system time to determine the current moment, that is, the sixth moment. It can be seen that the sixth moment corresponds to the fifth moment, and respectively represents the moment value in the method execution device and the moment value in the first relative time at the same time node.

[0065] The method execution device may write the information of the fifth moment into the third message, and send the third message to the target device. The method execution device may record the moment when the third message is sent, that is, the seventh moment.

[0066] Since the sixth moment and the seventh moment belong to the same time system of the method execution device, the method execution device can perform a subtraction operation on the seventh moment and the sixth moment to obtain a third time difference. The method execution device can write information about the third time difference into a fourth message and send the fourth message to the target device.

[0067] The target device can receive the third message. The target device can read the information contained in the third message and learn the fifth time. The target device can also receive the fourth message. The target device can read the information contained in the fourth message and learn the third time difference. The target device can determine the second relative time of the standard device according to the fifth time and the third time difference. For example, the target device can perform an addition operation on the fifth time and the third time difference. Obviously, the result of the addition operation is a time value, and the target device can use the time value as the second relative time.

[0068] It should be noted that, during the time synchronization process, the method execution device and the target device may use the same clock frequency. In this way, the third time difference may represent the same time difference value information in the method execution device and the target device.

[0069] See also Figure 4In a practical application example, the method execution device may be an MCU, the target device may be an SOC, and the standard device may be an MDC. The MCU may maintain the first relative time of the MDC, that is, the MDC time. The MCU may be a real-time operating system and may have its own system time, that is, the MCU time. The process of step S3 may be specifically expressed as follows:

[0070] SOC can send a time query instruction to MCU via SPI. After receiving the time query instruction, MCU can read the current moment of MDC time, that is, the reference relative moment t5. At the same time, MCU can read the current moment of MCU time, that is, moment t6. Subsequently, MCU can write the time information including moment t5 into a third message, and send the third message to SOC via SPI. MCU can record the moment when the third message is sent through an interrupt, that is, moment t7 in MCU time. SOC can receive the third message and read the reference relative moment t5 in the third message.

[0071] In the next operation cycle, the MCU can write the time difference t8 between time t7 and time t6 into the fourth message. The formula of the time difference t8 can be t8=t7-t6. Then, the MCU can send the fourth message to the SOC. The SOC can receive the fourth message and read the time difference t8 in the fourth message.

[0072] The SOC can calculate the second relative time by a formula such as t5+t8. The SOC can confirm the second relative time as the current standard time of the MDC. The SOC can accumulate the crystal oscillator of its own system and maintain the time of the MDC in the SOC in combination with the value of the second relative time.

[0073] In some embodiments, the target device can use the maintained second relative time, including: after receiving sensor data related to the standard device, reading the current relative timestamp in the second relative time; binding the relative timestamp with the sensor data; and sending the sensor data bound with the relative timestamp to the application software.

[0074] In this way, the application software can efficiently use the sensor data related to the standard device and perform relevant operations on the sensor data. When the application software needs to feed back the timestamp corresponding to the sensor data to the standard device, the timestamp can be directly obtained from the sensor data.

[0075] See also Figure 5 In a practical application example, the target device may be a SOC, and the standard device may be an MDC. The target device may include a driver unit and a time service (TimerServer) unit. The target device may use the time service unit to maintain the second relative time.

[0076] The driving unit may receive sensor data related to the standard device. The driving unit may send a time query instruction to the time service unit. In response to the time query instruction, the time service unit may read the current relative timestamp in the second relative time. The time service unit may return the relative timestamp to the driving unit. The driving unit may bind the relative timestamp returned by the time service unit to the sensor data. The driving unit may send the sensor data bound with the relative timestamp to the application software.

[0077] Application software can use sensor data bound to relative timestamps. After certain data processing, the application software may need to feed back the timestamp corresponding to the sensor data to the standard device. At this time, the application software can directly obtain the feedback timestamp from the sensor data bound to the relative timestamp.

[0078] In some implementations, the method execution device may receive a feedback timestamp sent by the target device, generate a synchronization status feedback message based on the feedback timestamp, and send the synchronization status feedback message to the standard device.

[0079] Specifically, the target device can establish a communication connection with the application software. The application software can use some sensor data and obtain feedback timestamps from the sensor data. The process of the application software obtaining feedback timestamps can be referred to Figure 5 The application examples are not described here.

[0080] See also Figure 6 , the application software can send the feedback timestamp to the vehicle hardware abstraction layer (VHAL) in the target device. The vehicle hardware abstraction layer in the target device can send the feedback timestamp to the kernel in the target device. The method execution device can receive the feedback timestamp sent by the kernel through the universal asynchronous receiver and transmitter (UART). The method execution device can generate a synchronization status feedback message based on the feedback timestamp. The method execution device can send the synchronization status feedback message to the standard device.

[0081] The technical solution provided by one or more embodiments of the present disclosure can perform time synchronization with a standard device by receiving two messages. The relative time of the standard device can be maintained locally by using the result of the time synchronization. By sending two messages, time synchronization can be performed with a target device, and then the relative time of the locally maintained standard device can be synchronized to the target device.

[0082] The technical solution provided by one or more embodiments of the present disclosure, on the one hand, synchronizes the relative time of the standard device to the target device by means of transfer, and the target device no longer needs to synchronize time with the standard device directly, which can break away from the limitations of the general precision time protocol and reduce the overall cost of the time synchronization technology. On the other hand, the implementation subject of the time synchronization method can synchronize time with multiple standard devices, maintain the relative time of multiple standard devices locally, and synchronize the relative time of any standard device maintained locally with the target device, which greatly improves the scalability and compatibility of the time synchronization technology.

[0083] One or more embodiments of the present disclosure also provide a time synchronization device, which is used to implement the above method embodiments, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0084] See also Figure 7 An embodiment of the present disclosure provides a time synchronization device, characterized in that the device comprises:

[0085] A first synchronization module 100, configured to receive a first message and a second message sent by a standard device, and determine a first relative time of the standard device according to time information in the first message and the second message;

[0086] A first management module 200, configured to maintain a first relative time of the standard device based on the first relative moment;

[0087] The second synchronization module 300 is used to send a third message and a fourth message to the target device so that the target device determines the second relative time of the standard device according to the time information in the third message and the fourth message, and the second relative time is used for the target device to maintain the second relative time of the standard device.

[0088] In one embodiment, the first synchronization module 100 is specifically used to receive the first message sent by the standard device; read the first moment included in the first time information according to the first time information carried in the first message, the first moment representing a reference standard moment determined by the standard device; receive the second message sent by the standard device; read the first time difference included in the second time information according to the second time information carried in the second message, the first time difference is determined by the first moment and the second moment, the second moment representing the standard moment when the standard device completes sending the first message; determine the first relative moment of the standard device according to the first moment and the first time difference.

[0089] In one embodiment, the first synchronization module 100 is also used to record a third moment, wherein the third moment represents the moment when the first message is received; record a fourth moment, wherein the fourth moment represents the moment when the first relative moment is determined; determine a second time difference based on the third moment and the fourth moment; and jointly determine the first relative moment based on the second time difference, the first moment, and the first time difference.

[0090] In one embodiment, the second synchronization module 300 is specifically used to receive a first query instruction sent by the target device; in response to the first query instruction, send the third message to the target device, the third message carries third time information, the third time information includes a fifth moment, and the fifth moment represents a reference relative moment determined from the first relative time; after sending the third message, send the fourth message to the target device, the fourth message carries fourth time information, the fourth time information includes a third time difference, the third time difference is determined by a sixth moment and a seventh moment, the sixth moment represents a moment corresponding to the fifth moment, and the seventh moment represents the moment when the third message is sent.

[0091] In one embodiment, the target device can be used to receive sensor data related to the standard device and read the current relative timestamp in the second relative time; bind the relative timestamp to the sensor data; and send the sensor data bound to the relative timestamp to the application software.

[0092] In one embodiment, the target device includes a drive unit and a time service unit;

[0093] The driving unit is used to receive the sensor data related to the standard device; send a second query instruction to the time service unit; bind the relative timestamp returned by the time service unit to the sensor data; and send the sensor data bound with the relative timestamp to the application software;

[0094] The time service unit is configured to read the current relative timestamp in the second relative time in response to the second query instruction, and return the relative timestamp to the driving unit.

[0095] In one embodiment, the device also includes a second management module 400, which is used to receive a feedback timestamp sent by the target device and generate a synchronization status feedback message based on the feedback timestamp; send the synchronization status feedback message to the standard device; wherein the feedback timestamp is determined by application software, and the application software is in communication connection with the target device.

[0096] In one embodiment, the second management module 400 is specifically used to receive the feedback timestamp sent by the kernel in the target device; the feedback timestamp is transmitted to the kernel by the application software through the vehicle hardware abstraction layer in the target device.

[0097] The further functional description of each of the above modules is the same as that of the corresponding method embodiments above, and will not be repeated here.

[0098] The time synchronization device in this embodiment is presented in the form of a functional module, where the module refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0099] The embodiment of the present invention also provides a computer device having the above Figure 7 The time synchronization device shown.

[0100] See also Figure 8 , Figure 8 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 8As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 8 A processor 10 is taken as an example.

[0101] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0102] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0103] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0104] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0105] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0106] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0107] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0108] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

[0109] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. Similarly, in order to simplify the present invention and help understand one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, the various features of the embodiments of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. Wherein, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, wherein each claim itself is a separate embodiment of the present invention.

[0110] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and further may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive.

[0111] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.

Claims

1. A time synchronization method, characterized in that: The method comprises: Receiving a first message and a second message sent by a standard device, and determining a first relative time of the standard device according to time information in the first message and the second message; Based on the first relative moment, maintaining a first relative time of the standard device; A third message and a fourth message are sent to the target device so that the target device determines the second relative time of the standard device according to the time information in the third message and the fourth message, and the second relative time is used for the target device to maintain the second relative time of the standard device.

2. The method according to claim 1, characterized in that The receiving a first message and a second message sent by a standard device, and determining a first relative time of the standard device according to time information in the first message and the second message, includes: Receiving the first message sent by the standard device; Reading, according to the first time information carried in the first message, a first moment included in the first time information, where the first moment represents a reference standard moment determined by the standard device; receiving the second message sent by the standard device; Reading, according to the second time information carried in the second message, a first time difference contained in the second time information, where the first time difference is determined by the first moment and the second moment, and the second moment represents a standard moment when the standard device finishes sending the first message; A first relative time of the standard device is determined according to the first time and the first time difference.

3. The method according to claim 2, characterized in that The determining, according to the first moment and the first time difference, a first relative moment of the standard device includes: Recording a third time, where the third time represents a time when the first message is received; Recording a fourth moment, wherein the fourth moment represents a moment when determining the first relative moment begins; Determining a second time difference based on the third moment and the fourth moment; The first relative moment is jointly determined based on the second time difference, the first moment and the first time difference.

4. The method according to claim 1, characterized in that The sending the third message and the fourth message to the target device includes: Receiving a first query instruction sent by the target device; In response to the first query instruction, sending the third message to the target device, the third message carrying third time information, the third time information including a fifth moment, the fifth moment representing a reference relative moment determined from the first relative time; After sending the third message, the fourth message is sent to the target device, the fourth message carries fourth time information, the fourth time information includes a third time difference, the third time difference is determined by a sixth moment and a seventh moment, the sixth moment represents the moment corresponding to the fifth moment, and the seventh moment represents the moment when the third message is sent.

5. The method according to claim 1, characterized in that The target device maintains the second relative time of the standard device, including: The target device receives sensor data related to the standard device and reads a current relative timestamp in the second relative time; The target device binds the relative timestamp to the sensor data; The target device sends the sensor data bound with the relative timestamp to the application software.

6. The method according to claim 5, characterized in that The target device comprises a driving unit and a time service unit, and the target device maintains the second relative time of the standard device, including: The drive unit receives the sensor data associated with the standard equipment; The driving unit sends a second query instruction to the time service unit; In response to the second query instruction, the time service unit reads the current relative timestamp in the second relative time, and returns the relative timestamp to the driving unit; The driving unit binds the relative timestamp returned by the time service unit with the sensor data; The driving unit sends the sensor data bound with the relative timestamp to the application software.

7. The method according to claim 1, characterized in that The method further comprises: Receiving a feedback timestamp sent by the target device, and generating a synchronization status feedback message according to the feedback timestamp; Sending the synchronization status feedback message to the standard device; The feedback timestamp is determined by application software, and the application software is in communication connection with the target device.

8. The method according to claim 7, characterized in that The receiving a feedback timestamp sent by the target device includes: Receiving the feedback timestamp sent by the kernel in the target device; The feedback timestamp is transmitted by the application software to the kernel through the vehicle hardware abstraction layer in the target device.

9. A time synchronization device, characterized in that: The device comprises: A first synchronization module, configured to receive a first message and a second message sent by a standard device, and determine a first relative time of the standard device according to time information in the first message and the second message; A first management module, configured to maintain a first relative time of the standard device based on the first relative moment; The second synchronization module is used to send a third message and a fourth message to the target device, so that the target device determines the second relative time of the standard device according to the time information in the third message and the fourth message, and the second relative time is used for the target device to maintain the second relative time of the standard device.

10. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the time synchronization method described in any one of claims 1 to 8 by executing the computer instructions.