Time synchronization methods, devices, equipment and autonomous vehicles
By adjusting the sending frequency of time synchronization messages and utilizing the time difference feedback between the master and slave nodes, the number of messages is reduced, which solves the problems of large time differences and high resource consumption of controllers in autonomous vehicles and achieves efficient time synchronization.
Patent Information
- Application Number
- CN202210767825.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2042-06-30
AI Technical Summary
In autonomous vehicles, the local time of each controller is maintained by an independent clock crystal, resulting in significant time differences between different controllers, and existing time synchronization methods have high resource overhead.
The master node adjusts the sending frequency of the current time period based on the time difference of the previous time period, and uses time synchronization messages for time synchronization, reducing the dependence on follow messages and using only one frame of message for synchronization.
It reduces the resource overhead of time synchronization processing, improves the efficiency of time synchronization and the smoothness of link transmission, and ensures the consistency of time among controllers.
Smart Images

Figure CN115107792B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, specifically to the fields of autonomous driving, data processing, and system integration, and particularly to a time synchronization method, apparatus, device, and autonomous vehicle. Background Technology
[0002] The vehicle network of an autonomous vehicle typically includes multiple controllers. The local time of each controller is maintained by its own independent clock crystal oscillator. The accuracy of each clock crystal oscillator is different, and after a long period of operation, the local time of different controllers will have a large time difference.
[0003] To resolve issues caused by time inconsistencies, time synchronization is required for different controllers. Generally, the vehicle network is divided into multiple network segments, and controllers within different segments are connected through gateways. During time synchronization, the gateway's local time is used as the base time. The gateway broadcasts time synchronization messages within each network segment, and the controllers within each segment synchronize their local time to the gateway's local time based on these messages. Summary of the Invention
[0004] This disclosure provides a time synchronization method, apparatus, device, and autonomous vehicle.
[0005] According to one aspect of this disclosure, a time synchronization method is provided, applied to a master node. The method includes: if the previous time period is a normal working time period, obtaining the time difference corresponding to the previous time period, wherein the time difference is the time difference between the actual sending time and the expected sending time of the time synchronization message in the previous time period; determining the current sending frequency of the time synchronization message in the current time period based on the time difference; wherein the current sending frequency is inversely related to the time difference; and sending the time synchronization message to the slave node using the current sending frequency in the current time period to trigger the slave node to perform time synchronization processing based on the time synchronization message.
[0006] According to another aspect of this disclosure, a time synchronization method is provided, applied to a slave node, the method comprising: receiving a time synchronization message sent by a master node; wherein the time synchronization message is sent by the master node based on a current sending frequency, the current sending frequency being inversely related to the time difference corresponding to the previous time period, the time difference being the time difference between the actual sending time and the expected sending time of the time synchronization message in the previous time period; and performing time synchronization processing based on the time synchronization message.
[0007] According to another aspect of this disclosure, a time synchronization device is provided, applied to a master node. The device includes: an acquisition module, configured to acquire a time difference corresponding to the previous time period if the previous time period is a normal working time period, wherein the time difference is the time difference between the actual sending time and the expected sending time of the time synchronization message in the previous time period; a first determination module, configured to determine the current sending frequency of the time synchronization message in the current time period based on the time difference; wherein the current sending frequency is inversely related to the time difference; and a sending module, configured to send the time synchronization message to the slave node using the current sending frequency in the current time period, thereby triggering the slave node to perform time synchronization processing based on the time synchronization message.
[0008] According to another aspect of this disclosure, a time synchronization device is provided for use on a slave node. The device includes: a receiving module for receiving a time synchronization message sent by a master node; wherein the time synchronization message is sent by the master node based on a current sending frequency, the current sending frequency being inversely related to the time difference corresponding to the previous time period, and the time difference being the time difference between the actual sending time and the expected sending time of the time synchronization message in the previous time period; and a synchronization module for performing time synchronization processing based on the time synchronization message.
[0009] According to another aspect of this disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to said at least one processor; wherein the memory stores instructions executable by said at least one processor, said instructions being executed by said at least one processor to enable said at least one processor to perform the method as described in any of the foregoing aspects.
[0010] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are configured to cause the computer to perform the method according to any of the preceding aspects.
[0011] According to another aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method according to any of the preceding aspects.
[0012] According to another aspect of this disclosure, an autonomous vehicle is provided, including the electronic equipment described in any of the foregoing aspects.
[0013] According to the technical solution disclosed herein, the resource overhead of time synchronization processing can be reduced.
[0014] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0015] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0016] Figure 1 This is a schematic diagram based on the first embodiment of the present disclosure;
[0017] Figure 2 This is a schematic diagram according to the second embodiment of the present disclosure;
[0018] Figure 3 This is a schematic diagram of an application scenario corresponding to an embodiment of this disclosure;
[0019] Figure 4 This is a schematic diagram based on multiple time periods in the embodiments of this disclosure;
[0020] Figure 5 This is a schematic diagram of the triggering process for multiple time periods according to the embodiments of this disclosure;
[0021] Figure 6 This is a schematic diagram according to the third embodiment of the present disclosure;
[0022] Figure 7 This is a schematic diagram of the time information contained in the time synchronization message in an embodiment of this disclosure;
[0023] Figure 8 This is a schematic diagram illustrating the generation of an interrupt instruction based on the ACK field in an embodiment of this disclosure;
[0024] Figure 9 This is a schematic diagram according to the fourth embodiment of the present disclosure;
[0025] Figure 10 This is a schematic diagram according to the fifth embodiment of the present disclosure;
[0026] Figure 11 This is a schematic diagram according to the sixth embodiment of the present disclosure;
[0027] Figure 12 This is a schematic diagram of an electronic device used to implement the time synchronization method of the embodiments of this disclosure. Detailed Implementation
[0028] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0029] In related technologies, such as the Automotive Open System Architecture (AUTOSAR), during time synchronization, the gateway sends two messages, called a SYNC message and a FUP message. The SYNC message carries the expected transmission time, and the FUP message carries the difference between the actual transmission time and the expected transmission time. The controller to be synchronized performs synchronization based on the time information carried in the SYNC message and the FUP message.
[0030] Because two frames of messages are required to complete time synchronization, the resource overhead is relatively large.
[0031] To reduce the resource overhead of time synchronization processing, this disclosure provides the following embodiments.
[0032] Figure 1 Based on a schematic diagram of the first embodiment of this disclosure, this embodiment provides a time synchronization method. The method of this embodiment can be applied to a master node, such as... Figure 1 As shown, the method provided in this embodiment includes:
[0033] 101. If the previous time period is a normal working time period, obtain the time difference corresponding to the previous time period. The time difference is the time difference between the actual sending time and the expected sending time of the time synchronization message in the previous time period.
[0034] 102. Based on the time difference, determine the current transmission frequency of time synchronization messages within the current time period; wherein the current transmission frequency is inversely related to the time difference.
[0035] 103. During the current time period, using the current sending frequency, a time synchronization message is sent to the slave node to trigger the slave node to perform time synchronization processing based on the time synchronization message.
[0036] In this context, the master node refers to the node that provides the reference time, such as the gateway in a vehicle network.
[0037] The time synchronization process can be a continuous process. For example, when the master node is working normally, the master node will continuously send time synchronization messages to the slave node. The slave node performs time synchronization operations based on the time synchronization messages to adjust the local time of the slave node to be consistent with the local time of the master node.
[0038] The time synchronization process can be divided into multiple time periods, each with a different transmission frequency. For example, the time synchronization process may include a first time period, a second time period, and a third time period. The transmission frequency in the first time period is 5 frames / ms, in the second time period it is 3 frames / ms, and in the third time period it is 1 frame / ms. Therefore, if the current time period is the first time period, the time synchronization message will be transmitted at a frequency of 5 frames / ms.
[0039] The previous time period can be a normal working period, an abnormal working period, or a period that has not been started.
[0040] If the previous time period was a normal working period, the current transmission frequency corresponding to the current time period can be determined based on the time difference corresponding to the previous time period.
[0041] The time difference is the difference between the actual sending time and the expected sending time of a time synchronization message. For example, if the time transmission time is represented by Tx and the expected sending time is represented by tx, then the time difference = Tx - tx.
[0042] The expected sending time of a time synchronization message refers to the time when the application layer initiates the sending process; the actual sending time of a time synchronization message refers to the actual sending time at the physical layer; generally speaking, the time transmission time is later than the expected sending time.
[0043] The current transmission frequency is inversely related to the time difference; that is, the larger the time difference, the lower the current transmission frequency, and vice versa.
[0044] Once the current transmission frequency is determined, time synchronization messages for the current time period can be sent to the slave nodes using the current transmission frequency.
[0045] In this embodiment, a time synchronization message is used to trigger the slave node's time synchronization process, eliminating the need for a follow-up message frame. Therefore, each time synchronization process can be triggered by one time synchronization message frame instead of two, thus reducing the resource overhead of time synchronization processing. Furthermore, since the time difference between the actual and expected transmission times of the time synchronization message reflects the link transmission status between the master and slave nodes—generally, the more congested the link, the larger the time difference—and because the current transmission frequency is inversely related to the time difference, an appropriate transmission frequency can be used to send time synchronization messages based on the link congestion situation, balancing the transmission efficiency of time synchronization messages with the smoothness of the transmission link.
[0046] Figure 2 Based on a schematic diagram of the second embodiment of this disclosure, this embodiment provides a time synchronization method. The method of this embodiment can be applied to slave nodes, such as... Figure 2 As shown, the method provided in this embodiment includes:
[0047] 201. Receive a time synchronization message sent by the master node; wherein the time synchronization message is sent by the master node based on the current sending frequency, the current sending frequency is inversely related to the time difference corresponding to the previous time period, and the time difference is the time difference between the actual sending time and the expected sending time of the time synchronization message in the previous time period.
[0048] 202. Perform time synchronization processing based on the time synchronization message.
[0049] Here, a slave node refers to a node that needs to be synchronized, such as a controller in each segment of the vehicle network.
[0050] Slave nodes can receive time synchronization messages sent by master nodes and perform time synchronization processing based on these messages.
[0051] Specifically, for the current time period, the current transmission frequency is inversely related to the time difference of the previous time period. That is, the larger the time difference, the lower the current transmission frequency, and vice versa.
[0052] In this embodiment, the slave node performs time synchronization based on time synchronization messages, rather than on synchronization and follow messages. Therefore, each time synchronization process can be executed based on one frame of time synchronization messages instead of two frames, thereby reducing the resource overhead of time synchronization processing. Furthermore, since the time difference between the actual and expected transmission times of the time synchronization messages reflects the link transmission status between the master and slave nodes—generally, the more congested the link, the larger the time difference—and because the current transmission frequency is inversely related to the time difference, an appropriate transmission frequency can be adopted based on the link congestion situation to balance the transmission efficiency of time synchronization messages and the smoothness of the transmission link.
[0053] To better understand the embodiments of this disclosure, the application scenarios of these embodiments are described. These embodiments can be applied to the time synchronization process of autonomous vehicles.
[0054] Autonomous vehicles can include multiple controllers, such as Figure 3 As shown, multiple controllers are represented by controllers one through six. Different controllers can control different devices; for example, multiple controllers may include: body controller, powertrain controller, autonomous driving controller, in-vehicle entertainment system controller, etc.
[0055] Multiple controllers in an autonomous vehicle can be connected via a Controller Area Network (CAN) bus. Different controllers can reside in the same or different segments of the CAN bus. Controllers in different segments can all be connected to a gateway, enabling interaction between controllers in different segments.
[0056] During time synchronization, gateway 301 can be used as the master node, and each controller 302 as a slave node. Based on the time synchronization message, the local time of each controller is synchronized to the local time of the gateway. The local time of the gateway can come from the gateway's local clock crystal oscillator or from Ethernet time synchronization.
[0057] During time synchronization, the gateway can broadcast time synchronization messages on each network segment. After receiving the time synchronization messages, the controllers in each network segment perform time synchronization operations based on the time synchronization messages.
[0058] The time synchronization process is a continuous process. For example, when the master node is working normally, it will continuously send time synchronization messages to the slave nodes. The slave nodes will perform time synchronization operations based on the time synchronization messages to adjust the local time of the slave nodes to be consistent with the local time of the master node.
[0059] Since the time synchronization process is a continuous process, it can be divided into multiple time periods, and the frequency of sending time synchronization messages varies in different time periods.
[0060] In this embodiment, multiple time periods are referred to as the high-frequency phase, the mid-frequency phase, and the low-frequency phase, respectively, as an example. Figure 4 As shown, the arrows represent time synchronization messages. For time synchronization messages, the high-frequency stage has the highest transmission frequency, the low-frequency stage has the lowest transmission frequency, and the medium-frequency stage has a transmission frequency in between.
[0061] The triggering conditions for the high-frequency, mid-frequency, and low-frequency phases are different, such as... Figure 5 As shown, upon power-on, reset, or abnormal recovery, the system first enters a high-frequency phase, transmitting time synchronization messages at a higher transmission frequency. The high-frequency phase can be set for a set duration or a set number of frames. For example, setting the number of frames allows for the transmission of two time synchronization messages during the high-frequency phase. Afterward, the system determines whether to enter a mid-frequency or low-frequency phase based on the time difference (Txn) between the actual transmission time Txn and the expected transmission time txn. A smaller Txn-txn (e.g., less than 50ms) indicates entry into the mid-frequency phase, while a larger Txn-txn (e.g., greater than or equal to 50ms) indicates entry into the low-frequency phase. The mid-frequency and low-frequency phases can also be set for a set duration or a set number of frames. For example, both the mid-frequency and low-frequency phases can be set to 3 seconds. After reaching the set duration, the next phase (mid-frequency or low-frequency phase) can be determined based on Txn-txn.
[0062] In conjunction with the above application scenarios, this disclosure also provides a time synchronization method.
[0063] Figure 6 This is a schematic diagram based on the third embodiment of the present disclosure, which provides a time synchronization method.
[0064] like Figure 6 As shown, the time synchronization method provided in this embodiment includes:
[0065] 601. Master node: Determines the current sending frequency of time synchronization messages within the current time period.
[0066] Since the time synchronization process is a continuous process, it can be divided into multiple time periods, with different transmission frequencies for time synchronization messages within each period. For example, ... Figure 4 or Figure 5 As shown, it is divided into high-frequency stage, mid-frequency stage and low-frequency stage.
[0067] Specifically, if the previous time period was a normal working period, the current transmission frequency can be determined based on the time difference corresponding to the previous time period. Alternatively, if the previous time period was an abnormal working period, the current transmission frequency can be determined directly.
[0068] The normal working period refers to the time period during which time synchronization messages can be sent normally; the abnormal working period refers to the time period during which time synchronization messages cannot be sent normally, such as the power-off stage, the abnormality (e.g., CAN bus shutdown), the reset stage, etc., all of which belong to the abnormal working period.
[0069] If the previous time period was a normal working period, the current transmission frequency can be determined based on the time difference corresponding to the previous time period. Specifically, the time difference can be compared with a preset value (e.g., 50ms). If the time difference is less than the preset value, the current transmission frequency is determined to be the first frequency; if the time difference is greater than or equal to the preset value, the current transmission frequency is determined to be the second frequency. The first frequency is greater than the second frequency. For example, the first frequency is sending 10 frames every 10ms, and the second frequency is sending 5 frames every 10ms.
[0070] Combination Figure 4 or Figure 5 The first frequency refers to the transmission frequency in the intermediate frequency phase, and correspondingly, the current time period is the intermediate frequency phase; the second frequency refers to the transmission frequency in the low frequency phase, and correspondingly, the current time period is the low frequency phase.
[0071] In this embodiment, by comparing the time difference with a preset value, the current transmission frequency is determined to be either the first frequency or the second frequency based on the comparison result. This allows for a simple determination of a reasonable current transmission frequency and improves the efficiency of time synchronization processing.
[0072] Furthermore, the time difference corresponding to the previous time period can be specifically the time difference between the actual sending time and the expected sending time of the last frame of time synchronization message in the previous time period.
[0073] The above time period is the high-frequency phase. Assuming that the high-frequency phase is preset to send two time synchronization messages, the time difference between the actual sending time and the expected sending time of the second time synchronization message in the high-frequency phase can be taken as the time difference corresponding to the high-frequency phase.
[0074] In this embodiment, the time difference between the actual sending time and the expected sending time of the last frame of the time synchronization message in the previous time period is taken as the time difference corresponding to the previous time period. Since the last frame of the time synchronization message is used, compared with the method of taking the average of the time differences corresponding to each time synchronization message, it can better reflect the current link transmission status, and thus obtain a more reasonable current sending frequency.
[0075] If the previous time period was an abnormal working period, a start command for normal operation can be invoked to determine the current transmission frequency as a third frequency. This start command triggers the master node to transition from the abnormal working period to the normal working period; wherein the third frequency is greater than the first frequency. For example, the third frequency is 20 frames transmitted every 10 ms.
[0076] The normal operation start command can be a power-on command, a reset command, or an abnormal recovery command, thereby transitioning from an abnormal operating state in the previous period to a normal operating state. At this time, the current transmission frequency can be directly determined as the third frequency.
[0077] Combination Figure 4 or Figure 5 The third frequency refers to the transmission frequency in the high-frequency phase; correspondingly, the current time period is the high-frequency phase.
[0078] In this embodiment, when starting normal operation, a higher sending frequency is used to send time synchronization messages, which can quickly establish time synchronization between the master node and the slave node.
[0079] 602. The master node, within the current time period, uses the current sending frequency to send a time synchronization message to the slave node.
[0080] The number of time synchronization messages in each time period is multiple frames. The specific number can be a preset number. For example, if the current time period is a high-frequency phase, two frames of time synchronization messages can be preset to be sent. Alternatively, the specific number can be determined based on the preset duration and the current transmission frequency. For example, if the current time period is a medium-frequency or low-frequency phase, the preset duration can be 3 seconds, and the specific number can be determined based on the determined first frequency or second frequency.
[0081] For each frame of time synchronization message within the current time period, the current frame of time synchronization message can carry the actual sending time of the previous frame of time synchronization message.
[0082] For example, for the nth frame time synchronization message, it carries the actual transmission time Tx(n-1) of the (n-1)th frame time synchronization message. Here, n is a positive integer greater than or equal to 1.
[0083] In addition, the current frame time synchronization message can also carry the expected sending time of the current frame time synchronization message.
[0084] For example, see Figure 7For the nth frame time synchronization message, it carries the actual transmission time Tx(n-1) of the (n-1)th frame time synchronization message, and can also carry the expected transmission time txn of the nth frame time synchronization message. For the first frame time synchronization message, the actual transmission time of the previous frame time synchronization message it carries can be set to a fixed value, such as 0x00.
[0085] In this embodiment, the current frame time synchronization message carries the actual sending time of the previous frame time synchronization message and sends it to the slave node. The slave node can perform time synchronization processing based on the actual sending time to complete the time synchronization process.
[0086] 603. From the node, for the current frame time synchronization message, obtain the actual sending time of the previous frame time synchronization message from the current frame time synchronization message, and determine the actual receiving time of the previous frame time synchronization message.
[0087] 604. From the node, based on the actual reception time and the actual transmission time, perform time synchronization processing on the current time.
[0088] Among them, such as Figure 7 As shown, the current frame time synchronization message can be represented by the nth frame time synchronization message, the actual reception time of the current frame time synchronization message is represented by Rxn, and the actual reception time of the next frame time synchronization message is represented by Rx(n+1).
[0089] The current time is the time that is greater than or equal to Rxn and less than Rx(n+1), and can be represented by T.
[0090] For T, the calculation formula for time synchronization processing can be:
[0091] RealTime=T-Rx(n-1)+Tx(n-1).
[0092] Where T is the time to be synchronized by the slave node, which is the local time of the slave node; RealTime is the time after synchronization by T, which is the local time of the master node; Rx(n-1) is the actual reception time of the time synchronization message of the previous frame of the current frame, and Tx(n-1) is the actual transmission time of the time synchronization message of the previous frame of the current frame.
[0093] Since the nth frame time synchronization message (current frame time synchronization message) carries the actual sending time (Tx(n-1)) of the (n-1)th frame time synchronization message, the actual sending time Tx(n-1) of the previous frame time synchronization message can be obtained from the current frame time synchronization message.
[0094] After receiving each frame of time synchronization message from the node, the actual reception time of each frame of time synchronization message can be recorded, thereby obtaining the actual reception time Rx(n-1) of the previous frame of time synchronization message. Then, for T, the above calculation formula can be used for time synchronization processing.
[0095] In this embodiment, the current time can be synchronized based on the actual sending time and the actual receiving time. Compared with the comparison clock frequency method required for Ethernet time synchronization, this can reduce the amount of computation required for time synchronization and improve the efficiency of time synchronization.
[0096] The actual sending time Txn can be used during time synchronization processing, while the expected sending time txn carried in the time synchronization message can be used for other purposes.
[0097] The expected sending time txn is the time when the application layer starts sending, which the master node can know.
[0098] The actual sending and receiving times of each frame's time synchronization message can be determined based on interrupt commands.
[0099] like Figure 8 As shown, Figure 8 The field content of the time synchronization message is shown. The actual sending time and the expected sending time can both be located in the data field field. Figure 8 The fields shown are those of a CAN message conforming to the CAN protocol. For detailed explanations, please refer to the CAN protocol.
[0100] Regarding the ACK field, after receiving a time synchronization message, the slave node can toggle the ACK bit. For example, if the ACK bit is high when sent, the slave node will toggle it low after receiving the time synchronization message. Toggling the ACK bit will trigger an interrupt, generating an interrupt command. The slave node can use its local time at the time the interrupt command was generated as the actual reception time.
[0101] Based on the CAN protocol, when a slave node generates an interrupt command by flipping the ACK bit, the interrupt command can be transmitted to the master node via CAN. The master node then uses its local time at the time the interrupt command is received as the actual transmission time.
[0102] Taking Rx(n-1) and Tx(n-1) as examples, after the slave node receives the (n-1)th frame time synchronization message, it can toggle the ACK bit to generate an interrupt command, using the slave node's local time at the time the interrupt command is generated as Rx(n-1), and record Rx(n-1). Additionally, based on CAN, the master node can obtain the interrupt command generated by the slave node. The master node uses its local time at the time the interrupt command is obtained as Tx(n-1), and then sends Tx(n-1) to the slave node in the nth frame time synchronization message. When the slave node receives the nth frame time synchronization message, it can obtain Tx(n-1) from the nth frame time synchronization message, and it can also obtain Rx(n-1) from the recorded information. The slave node can then use the above calculation formula to perform time synchronization processing on the current time T based on Tx(n-1) and Rx(n-1) to obtain the synchronized time RealTime.
[0103] In this embodiment, a time synchronization message is used to trigger the slave node's time synchronization process, eliminating the need for a follow-up message frame. Therefore, each time synchronization process can be triggered by one time synchronization message frame instead of two, thus reducing the resource overhead of time synchronization processing. Furthermore, since the time difference between the actual and expected transmission times of the time synchronization message reflects the link transmission status between the master and slave nodes—generally, the more congested the link, the larger the time difference—and because the current transmission frequency is inversely related to the time difference, an appropriate transmission frequency can be used to send time synchronization messages based on link congestion, balancing the transmission efficiency of time synchronization messages with the smoothness of the transmission link. Additionally, determining the actual transmission and reception times based on the interrupt instruction generated by the ACK flip can improve the accuracy of the actual transmission and reception times, thereby improving the accuracy of the time synchronization operation.
[0104] Figure 9 Based on a schematic diagram of the fourth embodiment of this disclosure, this embodiment provides a time synchronization device. This device can be applied to a master node, such as... Figure 9 As shown, the time synchronization device 900 includes: an acquisition module 901, a first determination module 902, and a transmission module 903.
[0105] The acquisition module 901 is used to acquire the time difference corresponding to the previous time period if the previous time period is a normal working time period. The time difference is the time difference between the actual sending time and the expected sending time of the time synchronization message in the previous time period. The first determination module 902 is used to determine the current sending frequency of the time synchronization message in the current time period based on the time difference. The current sending frequency is inversely related to the time difference. The sending module 903 is used to send the time synchronization message to the slave node in the current time period using the current sending frequency to trigger the slave node to perform time synchronization processing based on the time synchronization message.
[0106] In this embodiment, a time synchronization message is used to trigger the slave node's time synchronization process, eliminating the need for a follow-up message frame. Therefore, each time synchronization process can be triggered by one time synchronization message frame instead of two, thus reducing the resource overhead of time synchronization processing. Furthermore, since the time difference between the actual and expected transmission times of the time synchronization message reflects the link transmission status between the master and slave nodes—generally, the more congested the link, the larger the time difference—and because the current transmission frequency is inversely related to the time difference, an appropriate transmission frequency can be used to send time synchronization messages based on the link congestion situation, balancing the transmission efficiency of time synchronization messages with the smoothness of the transmission link.
[0107] In some embodiments, the first determining module 902 is further configured to: if the time difference is less than a preset value, determine the current transmission frequency as a first frequency; if the time difference is greater than or equal to the preset value, determine the current transmission frequency as a second frequency; wherein the first frequency is greater than the second frequency.
[0108] In this embodiment, by comparing the time difference with a preset value, the current transmission frequency is determined to be either the first frequency or the second frequency based on the comparison result. This allows for a simple determination of a reasonable current transmission frequency and improves the efficiency of time synchronization processing.
[0109] In some embodiments, if the previous time period is an abnormal working time period, the device further includes: a second determining module, configured to determine the current sending frequency as a third frequency in response to a normal working start command, wherein the start command is used to trigger the master node to enter the normal working time period from the abnormal working time period; wherein the third frequency is greater than the first frequency.
[0110] In this embodiment, when starting normal operation, a higher sending frequency is used to send time synchronization messages, which can quickly establish time synchronization between the master node and the slave node.
[0111] In some embodiments, multiple time synchronization messages are sent within the current time period. The sending module 903 is further configured to: for the current frame time synchronization message within the current time period, carry the actual sending time of the previous frame time synchronization message in the current frame time synchronization message; and send the current frame time synchronization message to the slave node.
[0112] In this embodiment, the current frame time synchronization message carries the actual sending time of the previous frame time synchronization message and sends it to the slave node. The slave node can perform time synchronization processing based on the actual sending time to complete the time synchronization process.
[0113] In some embodiments, the acquisition module 901 is further configured to: acquire the actual sending time and expected sending time of the last frame time synchronization message in the previous time period; and use the time difference between the actual sending time and the expected sending time of the last frame time synchronization message as the time difference corresponding to the previous time period.
[0114] In this embodiment, the time difference between the actual sending time and the expected sending time of the last frame of the time synchronization message in the previous time period is taken as the time difference corresponding to the previous time period. Since the last frame of the time synchronization message is used, compared with the method of taking the average of the time differences corresponding to each time synchronization message, it can better reflect the current link transmission status, and thus obtain a more reasonable current sending frequency.
[0115] Figure 10 Based on a schematic diagram of the fifth embodiment of this disclosure, this embodiment provides a time synchronization device. This device can be applied to slave nodes, such as... Figure 10 As shown, the time synchronization device 1000 includes a receiving module 1001 and a synchronization module 1002.
[0116] The receiving module 1001 is used to receive time synchronization messages sent by the master node; wherein, the time synchronization message is sent by the master node based on the current sending frequency, the current sending frequency is inversely related to the time difference corresponding to the previous time period, and the time difference is the time difference between the actual sending time and the expected sending time of the time synchronization message in the previous time period; the synchronization module 1002 is used to perform time synchronization processing based on the time synchronization message.
[0117] In this embodiment, the slave node performs time synchronization based on time synchronization messages, rather than on synchronization and follow messages. Therefore, each time synchronization process can be executed based on one frame of time synchronization messages instead of two frames, thereby reducing the resource overhead of time synchronization processing. Furthermore, since the time difference between the actual and expected transmission times of the time synchronization messages reflects the link transmission status between the master and slave nodes—generally, the more congested the link, the larger the time difference—and because the current transmission frequency is inversely related to the time difference, an appropriate transmission frequency can be adopted based on the link congestion situation to balance the transmission efficiency of time synchronization messages and the smoothness of the transmission link.
[0118] In some embodiments, the time synchronization message is the current frame time synchronization message, and the current frame time synchronization message includes the actual sending time of the previous frame time synchronization message. The synchronization module is further used to: obtain the actual receiving time of the previous frame time synchronization message; and perform time synchronization processing on the current time based on the actual receiving time and the actual sending time.
[0119] In this embodiment, the current time can be synchronized based on the actual sending time and the actual receiving time. Compared with the comparison clock frequency method required for Ethernet time synchronization, this can reduce the amount of computation required for time synchronization and improve the efficiency of time synchronization.
[0120] It is understood that the same or similar content in different embodiments of this disclosure can be referred to each other.
[0121] It is understood that the terms "first" and "second" in the embodiments of this disclosure are only used for distinction and do not indicate the degree of importance or the order of events.
[0122] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0123] According to embodiments of this disclosure, an autonomous driving vehicle is also provided, such as... Figure 11 As shown, the autonomous vehicle 1100 includes an electronic device 1101. A description of the electronic device can be found in subsequent embodiments.
[0124] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0125] Figure 12A schematic block diagram of an example electronic device 1200 that can be used to implement embodiments of the present disclosure is shown. The electronic device 1200 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0126] like Figure 12 As shown, the electronic device 1200 includes a computing unit 1201, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1202 or a computer program loaded from a storage unit 1208 into a random access memory (RAM) 1203. The RAM 1203 may also store various programs and data required for the operation of the electronic device 1200. The computing unit 1201, ROM 1202, and RAM 1203 are interconnected via a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.
[0127] Multiple components in electronic device 1200 are connected to I / O interface 1205, including: input unit 1206, such as keyboard, mouse, etc.; output unit 1207, such as various types of displays, speakers, etc.; storage unit 1208, such as disk, optical disk, etc.; and communication unit 1209, such as network card, modem, wireless transceiver, etc. Communication unit 1209 allows electronic device 1200 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0128] The computing unit 1201 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1201 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1201 performs the various methods and processes described above, such as time synchronization methods. For example, in some embodiments, the time synchronization method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1208. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 1200 via ROM 1202 and / or communication unit 1209. When the computer program is loaded into RAM 1203 and executed by the computing unit 1201, one or more steps of the time synchronization method described above may be performed. Alternatively, in other embodiments, the computing unit 1201 may be configured to perform the time synchronization method by any other suitable means (e.g., by means of firmware).
[0129] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0130] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to the processor or controller of a general-purpose computer, special-purpose computer, or other programmable map data acquisition device, such that when executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0131] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0132] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0133] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0134] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem, addressing the shortcomings of traditional physical hosts and VPS (Virtual Private Server, or simply "VPS") services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0135] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0136] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A time synchronization method applied to a master node, the method comprising: If the previous time period is a normal working time period, obtain the time difference corresponding to the previous time period. The time difference is the time difference between the actual sending time and the expected sending time of the time synchronization message in the previous time period. Based on the time difference, the current transmission frequency of time synchronization messages within the current time period is determined; wherein, the current transmission frequency is inversely related to the time difference. During the current time period, a time synchronization message is sent to the slave node using the current sending frequency, thereby triggering the slave node to perform time synchronization processing based on the time synchronization message; Determining the current transmission frequency of time synchronization messages within the current time period based on the time difference includes: If the time difference is less than a preset value, the current transmission frequency is determined to be the first frequency; If the time difference is greater than or equal to the preset value, the current transmission frequency is determined to be the second frequency; Wherein, the first frequency is greater than the second frequency; If the previous time period is an abnormal working period, the method further includes: In response to a normal operation start command, the current transmission frequency is determined to be a third frequency. The start command is used to trigger the master node to enter a normal operation period from the abnormal operation period. The third frequency is greater than the first frequency.
2. The method according to claim 1, wherein, Sending multiple time synchronization messages within the current time period, including sending time synchronization messages to slave nodes, includes: For the current frame time synchronization message within the current time period, the actual sending time of the previous frame time synchronization message is carried in the current frame time synchronization message; The current frame time synchronization message is sent to the slave node.
3. The method according to any one of claims 1-2, wherein, The step of obtaining the time difference corresponding to the previous time period includes: Obtain the actual and expected transmission times of the last frame of time synchronization message within the previous time period; The time difference between the actual sending time and the expected sending time of the last frame time synchronization message is taken as the time difference corresponding to the previous time period.
4. A time synchronization method applied to a slave node, comprising: The system receives time synchronization messages sent by the master node. These messages are sent by the master node based on a current sending frequency, which is inversely related to the time difference in the previous time period. The time difference is the difference between the actual sending time and the expected sending time of the time synchronization messages in the previous time period. The current sending frequency is determined as follows: if the previous time period is a normal working period and the time difference is less than a preset value, the current sending frequency is determined to be a first frequency; if the previous time period is a normal working period and the time difference is greater than or equal to the preset value, the current sending frequency is determined to be a second frequency; if the previous time period is an abnormal working period, in response to a normal working start command, the current sending frequency is determined to be a third frequency, where the start command triggers the master node to transition from the abnormal working period to the normal working period. The first frequency is greater than the second frequency, and the third frequency is greater than the first frequency. Time synchronization processing is performed based on the time synchronization message.
5. The method according to claim 4, wherein, The time synchronization message is the current frame time synchronization message, and the current frame time synchronization message contains the actual transmission time of the previous frame time synchronization message. The time synchronization processing based on the time synchronization message includes: Obtain the actual reception time of the previous frame time synchronization message; Based on the actual reception time and the actual transmission time, the current time is synchronized.
6. A time synchronization device applied to a master node, the device comprising: The acquisition module is used to acquire the time difference corresponding to the previous time period if the previous time period is a normal working time period. The time difference is the time difference between the actual sending time and the expected sending time of the time synchronization message in the previous time period. The first determining module is used to determine the current transmission frequency of time synchronization messages within the current time period based on the time difference; wherein the current transmission frequency is inversely related to the time difference; The sending module is used to send a time synchronization message to the slave node at the current sending frequency within the current time period, so as to trigger the slave node to perform time synchronization processing based on the time synchronization message; The first determining module is further configured to: If the time difference is less than a preset value, the current transmission frequency is determined to be the first frequency; If the time difference is greater than or equal to the preset value, the current transmission frequency is determined to be the second frequency; Wherein, the first frequency is greater than the second frequency; If the previous time period was an abnormal working period, the device further includes: The second determining module is used to determine the current transmission frequency as a third frequency in response to a normal operation start command. The start command is used to trigger the master node to enter the normal operation period from the abnormal operation period. The third frequency is greater than the first frequency.
7. The apparatus according to claim 6, wherein, The sending module is further configured to: send multiple time synchronization messages within the current time period. For the current frame time synchronization message within the current time period, the actual sending time of the previous frame time synchronization message is carried in the current frame time synchronization message; The current frame time synchronization message is sent to the slave node.
8. The apparatus according to any one of claims 6-7, wherein, The acquisition module is further used for: Obtain the actual and expected transmission times of the last frame of time synchronization message within the previous time period; The time difference between the actual sending time and the expected sending time of the last frame time synchronization message is taken as the time difference corresponding to the previous time period.
9. A time synchronization device applied to a slave node, the device comprising: A receiving module is used to receive time synchronization messages sent by the master node. The time synchronization messages are sent by the master node based on a current sending frequency, which is inversely related to the time difference in the previous time period. The time difference is the difference between the actual sending time and the expected sending time of the time synchronization messages in the previous time period. The current sending frequency is determined as follows: if the previous time period is a normal working period and the time difference is less than a preset value, the current sending frequency is determined to be a first frequency; if the previous time period is a normal working period and the time difference is greater than or equal to the preset value, the current sending frequency is determined to be a second frequency; if the previous time period is an abnormal working period, in response to a normal working start command, the current sending frequency is determined to be a third frequency, whereby the start command triggers the master node to transition from the abnormal working period to the normal working period. The first frequency is greater than the second frequency, and the third frequency is greater than the first frequency. The synchronization module is used to perform time synchronization processing based on the time synchronization message.
10. The apparatus according to claim 9, wherein, The time synchronization message is the current frame time synchronization message, and the current frame time synchronization message contains the actual sending time of the previous frame time synchronization message. The synchronization module is further used for: Obtain the actual reception time of the previous frame time synchronization message; Based on the actual reception time and the actual transmission time, the current time is synchronized.
11. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5.
12. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-5.
13. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-5.
14. An autonomous vehicle, including the electronic equipment as claimed in claim 11.
Citation Information
Patent Citations
Clock synchronization method and device, equipment and storage medium
CN113691339A