A clock synchronization system and method
Through the combination of global synchronization module and local synchronization module, the clock signal and square wave signal of navigation equipment are used to realize high-precision clock synchronization in the on-board computing system, solving the problems of clock synchronization accuracy and cost in the existing technology, and realizing the Submillisecond clock synchronization effect.
Patent Information
- Application Number
- CN202411187907.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-08-28
AI Technical Summary
The prior art is difficult to achieve high-precision clock synchronization without the need for gateway support in on-board computing systems, and traditional network clock protocols cannot guarantee the accuracy of clock synchronization.
Using a combination scheme of global synchronization module and local synchronization module, the clock signal of the navigation device realizes clock synchronization of the global computing device, and uses square wave signals to perform clock synchronization to ensure that different local computing devices process from the same time at the same time. Sensor signal.
The submillisecond-level clock synchronization is achieved without the participation of the gateway, which circumvents expensive gateway authorization fees and avoids clock jitter caused by network fluctuations, improving the practicality and accuracy of the system.
Smart Images

Figure CN118713786B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of autonomous driving technology, and in particular to a clock synchronization system and method. Background Art
[0002] The computing power required by the on-board computing system is about 100 trillion operations per second. At present, it is difficult for edge computing devices and single devices to achieve such high computing power, so polymorphic devices are generally required to work together. At the same time, in order to perceive more information, the number of sensors required has also increased dramatically. Multiple computing devices collaborate to calculate and process signals from multiple different sensors. A common clock reference is required to ensure that different computing devices process sensor signals from the same time at the same time to prevent confusion in the output results. The traditional solution for clock synchronization requires the support of a gateway, which is easily affected by the network status, and the gateway that supports the precision time protocol requires expensive licensing fees to use. The synchronization solution using the network clock protocol can save costs but cannot guarantee the accuracy of clock synchronization.
[0003] It can be seen that how to achieve high-precision clock synchronization without the need for gateway support is a problem that technical personnel in this field need to solve. Summary of the invention
[0004] The purpose of the embodiments of the present invention is to provide a clock synchronization system and method, which can achieve high-precision clock synchronization without the support of a gateway.
[0005] In order to solve the above technical problems, an embodiment of the present invention provides a clock synchronization system, comprising a global synchronization module and a local synchronization module; the global synchronization module comprises a global computing device; the local synchronization module comprises a first local computing device communicating with a trigger type sensor and a second local computing device communicating with a non-trigger type sensor;
[0006] The global synchronization module is connected to the navigation device and the local synchronization module respectively, and is used to realize the clock synchronization of the global computing device according to the clock signal of the navigation device; and sends a square wave signal containing a timestamp to the local synchronization module;
[0007] The local synchronization module is used to receive the square wave signal sent by the global synchronization module; and to reset the system clock of the local synchronization module according to the timestamp contained in the square wave signal;
[0008] The first local computing device is used to send a trigger signal to the trigger sensor and start timing according to the set pulse width when capturing the rising edge pulse signal of the square wave signal, so that the trigger sensor starts to collect data according to the trigger signal and transmits the data to the first local computing device connected thereto; when the timing time reaches the set threshold, stop sending the trigger signal;
[0009] The second local computing device is used to use its own system clock as a clock source for the non-trigger type sensor connected thereto, so as to receive data transmitted by the non-trigger type sensor at its own frequency.
[0010] On the one hand, the local synchronization module is used to receive the square wave signal sent by the global synchronization module; when the rising edge pulse signal of the square wave signal is captured, the system clock is cleared; the square wave signal is solved to obtain the timestamp; based on the timestamp and the solution time of the square wave signal, the system clock of the local synchronization module is reset.
[0011] On the one hand, the local synchronization module is used to use the sum of the timestamp and the solution time of the square wave signal as the system clock of the local synchronization module.
[0012] On the one hand, the global synchronization module is used to construct a square wave signal corresponding to the timestamp of the next moment after realizing the clock synchronization of the global computing device; when the current time reaches the next moment, the square wave signal is sent to the local synchronization module.
[0013] On the one hand, the global synchronization module is used to record the square wave signal corresponding to the constructed next moment timestamp into a set cache area; when the current time reaches the next moment, the square wave signal is read from the cache area and sent to the local synchronization module.
[0014] On the one hand, the global synchronization module is used to calculate the verification signal corresponding to the next time stamp according to the set verification method; and encapsulate the next time stamp and the verification signal into a square wave signal according to the set square wave signal format.
[0015] On the one hand, the local synchronization module is used to calculate the actual verification signal corresponding to the timestamp according to the set verification method after solving the square wave signal to obtain the timestamp; determine whether the actual verification signal is consistent with the verification signal carried by the square wave signal; when the actual verification signal is consistent with the verification signal carried by the square wave signal, execute the step of resetting the system clock of the local synchronization module based on the timestamp and the solution time of the square wave signal; when the actual verification signal is inconsistent with the verification signal carried by the square wave signal, obtain a new square wave signal from the global synchronization module.
[0016] On the one hand, the local synchronization module is used to switch its own state to the synchronization state when the rising edge pulse signal of the square wave signal is captured, so as to no longer respond to other square wave signals; after completing the reset of the system clock, it switches its own state to the standby state to respond to the square wave signal.
[0017] On the one hand, the first local computing device is used to switch its own state to the sending state when the rising edge pulse signal of the square wave signal is captured, so as to send a trigger signal to the trigger sensor according to the set pulse width; when the timing time reaches the set threshold, the device switches its own state to the standby state to stop sending the trigger signal.
[0018] On the one hand, the first local computing device is used to switch its own state to the sending state when the rising edge pulse signal of the square wave signal is captured; when the difference between the trigger signal sending time closest to the current time and the square wave signal receiving time is greater than a set threshold, switch its own state to the standby state.
[0019] On the one hand, the local synchronization module is used to determine whether the data transmitted by various sensors all carry timestamps when receiving the data transmitted by various sensors;
[0020] When the data transmitted by the target sensor does not carry a timestamp, the current system time of the local computing device communicating with the target sensor is used as the timestamp of the data.
[0021] On the one hand, the local synchronization module is used to modify the timestamps carried by the data transmitted by various sensors using the sensor transmission delay database; wherein the sensor transmission delay database records the transmission delays corresponding to each type of sensor.
[0022] On the one hand, the local synchronization module is used to determine whether the timestamp carried by the data transmitted by various sensors belongs to the signal collection time; when the timestamp carried by the data transmitted by the target sensor does not belong to the signal collection time, query the target transmission delay matching the target sensor from the sensor transmission delay database; according to the target transmission delay, correct the timestamp carried by the data transmitted by the target sensor.
[0023] On the one hand, the local synchronization module is used to use the difference between the timestamp carried by the data transmitted by the target sensor and the target transmission delay as the corrected timestamp.
[0024] In one aspect, the local synchronization module includes a plurality of local computing devices, each of which has its corresponding message queue;
[0025] The local computing device is used to put the data transmitted by the sensor connected to it into its corresponding message queue.
[0026] On the one hand, the local synchronization module is used to perform a rolling search on the data in each message queue according to a set time window, so as to select the data of all sensors within the time window and send it to the application software.
[0027] On the one hand, the trigger sensor includes a camera; the first local computing device is connected to the camera via a deserializer and a serializer.
[0028] On the one hand, the non-trigger sensor includes a laser radar; the second local computing device is connected to the laser radar via an Ethernet interface.
[0029] On the one hand, the global synchronization module includes a signal receiving interface, a global computing device and a signal sending interface; wherein the signal receiving interface includes a GPRMC interface and a second pulse signal interface for time synchronization; and the signal sending interface includes a square wave signal sending interface.
[0030] The embodiment of the present invention further provides a clock synchronization method, which is applicable to a local synchronization module, and the method includes:
[0031] Receive a square wave signal sent by a global synchronization module; wherein the square wave signal is a square wave signal containing a timestamp generated by the global synchronization module after the global synchronization module realizes clock synchronization of the global computing device according to the clock signal of the navigation device;
[0032] Resetting the system clock according to the timestamp included in the square wave signal;
[0033] When the rising edge pulse signal of the square wave signal is captured, a trigger signal is sent to the trigger sensor according to the set pulse width and timing is started, so that the trigger sensor starts to collect data according to the trigger signal and transmits the data to the local computing device connected thereto;
[0034] When the timing reaches the set threshold, stop sending the trigger signal;
[0035] The system clock of the device is used as the clock source of the non-trigger type sensor connected to it, so as to receive the data transmitted by the non-trigger type sensor according to its own frequency.
[0036] It can be seen from the above technical solution that the clock synchronization system includes a global synchronization module and a local synchronization module; the local synchronization module includes a first local computing device that communicates with a trigger sensor and a second local computing device that communicates with a non-trigger sensor. The global synchronization module is connected to the navigation device and the local synchronization module respectively, and is used to realize the clock synchronization of the global computing device according to the clock signal of the navigation device; in order to realize the time synchronization with each device in the local synchronization module, the global synchronization module sends a square wave signal containing a timestamp to the local synchronization module. The local synchronization module receives the square wave signal sent by the global synchronization module; according to the timestamp contained in the square wave signal, the system clock of the local synchronization module is reset. The local synchronization module includes multiple local computing devices, and the types of sensors connected to different local computing devices are different. In order to ensure that different local computing devices process sensor data from the same time at the same time, the first local computing device is used to send a trigger signal to the trigger sensor and start timing according to the set pulse width when the rising edge pulse signal of the square wave signal is captured, so that the trigger sensor starts to collect data according to the trigger signal and transmits data to the first local computing device connected to it; when the timing time reaches the set threshold, stop sending the trigger signal. The second local computing device is used to use its own system clock as the clock source of the non-trigger type sensor connected to it, so as to receive the data transmitted by the non-trigger type sensor according to its own frequency. The beneficial effect of the present invention is that the global synchronization module can realize the clock synchronization between the global synchronization module and the local synchronization module by sending a square wave signal to the local synchronization module. Different local computing devices set a corresponding data acquisition mode according to the type of sensor connected to them to obtain the sensor data at the same time. The square wave signal is transmitted through a single signal line for multi-device synchronization, which avoids the expensive gateway authorization fee and the clock jitter caused by network fluctuations. Sub-millisecond clock synchronization can be achieved without the participation of the gateway. The clock synchronization is guaranteed by the collaborative work of software and hardware. Even if the global synchronization module fails to communicate with the navigation device normally, the clock synchronization within the domain can be guaranteed. The square wave signal uses a fixed rising edge frame header, taking into account the triggering and signal transmission, so that the signal can be used for the clock synchronization of the computing device and the triggering of the sensor at the same time, which greatly reduces the complexity of the system and improves the practicality. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1A schematic diagram of the structure of a clock synchronization system provided by an embodiment of the present invention;
[0039] Figure 2 A schematic diagram of a square wave signal provided by an embodiment of the present invention;
[0040] Figure 3 A schematic diagram of the hardware architecture of a clock synchronization system provided by an embodiment of the present invention;
[0041] Figure 4 A flowchart of a clock synchronization method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0043] The terms "including" and "having" in the specification of the present invention and the above-mentioned drawings, as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may include steps or units that are not listed.
[0044] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0045] Autonomous driving is a technology that uses computers and sensors to enable cars or other types of vehicles to drive independently on the road and perform driving tasks. As the computing power requirements of autonomous driving technology increase, polymorphic devices are generally required to work together. At the same time, in order to perceive more information, the number of sensors required has also increased dramatically. In order to ensure that different devices process sensor signals from the same time at the same time, a common clock reference is required. There are currently two ways to achieve clock synchronization, one is based on the Precision Time Protocol (PTP) clock synchronization method, and the other is based on the Network Time Protocol (NTP) clock synchronization method. However, automotive-grade gateways that support PTP usually require expensive licensing fees and have certain economic thresholds. NTP is affected by network fluctuations and is not accurate enough.
[0046] Therefore, the embodiments of the present invention provide a clock synchronization system and method, which uses a single signal line to transmit square wave signals for multi-device synchronization, avoiding expensive gateway authorization fees and clock jitter caused by network fluctuations. Sub-millisecond clock synchronization can be achieved without the participation of a gateway.
[0047] Both the global synchronization module and the local synchronization module include computing devices that need to achieve clock synchronization. For ease of distinction, the computing devices included in the global synchronization module can be called global computing devices, and the computing devices included in the local synchronization module can be called local computing devices.
[0048] Different local computing devices are connected to different types of sensors. In an embodiment of the present invention, sensors that require a trigger signal to collect data can be classified as trigger sensors. Sensors that can automatically collect data without a trigger signal are classified as non-trigger sensors. For ease of distinction, a local computing device connected to a trigger sensor can be referred to as a first local computing device, and a local computing device connected to a non-trigger sensor can be referred to as a second local computing device.
[0049] Next, a clock synchronization system provided by an embodiment of the present invention is described in detail. Figure 1 A structural diagram of a clock synchronization system provided in an embodiment of the present invention, the system includes a global synchronization module 11 and a local synchronization module 12; the local synchronization module 12 includes a first local computing device 121 that communicates with a trigger type sensor and a second local computing device 122 that communicates with a non-trigger type sensor.
[0050] In the embodiment of the present invention, the global synchronization module 11 may include a signal receiving interface, a global computing device, and a signal sending interface.
[0051] The navigation device may adopt integrated navigation. Integrated navigation refers to a navigation system that integrates various navigation devices and is controlled by a monitor and a computer. The satellite signals generated by the integrated navigation may include the pulse per second signal (PPS) based on the Global Positioning System (GPS) and the Global Positioning System Recommended Minimum Navigation Information (GPRMC).
[0052] Based on the form of the satellite signal transmitted by the navigation device, the signal receiving interface may include a GPRMC interface and a PPS interface.
[0053] Global computing devices refer to devices with processing computing capabilities, such as central processing units (CPUs).
[0054] A square wave signal is used to transmit the timestamp, so the signal sending interface may include a square wave signal sending interface.
[0055] The global synchronization module 11 is connected to the navigation device and the local synchronization module 12 respectively, and is used to realize the clock synchronization of the global computing device according to the clock signal of the navigation device; and send a square wave signal containing a timestamp to the local synchronization module 12.
[0056] The local synchronization module 12 is used to receive the square wave signal sent by the global synchronization module 11; and reset the system clock of the local synchronization module 12 according to the timestamp included in the square wave signal.
[0057] The starting position of the square wave signal is fixed to the rising edge of the pulse. Therefore, when the local synchronization module 12 captures the rising edge pulse signal of the square wave signal, it clears the system clock; solves the square wave signal to obtain a timestamp; and resets the system clock of the local synchronization module 12 based on the timestamp and the solution time of the square wave signal.
[0058] The timestamp can be a binary timestamp in Coordinated Universal Time (UTC) accurate to the second.
[0059] In practical applications, the local synchronization module 12 may use the sum of the timestamp and the calculation time of the calculated square wave signal as the system clock of the local synchronization module 12 .
[0060] The square wave signal carries a timestamp. By solving the square wave signal, the timestamp can be obtained, and the timestamp is counted as tu, and the solving time of the square wave signal is counted as t0, then the system clock is reset to tu+t0.
[0061] In the embodiment of the present invention, all computing devices included in the local synchronization module 12 are collectively referred to as local computing devices. The number of local computing devices may be multiple; the types of local computing devices may be multiple, for example, a field programmable gate array (FPGA), a complex programmable logic device (CPLD) and a microcontroller unit (MCU) may all be used as local computing devices.
[0062] The first local computing device 121 is used to send a trigger signal to the trigger sensor and start timing according to the set pulse width when capturing the rising edge pulse signal of the square wave signal, so that the trigger sensor starts to collect data according to the trigger signal and transmits the data to the first local computing device 121 connected thereto; when the timing time reaches the set threshold, stop sending the trigger signal.
[0063] In the embodiment of the present invention, the computing devices connected to the trigger sensors are collectively referred to as the first local computing devices 121. Considering that there are many types of trigger sensors, a corresponding first local computing device 121 can be set for each type of trigger sensor, so there can be multiple first local computing devices 121.
[0064] Different trigger sensors implement different functions and may have different triggering methods. The first local computing device 121 connected to different types of trigger sensors needs to implement different functions. Based on the different functions to be implemented, there can be multiple types of first local computing devices 121.
[0065] In practical applications, different first local computing devices 121 may be connected to different types of trigger sensors. The same first local computing device 121 may be connected to multiple trigger sensors of the same type at the same time. If the first local computing device 121 can simultaneously control multiple types of trigger sensors, the first local computing device 121 may be connected to multiple different types of trigger sensors at the same time.
[0066] The second local computing device 122 is used to use its own system clock as a clock source for the non-trigger type sensor connected thereto, so as to receive data transmitted by the non-trigger type sensor at its own frequency.
[0067] For non-trigger sensors that do not require trigger signals, in order to enable multiple non-trigger sensors to collect data at the same time, the second local computing device 122 can use its own system clock as the clock source for the non-trigger sensors connected to it, thereby ensuring the clock synchronization of multiple non-trigger sensors.
[0068] The first local computing device 121 and the second local computing device 122 may be different local computing devices. It should be noted that if a local computing device can simultaneously control trigger sensors and non-trigger sensors, the local computing device can be used as both the first local computing device 121 and the second local computing device 122, that is, the first local computing device 121 and the second local computing device 122 may also be the same local computing device.
[0069] The global synchronization module 11 realizes clock synchronization between the global synchronization module 11 and the local synchronization module 12 by transmitting a square wave signal to the local synchronization module 12. In practical applications, the global synchronization module 11 can construct a square wave signal corresponding to the timestamp of the next moment after realizing the clock synchronization of the global computing device; and send a square wave signal to the local synchronization module 12 when the current time reaches the next moment.
[0070] Considering that after the square wave signal is constructed, it is necessary to send the square wave signal to the local synchronization module 12 when the current time reaches the next moment, the global synchronization module 11 can first record the square wave signal corresponding to the constructed next moment timestamp to the set cache area after constructing the square wave signal; when the current time reaches the next moment, the square wave signal is read from the cache area and sent to the local synchronization module 12.
[0071] For example, the global computing device can calculate the square wave waveform corresponding to the timestamp of the next full second (t1) at the current moment, encapsulate the square wave waveform into a square wave signal and put it into the sending buffer area for sending. When the waiting time reaches the moment t1, the square wave signal is sent out. If the moment t1 has passed when the square wave signal is encapsulated, the square wave waveform corresponding to the timestamp of the next full second is recalculated until the square wave signal can be sent. The global computing device can send the square wave signal to all local computing devices of the local synchronization module 12 at the same time.
[0072] In the embodiment of the present invention, in order to ensure the reliability of data transmission, verify the integrity of data during transmission, and provide an error detection and correction mechanism when possible, when constructing a square wave signal, a check segment can be set for the square wave waveform corresponding to the timestamp.
[0073] The global synchronization module 11 can calculate the verification signal corresponding to the next time stamp according to the set verification method; and encapsulate the next time stamp and the verification signal into a square wave signal according to the set square wave signal format.
[0074] The square wave signal format includes 4 fields, namely the trigger segment, content segment, check segment and end segment. Among them, the trigger segment is the frame header of the square wave signal, and the end segment is the frame tail of the square wave signal. The content of the frame header and the frame tail is fixed and can occupy 1 byte each. The content segment is used to record the UTC binary timestamp and occupies 4 bytes. The check segment records the byte code of the check signal and occupies 1 byte.
[0075] In practical applications, the verification formula can be:
[0076] ;
[0077] Among them, C represents the byte code of the check signal, P nIndicates the content segment of the nth byte, 0XFF means taking the lower eight bits, and & represents the AND operator.
[0078] Considering that the maximum bandwidth of the IO pin of the global computing device is 13 MHz, a square wave signal can be sent at a frequency of 1 MHz.
[0079] Figure 2 A schematic diagram of a square wave signal provided for an embodiment of the present invention, the square wave signal includes four parts: a frame header, a content segment, a check segment and a frame tail. The pulse widths of the frame header and the frame tail are consistent. The content segment must carry timestamp information, which may cause the pulse width to be inconsistent with the pulse widths of the frame header and the frame tail. Figure 2 The figure is only an illustration and does not limit the specific pulse width of the square wave signal.
[0080] After solving the square wave signal to obtain the timestamp, the local synchronization module 12 can calculate the actual verification signal corresponding to the timestamp according to the set verification method; and determine whether the actual verification signal is consistent with the verification signal carried by the square wave signal.
[0081] When the actual verification signal is consistent with the verification signal carried by the square wave signal, it indicates that the square wave signal has not been tampered with. At this time, the step of resetting the system clock of the local synchronization module 12 based on the timestamp and the solution time of the square wave signal can be executed.
[0082] When the actual verification signal is inconsistent with the verification signal carried by the square wave signal, it means that the square wave signal may be maliciously tampered with. If clock synchronization is performed according to the calculated timestamp, there will be errors. At this time, a new square wave signal can be obtained from the global synchronization module 11.
[0083] In the embodiment of the present invention, by setting a check segment in the square wave signal, the local synchronization module can check the correctness of the timestamp carried by the square wave signal after receiving it, thereby ensuring that the correct timestamp can be obtained, thereby completing the setting of clock synchronization and ensuring the stability and accuracy of the communication system. When the timestamp fails to pass the check, a new square wave signal can be obtained again, avoiding the misleading of the system clock synchronization by the wrong timestamp.
[0084] In the embodiment of the present invention, each local computing device in the local synchronization module 12 can work as a state machine during the synchronization process, which corresponds to two working states, namely, the synchronization state and the standby state. In the synchronization state, the local computing device only responds to the currently received square wave signal and no longer responds to other square wave signals. In the standby state, the system clock is not reset.
[0085] In actual applications, when the local synchronization module 12 captures the rising edge pulse signal of the square wave signal, it can switch its own state to the synchronization state so as to no longer respond to other square wave signals; after completing the reset of the system clock, it can switch its own state to the standby state so as to respond to the square wave signal.
[0086] After completing the reset of the system clock, each local computing device in the local synchronization module 12 can synchronize the clock of the sensor connected to the controller.
[0087] To facilitate distinguishing different types of local computing devices, the local computing device connected to the trigger type sensor may be referred to as the first local computing device 121 , and the local computing device connected to the non-trigger type sensor may be referred to as the second local computing device 122 .
[0088] When the first local computing device 121 captures the rising edge pulse signal of the square wave signal, it can switch its own state to the sending state so as to send a trigger signal to the trigger sensor according to the set pulse width; when the timing time reaches the set threshold, it can switch its own state to the standby state so as to stop sending the trigger signal.
[0089] In practical applications, the corresponding pulse widths can be set for different types of trigger sensors.
[0090] When the first local computing device 121 is in the sending state, it can send a trigger signal to the trigger sensor according to the pulse width corresponding to the trigger sensor.
[0091] In the embodiment of the present invention, in addition to switching its own state to the standby state when the timing time reaches the set threshold, the first local computing device 121 may also switch its own state to the standby state when the difference between the time when the trigger signal is sent and the time when the square wave signal is received, which is closest to the current time, is greater than the set threshold.
[0092] In practical applications, the standby state can be entered when the following formula is satisfied:
[0093] ;
[0094] Among them, t p Indicates the trigger signal sending time closest to the current time, t s represents the arrival time of the square wave signal, t represents the set threshold, and t c Indicates the time when the last trigger signal was sent, t c+1 Indicates the time when the trigger signal is to be sent next time, t n Indicates the moment when the square wave signal is received. The threshold value is set to be smaller than the square wave signal sending interval, and can be set to half of the trigger signal period.
[0095] Considering that in actual applications, data transmitted by some types of sensors do not carry timestamps, such as data transmitted by cameras, in order to ensure that the local synchronization module 12 can obtain data from different sensors at the same time, the data without timestamps can be supplemented with timestamps.
[0096] When receiving data transmitted by various sensors, the local synchronization module 12 can determine whether the data transmitted by various sensors all carry a timestamp.
[0097] When the data transmitted by the target sensor does not carry a timestamp, the current system time of the local computing device communicating with the target sensor may be used as the timestamp of the data.
[0098] The timestamp carried in the data transmitted by the sensor is generally the time when the data was collected. Since the data without a timestamp is supplemented with a timestamp, and the supplemented timestamp is often the time when the data arrives at the local computing device. In order to make the timestamps corresponding to various sensor data reflect the data collection time, the timestamp can be corrected.
[0099] In the embodiment of the present invention, a sensor transmission delay database may be established in advance, and the transmission delay corresponding to each type of sensor may be recorded in the sensor transmission delay database. The transmission delay indicates the transmission time of data from the sensor to the local computing device.
[0100] The local synchronization module 12 can use the sensor transmission delay database to correct the timestamps carried by the data transmitted by various sensors.
[0101] In a specific implementation, the local synchronization module 12 can determine whether the timestamp carried by the data transmitted by various sensors belongs to the signal collection moment.
[0102] When the timestamp carried by the data transmitted by the target sensor does not belong to the signal acquisition time, it means that the timestamp may be a supplemented timestamp. The timestamp is often the time when the data arrives at the local computing device. In order to correct the timestamp, the target transmission delay matched by the target sensor can be queried from the sensor transmission delay database; according to the target transmission delay, the timestamp carried by the data transmitted by the target sensor is corrected.
[0103] A specific correction method may be to use the difference between the timestamp carried by the data transmitted by the target sensor and the target transmission delay as the corrected timestamp.
[0104] For example, assume that the timestamp carried by the data transmitted by the target sensor is the time when it arrives at the local computing device, using t oThe transmission delay corresponding to the target sensor is t d , then the corrected timestamp is t o -t d .
[0105] In the embodiment of the present invention, the sensor transmission delay database is used to implement the correction of the timestamps of various sensors at the software level, thereby further improving the quality of clock synchronization.
[0106] The local synchronization module 12 includes a plurality of local computing devices, each of which has its corresponding message queue; the local computing device can put the data transmitted by the sensor connected thereto into its corresponding message queue.
[0107] The local synchronization module 12 can perform a rolling search on the data in each message queue according to a set time window, so as to select the data of all sensors within the time window and send it to the application software.
[0108] In actual applications, a rolling search of data can be performed by each local computing device according to a set time window to perform a rolling search on the data in its corresponding message queue, so as to select the data within the time window and send it to the application software, so that the application software can perform subsequent analysis and processing on the synchronized data.
[0109] By synchronously filtering and screening the data collected by the sensor at the software level, only the synchronized data is retained, which greatly reduces the amount of invalid signal transmission and improves communication efficiency.
[0110] In practical applications, the trigger sensor may include a camera; the first local computing device 121 is connected to the camera via a deserializer and a serializer.
[0111] The non-trigger type sensor includes a laser radar; the second local computing device 122 is connected to the laser radar via an Ethernet interface. In addition to the laser radar, common non-trigger type sensors also include millimeter wave radars, etc. The second local computing device 122 can be connected to the millimeter wave radar via a controller area network (CAN) interface.
[0112] Figure 3 A schematic diagram of the hardware architecture of a clock synchronization system provided by an embodiment of the present invention. A plurality of computing devices are included in the controller, and the computing devices can communicate with each other via Ethernet. Based on the different functions to be implemented, the computing devices connected to the navigation device can be divided into global computing devices, and the remaining computing devices are all local computing devices. Figure 3 In the figure, four local computing devices are taken as an example. In actual applications, the number of local computing devices may be more or less, and is not limited here.
[0113] There are many types of sensors, which can be divided into two categories: trigger sensors and non-trigger sensors. Common trigger sensors include cameras, and common non-trigger sensors include lidar. For cameras, there can be multiple cameras. Figure 3 In this example, two cameras are used. A computing device can connect to the camera through a deserializer and a serializer. Among them, a deserializer can be connected to multiple serializers at the same time, and each serializer is connected to a camera. The computing device can send a trigger signal to the deserializer, which is processed by the deserializer and the serializer to finally trigger the camera to start collecting data. In addition to cameras, there are other trigger sensors, which are not limited here. For non-trigger sensors, the computing device can connect to the non-trigger sensors through the corresponding interface. For example, a computing device in the local synchronization module can connect to the lidar through the Ethernet interface, and another computing device can connect to other sensors through other interfaces.
[0114] It can be seen from the above technical solution that the clock synchronization system includes a global synchronization module and a local synchronization module; the local synchronization module includes a first local computing device that communicates with a trigger sensor and a second local computing device that communicates with a non-trigger sensor. The global synchronization module is connected to the navigation device and the local synchronization module respectively, and is used to realize the clock synchronization of the global computing device according to the clock signal of the navigation device; in order to realize the time synchronization with each device in the local synchronization module, the global synchronization module sends a square wave signal containing a timestamp to the local synchronization module. The local synchronization module receives the square wave signal sent by the global synchronization module; according to the timestamp contained in the square wave signal, the system clock of the local synchronization module is reset. The local synchronization module includes multiple local computing devices, and the types of sensors connected to different local computing devices are different. In order to ensure that different local computing devices process sensor data from the same time at the same time, the first local computing device is used to send a trigger signal to the trigger sensor and start timing according to the set pulse width when the rising edge pulse signal of the square wave signal is captured, so that the trigger sensor starts to collect data according to the trigger signal and transmits data to the first local computing device connected to it; when the timing time reaches the set threshold, stop sending the trigger signal. The second local computing device is used to use its own system clock as the clock source of the non-trigger type sensor connected to it, so as to receive the data transmitted by the non-trigger type sensor according to its own frequency. The beneficial effect of the present invention is that the global synchronization module can realize the clock synchronization between the global synchronization module and the local synchronization module by sending a square wave signal to the local synchronization module. Different local computing devices set a corresponding data acquisition mode according to the type of sensor connected to them to obtain the sensor data at the same time. The square wave signal is transmitted through a single signal line for multi-device synchronization, which avoids the expensive gateway authorization fee and the clock jitter caused by network fluctuations. Sub-millisecond clock synchronization can be achieved without the participation of the gateway. The clock synchronization is guaranteed by the collaborative work of software and hardware. Even if the global synchronization module fails to communicate with the navigation device normally, the clock synchronization within the domain can be guaranteed. The square wave signal uses a fixed rising edge frame header, taking into account the triggering and signal transmission, so that the signal can be used for the clock synchronization of the computing device and the triggering of the sensor at the same time, which greatly reduces the complexity of the system and improves the practicality.
[0115] Figure 4 A flowchart of a clock synchronization method provided by an embodiment of the present invention, the method comprising:
[0116] S401: Receive a square wave signal sent by a global synchronization module.
[0117] The square wave signal is a square wave signal containing a timestamp generated by the global synchronization module after the global computing device achieves clock synchronization based on the clock signal of the navigation device.
[0118] S402: Resetting the system clock is completed according to the timestamp included in the square wave signal.
[0119] S403: When the rising edge pulse signal of the square wave signal is captured, a trigger signal is sent to the trigger sensor according to the set pulse width and timing is started, so that the trigger sensor starts collecting data according to the trigger signal and transmits the data to the local computing device connected to it.
[0120] S404: When the timing time reaches the set threshold, stop sending the trigger signal.
[0121] S405: Using its own system clock as a clock source for the non-trigger type sensor connected thereto, so as to receive data transmitted by the non-trigger type sensor according to its own frequency.
[0122] In some embodiments, according to the timestamp included in the square wave signal, resetting the system clock includes:
[0123] When the rising edge pulse signal of the square wave signal is captured, the system clock is cleared;
[0124] Solve the square wave signal to get the timestamp;
[0125] Based on the timestamp and the solution time of the solved square wave signal, the system clock of the local synchronization module is reset.
[0126] In some embodiments, after calculating the square wave signal to obtain the timestamp, the method further includes:
[0127] According to the set verification method, calculate the actual verification signal corresponding to the timestamp;
[0128] Determine whether the actual calibration signal is consistent with the calibration signal carried by the square wave signal;
[0129] When the actual verification signal is consistent with the verification signal carried by the square wave signal, a step of resetting the system clock of the local synchronization module based on the timestamp and the solution time of the square wave signal is performed;
[0130] When the actual verification signal is inconsistent with the verification signal carried by the square wave signal, a new square wave signal is obtained from the global synchronization module.
[0131] In some embodiments, after receiving the square wave signal sent by the global synchronization module, the method further includes:
[0132] When the rising edge pulse signal of the square wave signal is captured, the state of the device is switched to the synchronous state so as not to respond to other square wave signals.
[0133] After completing the reset of the system clock, it switches its own state to the standby state to respond to the square wave signal.
[0134] In some embodiments, after resetting the system clock according to the timestamp included in the square wave signal, the method further includes:
[0135] When the rising edge pulse signal of the square wave signal is captured, the state of the self is switched to the sending state, so as to send a trigger signal to the trigger type sensor according to the set pulse width;
[0136] When the timing reaches the set threshold, the state is switched to the standby state to stop sending the trigger signal.
[0137] In some embodiments, it also includes:
[0138] When receiving data transmitted by various sensors, determine whether the data transmitted by various sensors all carry timestamps;
[0139] When the data transmitted by the target sensor does not carry a timestamp, the current system time of the local computing device communicating with the target sensor is used as the timestamp of the data.
[0140] In some embodiments, after using the current system time of the local computing device communicating with the target sensor as the timestamp of the data, the method further includes:
[0141] The sensor transmission delay database is used to correct the timestamps carried by the data transmitted by various sensors; wherein the sensor transmission delay database records the transmission delays corresponding to various sensors.
[0142] In some embodiments, using the sensor transmission delay database to correct the timestamps carried by the data transmitted by various sensors includes:
[0143] Determine whether the timestamp carried by the data transmitted by various sensors belongs to the signal collection moment;
[0144] When the timestamp carried by the data transmitted by the target sensor does not belong to the signal acquisition time, query the target transmission delay matching the target sensor from the sensor transmission delay database;
[0145] According to the target transmission delay, the timestamp carried by the data transmitted by the target sensor is corrected.
[0146] In some embodiments, according to the target transmission delay, correcting the timestamp carried by the data transmitted by the target sensor includes:
[0147] The difference between the timestamp carried by the data transmitted by the target sensor and the target transmission delay is used as the corrected timestamp.
[0148] In some embodiments, it also includes:
[0149] Put the data transmitted by the sensor connected to it into its corresponding message queue.
[0150] In some embodiments, after placing the data transmitted by the sensor connected thereto into its corresponding message queue, the method further includes:
[0151] The data in each message queue is scrolled and searched according to the set time window to select the data of all sensors within the time window and send it to the application software.
[0152] Figure 4 The description of the features in the corresponding embodiments can be found in Figure 1 The relevant descriptions of the corresponding embodiments will not be repeated here one by one.
[0153] It can be seen from the above technical solution that the square wave signal sent by the global synchronization module is received; wherein the square wave signal is a square wave signal containing a timestamp generated by the global synchronization module after the clock synchronization of the global computing device is realized according to the clock signal of the navigation device. According to the timestamp contained in the square wave signal, the system clock is reset. When the rising edge pulse signal of the square wave signal is captured, a trigger signal is sent to the trigger sensor according to the set pulse width and timing is started, so that the trigger sensor starts to collect data according to the trigger signal and transmits data to the local computing device connected to it. When the timing time reaches the set threshold, the trigger signal is stopped. The system clock of the system is used as the clock source of the non-trigger sensor connected to it, so as to receive the data transmitted by the non-trigger sensor according to its own frequency. The beneficial effect of the present invention is that a single signal line is used to transmit a square wave signal for multi-device synchronization, which avoids the expensive gateway authorization fee and avoids the clock jitter caused by network fluctuations. Sub-millisecond clock synchronization can be achieved without the participation of the gateway. The clock synchronization is guaranteed by the collaborative work of software and hardware, and the clock synchronization within the domain can be guaranteed even if the global synchronization module fails to communicate with the navigation device normally. The square wave signal uses a fixed rising edge frame header, taking into account both triggering and signal transmission, so that the signal can be used for clock synchronization of computing devices and triggering of sensors at the same time, greatly reducing the complexity of the system and improving practicality.
[0154] The above is a detailed introduction to a clock synchronization system and method provided by an embodiment of the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the method disclosed in the embodiment, since it corresponds to the system disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0155] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0156] The above is a detailed introduction to a clock synchronization system and method provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the present invention.
Claims
1. A clock synchronization system, characterized in that: It includes a global synchronization module and a local synchronization module; the global synchronization module includes a global computing device; the local synchronization module includes a first local computing device that communicates with a trigger type sensor and a second local computing device that communicates with a non-trigger type sensor; The global synchronization module is connected to the navigation device and the local synchronization module respectively, and is used to realize the clock synchronization of the global computing device according to the clock signal of the navigation device; and sends a square wave signal containing a timestamp to the local synchronization module; The local synchronization module is used to receive the square wave signal sent by the global synchronization module; and to reset the system clock of the local synchronization module according to the timestamp contained in the square wave signal; The first local computing device is used to send a trigger signal to the trigger sensor and start timing according to the set pulse width when capturing the rising edge pulse signal of the square wave signal, so that the trigger sensor starts to collect data according to the trigger signal and transmits the data to the first local computing device connected thereto; when the timing time reaches the set threshold, stop sending the trigger signal; The second local computing device is used to use its own system clock as a clock source for the non-trigger type sensor connected thereto, so as to receive data transmitted by the non-trigger type sensor at its own frequency; The local synchronization module is used to receive the square wave signal sent by the global synchronization module; When the rising edge pulse signal of the square wave signal is captured, the system clock is cleared; the square wave signal is resolved to obtain the timestamp; Resetting a system clock of the local synchronization module based on the timestamp and a solution time of the square wave signal; The global synchronization module is used to construct a square wave signal corresponding to the timestamp of the next moment after realizing the clock synchronization of the global computing device; when the current time reaches the next moment, the square wave signal is sent to the local synchronization module; the global computing device calculates the square wave waveform corresponding to the timestamp of the next second at the current moment; if the next moment has passed when the square wave signal is encapsulated, the square wave waveform corresponding to the timestamp of the next second is recalculated.
2. The clock synchronization system according to claim 1, characterized in that: The local synchronization module is used to use the sum of the timestamp and the calculation time of the square wave signal as the system clock of the local synchronization module.
3. The clock synchronization system according to claim 1, characterized in that: The global synchronization module is used to record the square wave signal corresponding to the constructed next moment timestamp into a set cache area; when the current time reaches the next moment, read the square wave signal from the cache area and send the square wave signal to the local synchronization module.
4. The clock synchronization system according to claim 1, characterized in that: The global synchronization module is used to calculate the verification signal corresponding to the next time stamp according to the set verification method; and encapsulate the next time stamp and the verification signal into a square wave signal according to the set square wave signal format.
5. The clock synchronization system according to claim 4, characterized in that: The local synchronization module is used to calculate the actual verification signal corresponding to the timestamp according to the set verification method after solving the square wave signal to obtain the timestamp; determine whether the actual verification signal is consistent with the verification signal carried by the square wave signal; if the actual verification signal is consistent with the verification signal carried by the square wave signal, execute the step of resetting the system clock of the local synchronization module based on the timestamp and the solution time of the square wave signal; if the actual verification signal is inconsistent with the verification signal carried by the square wave signal, obtain a new square wave signal from the global synchronization module.
6. The clock synchronization system according to claim 1, characterized in that: The local synchronization module is used to switch its own state to a synchronization state when capturing a rising edge pulse signal of a square wave signal, so as not to respond to other square wave signals; After completing the reset of the system clock, it switches its own state to the standby state to respond to the square wave signal.
7. The clock synchronization system according to claim 6, characterized in that: The first local computing device is used to switch its own state to a sending state when a rising edge pulse signal of a square wave signal is captured, so as to send a trigger signal to the trigger sensor according to a set pulse width; when the timing time reaches a set threshold, switch its own state to a standby state so as to stop sending the trigger signal.
8. The clock synchronization system according to claim 6, characterized in that: The first local computing device is used to switch its own state to a sending state when a rising edge pulse signal of a square wave signal is captured; and to switch its own state to a standby state when the difference between the sending time of the trigger signal closest to the current time and the receiving time of the square wave signal is greater than a set threshold.
9. The clock synchronization system according to claim 1, characterized in that: The local synchronization module is used to determine whether the data transmitted by various sensors all carry timestamps when receiving the data transmitted by various sensors; When the data transmitted by the target sensor does not carry a timestamp, the current system time of the local computing device communicating with the target sensor is used as the timestamp of the data.
10. The clock synchronization system according to claim 9, characterized in that: The local synchronization module is used to modify the time stamps carried by the data transmitted by various sensors using the sensor transmission delay database; wherein the sensor transmission delay database records the transmission delays corresponding to various sensors.
11. The clock synchronization system according to claim 10, characterized in that: The local synchronization module is used to determine whether the timestamp carried by the data transmitted by various sensors belongs to the signal collection time; when the timestamp carried by the data transmitted by the target sensor does not belong to the signal collection time, query the target transmission delay matched by the target sensor from the sensor transmission delay database; and correct the timestamp carried by the data transmitted by the target sensor according to the target transmission delay.
12. The clock synchronization system according to claim 11, characterized in that: The local synchronization module is used to use the difference between the timestamp carried by the data transmitted by the target sensor and the target transmission delay as the corrected timestamp.
13. The clock synchronization system according to claim 1, characterized in that: The local synchronization module includes multiple local computing devices, each of which has its corresponding message queue; The local computing device is used to put the data transmitted by the sensor connected to it into its corresponding message queue.
14. The clock synchronization system according to claim 13, characterized in that: The local synchronization module is used to perform rolling search on the data in each message queue according to a set time window, so as to select the data of all sensors within the time window and send it to the application software.
15. The clock synchronization system according to claim 1, characterized in that: The trigger sensor includes a camera; the first local computing device is connected to the camera via a deserializer and a serializer.
16. The clock synchronization system according to claim 1, characterized in that: The non-trigger sensor includes a laser radar; the second local computing device is connected to the laser radar via an Ethernet interface.
17. The clock synchronization system according to any one of claims 1 to 16, characterized in that: The global synchronization module includes a signal receiving interface, a global computing device and a signal sending interface; wherein the signal receiving interface includes a GPRMC interface and a pulse per second signal interface for time synchronization; and the signal sending interface includes a square wave signal sending interface.
18. A clock synchronization method, characterized in that: Applicable to a local synchronization module, the method comprises: Receive a square wave signal sent by a global synchronization module; wherein the square wave signal is a square wave signal containing a timestamp generated by the global synchronization module after the global synchronization module realizes clock synchronization of the global computing device according to the clock signal of the navigation device; Resetting the system clock according to the timestamp included in the square wave signal; When the rising edge pulse signal of the square wave signal is captured, a trigger signal is sent to the trigger sensor according to the set pulse width and timing is started, so that the trigger sensor starts to collect data according to the trigger signal and transmits the data to the local computing device connected thereto; When the timing reaches the set threshold, stop sending the trigger signal; Use its own system clock as the clock source for the non-trigger sensors connected to it, so as to receive the data transmitted by the non-trigger sensors at their own frequency; The local synchronization module receives the square wave signal sent by the global synchronization module; when the rising edge pulse signal of the square wave signal is captured, the system clock is cleared; the square wave signal is solved to obtain the timestamp; based on the timestamp and the solution time of the square wave signal, the system clock of the local synchronization module is reset; after realizing the clock synchronization of the global computing device, the global synchronization module constructs a square wave signal corresponding to the timestamp of the next moment; when the current time reaches the next moment, the square wave signal is sent to the local synchronization module; the global computing device calculates the square wave waveform corresponding to the timestamp of the next second at the current moment; if the next moment has passed when the square wave signal is encapsulated, the square wave waveform corresponding to the timestamp of the next second is recalculated.
Citation Information
Patent Citations
Multi-rate multi-channel time synchronization high speed data recording system
CN107966723A
Time scale synchronization system, time scale synchronization method and satellite-borne navigation receiver
CN112367139A
Multi-sensor time synchronization method, device and system, electronic device and medium
CN112672415A
Time service device and method for synchronous data acquisition, roadside system and storage medium
CN116961809A