CN116527185A - Sensor timestamp calibration method and device, intelligent terminal and storage medium - Google Patents

Sensor timestamp calibration method and device, intelligent terminal and storage medium Download PDF

Info

Publication number
CN116527185A
CN116527185A CN202310372184.3A CN202310372184A CN116527185A CN 116527185 A CN116527185 A CN 116527185A CN 202310372184 A CN202310372184 A CN 202310372184A CN 116527185 A CN116527185 A CN 116527185A
Authority
CN
China
Prior art keywords
sensor
data
frame
time stamp
interrupt
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310372184.3A
Other languages
Chinese (zh)
Inventor
余学稳
王金栓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Meta Bounds Inc
Original Assignee
Meta Bounds Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Meta Bounds Inc filed Critical Meta Bounds Inc
Priority to CN202310372184.3A priority Critical patent/CN116527185A/en
Publication of CN116527185A publication Critical patent/CN116527185A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Arrangements For Transmission Of Measured Signals (AREA)

Abstract

The invention discloses a sensor time stamp calibration method, a device, an intelligent terminal and a storage medium. In contrast to the prior art, the time stamp of each data frame of the sensor can be calibrated.

Description

Sensor timestamp calibration method and device, intelligent terminal and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method and apparatus for calibrating a sensor timestamp, an intelligent terminal, and a storage medium.
Background
In unmanned systems, multi-line lidar, cameras and IMU sensors (Inertia Measurement Unit: inertial sensors) are often used for fusion positioning based on the IMU sensor's time stamp. And the speed per hour of the automobile is as high as tens of milliseconds, even if the time stamp of the IMU sensor has an error of tens of milliseconds, the sensing of the surrounding environment can be greatly influenced.
When acquiring a data frame of an IMU sensor, the problems of frame loss and time asynchronism between a time stamp of the IMU sensor and a time of a main control terminal often occur. However, the existing timestamp synchronization method only synchronizes the timestamp of the IMU sensor with the timestamp of other sensors, and cannot calibrate the timestamp of the IMU sensor, so that the timestamp of the IMU sensor is inaccurate.
Disclosure of Invention
The invention mainly aims to provide a sensor timestamp calibration method, a sensor timestamp calibration device, an intelligent terminal and a storage medium, and aims to solve the problem of inaccurate sensor timestamps.
To achieve the above object, a first aspect of the present invention provides a sensor time stamp calibration method, the method comprising:
when an interrupt signal of a sensor is acquired, an interrupt time stamp is generated and a sequence number of an interrupt frame is acquired; reading a data frame of a sensor by adopting a first-in first-out mode to obtain a data frame set; the time stamp of the data frame in the set of data frames is calibrated based on the sequence number of the interrupt frame and the interrupt time stamp.
Optionally, after obtaining the data frame set, the method further includes:
acquiring the number of data frames in a sensor;
and when the number is greater than or equal to a preset threshold value, reading the data frames with the preset threshold value, storing the data frames into the data frame set, calibrating the time stamp of the data frames in the data frame set, and returning to acquire the number of the data frames in the sensor for cyclic reading until the number is smaller than the preset threshold value.
Optionally, the calibrating the time stamp of the data frame in the data frame set based on the sequence number of the interrupt frame and the interrupt time stamp includes:
acquiring a sequence number difference between a sequence number of each data frame in the data frame set and a sequence number of the interrupt frame;
obtaining a time difference between each data frame in the set of data frames and the interrupt frame based on a frame rate of a sensor and the sequence number difference;
and setting the time stamp of each data frame in the data frame set according to the interruption time stamp and the time difference between each data frame and the interruption frame so as to calibrate the time stamp of the data frame in the data frame set.
Optionally, the method further comprises: inquiring the number of data frames in the sensor at preset waiting time intervals, and when the number is larger than or equal to the preset threshold value, reading the data frames with the preset threshold value in the sensor and calibrating the time stamp of the data frames.
Optionally, the preset waiting time is determined according to a frame rate of the sensor.
A second aspect of the present invention provides a sensor timestamp calibration apparatus, wherein the apparatus includes:
the data reading module is used for reading the data frames of the sensor by adopting a first-in-first-out mode to obtain a data frame set;
the calibration module is used for generating an interrupt time stamp and acquiring the sequence number of an interrupt frame when the interrupt signal of the sensor is acquired; the time stamp of the data frame in the set of data frames is calibrated based on the sequence number of the interrupt frame and the interrupt time stamp.
Optionally, the data reading module includes a reading unit, where the reading unit is configured to obtain the number of data frames in the sensor; and when the number is greater than or equal to a preset threshold value, reading the data frames with the preset threshold value, storing the data frames into the data frame set, calibrating the time stamp of the data frames in the data frame set, and returning to acquire the number of the data frames in the sensor for cyclic reading until the number is smaller than the preset threshold value.
Optionally, the calibration module includes a frame sequence calibration unit, where the frame sequence calibration unit is configured to obtain a sequence number difference between a sequence number of each data frame in the data frame set and a sequence number of the interrupt frame; obtaining a time difference between each data frame in the set of data frames and the interrupt frame based on a frame rate of a sensor and the sequence number difference; and setting the time stamp of each data frame in the data frame set according to the interruption time stamp and the time difference between each data frame and the interruption frame so as to calibrate the time stamp of the data frame in the data frame set.
A third aspect of the present invention provides an intelligent terminal, where the intelligent terminal includes a memory, a processor, and a sensor time stamp calibration program stored in the memory and executable on the processor, where the sensor time stamp calibration program, when executed by the processor, implements any one of the steps of the sensor time stamp calibration method.
A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon a sensor time stamp calibration program which, when executed by a processor, implements the steps of any one of the above-described sensor time stamp calibration methods.
From the above, the invention generates the interrupt time stamp and obtains the sequence number of the interrupt frame after obtaining the interrupt signal of the sensor, and then reads the data frame of the sensor by adopting the first-in first-out mode to obtain the data frame set, and calibrates the time stamp of the data frame in the data frame set according to the sequence number of the interrupt frame and the interrupt time stamp. Since the time stamp of each data frame in the data frame set is calibrated according to the interrupt time stamp generated at the time of the interrupt, the occurrence of time deviation is prevented from being overlapped and enlarged, and the time stamp of each data frame of the sensor can be accurately calibrated; and the data frames of the sensors are read in batches by adopting a first-in first-out mode, so that the data frames are fast to read, and the working efficiency of the main control terminal can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a sensor time stamp calibration application scenario diagram provided by an embodiment of the present invention;
FIG. 2 is a schematic diagram of a specific flow chart of a sensor timestamp calibration method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a specific flow of time stamps of data frames in a calibration data frame set;
FIG. 4 is a schematic diagram of a specific flow of intelligent reading;
FIG. 5 is a schematic diagram of a sensor time stamp calibration apparatus according to an embodiment of the present invention;
fig. 6 is a schematic block diagram of an internal structure of an intelligent terminal according to an embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in this specification and the appended claims, the term "if" may be interpreted in context as "when …" or "upon" or "in response to a determination" or "in response to detection. Similarly, the phrase "if a condition or event described is determined" or "if a condition or event described is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a condition or event described" or "in response to detection of a condition or event described".
The following description of the embodiments of the present invention will be made more fully hereinafter with reference to the accompanying drawings, in which embodiments of the invention are shown, it being evident that the embodiments described are only some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, but the present invention may be practiced in other ways other than those described herein, and persons skilled in the art will readily appreciate that the present invention is not limited to the specific embodiments disclosed below.
There are a wide variety of sensors and hardware devices (e.g., GPS, lidar, cameras, inertial sensors, etc.) in unmanned systems, SLAM (Simultaneous Localization and Mapping: instant localization and mapping), AR navigation. The time difference is unavoidable when the sensor data is collected and finally used by a master control terminal (such as an electronic controller unit of a vehicle) running the autopilot computing platform. The time stamps of the sensor data of the IMU are usually used as references, so that the consistency of the time stamps of the sensor data is realized by calibrating the time stamps of the sensor data, and then the sensor data can be fused and various application functions can be realized. Therefore, the time stamp has important significance for the fusion, prediction and decision planning module of the sensor data. If the unmanned system has the problems of triggering delay, transmission delay, inaccurate clock synchronization and the like, the sensing of the surrounding environment and the positioning of the unmanned system can be greatly influenced.
However, when reading a data frame of an IMU sensor, an inaccurate time stamp of the IMU sensor often occurs. It is therefore necessary to calibrate the time stamp of the IMU sensor data frame according to the time of the master terminal.
The common modes for the main control terminal to read the IMU sensor data frame are as follows: FIFO (First Input First Out: first-in first-out) mode, polling mode and interrupt mode.
In the FIFO mode, the main control terminal inquires the number of data frames of the register in the IMU sensor according to the set frequency, and reads the IMU sensor data with the preset threshold number in batches when the number of the data frames stored in the register reaches the preset threshold, so that the reading speed is high, and the processing efficiency of the main control terminal is improved. However, since the time of the main control terminal first acquiring the IMU sensor data frame is taken as a reference, and the time stamp of the subsequent IMU sensor data frame is calibrated according to the reference and the time interval of generating the IMU sensor data frame, when the time deviation exists between the main control terminal and the IMU sensor, the time deviation is overlapped and increased along with the increase of the times of acquiring the IMU sensor data frame, and the time stamp of the calibrated IMU sensor data frame is inaccurate.
In the polling mode, the master control terminal reads IMU sensor data frame by frame according to a certain frequency. Because the frequency of acquiring the IMU sensor data by the main control terminal is not well known, the resource of the main control terminal is wasted when the frequency is too high, and the acquisition of the IMU sensor data is not timely when the frequency is too low, so that the data of a register of the IMU sensor overflows, frame loss occurs, the sequence numbers of data frames are disordered, and the time stamp of the calibrated data frames is inaccurate. In addition, under a multi-task platform (Linux/Android) of the unmanned system, time consumption for task switching also can lead to untimely acquisition of the IMU sensor data frame, and data overflow of a register of the IMU sensor can also cause frame loss of the IMU sensor data.
In interrupt mode, an interrupt signal is generated each time an IMU sensor generates a frame of data. And after receiving the interrupt signal of the IMU sensor, the main control terminal calls an interrupt function to read one frame of IMU sensor data. Although the time stamp of the IMU sensor data frame can be calibrated in time according to the time of the current main control terminal, the situation that the time deviation is overlapped and increased does not occur. However, because an interrupt signal is generated in each frame, the interrupt is frequently generated, the main control terminal may acquire IMU sensor data in the interrupt function and cannot respond to the next interrupt signal in time, so that the next interrupt signal is shielded, the IMU sensor data cannot be read in time, and the IMU sensor data is lost; if events are generated in the interrupt function to wake other threads to acquire IMU sensor data, the situation that the IMU sensor data cannot be acquired in time exists.
In view of the foregoing, the present invention provides a sensor timestamp calibration method for calibrating a timestamp by combining the advantages of the FIFO mode and the interrupt mode. When the sensor generates an interrupt, the data frames of the sensor are read in batches using a FIFO mode, a set of data frames is obtained, and the time stamp of each data frame in the set of data frames is calibrated according to the interrupt time stamp generated at the time of the interrupt. Because the data frames in the sensor register reach the preset threshold value, interruption can be generated, the time deviation superposition and the increase can not occur, the time stamp of each data frame is accurate, and an interruption triggering mechanism is adopted, so that the main control terminal does not need to frequently detect, and the processing efficiency of the main control terminal can be improved. The method can be applied to not only IMU sensors, but also other types of sensors, such as line laser ranging sensors, GPS sensors and the like, and only needs to be provided with an interrupt mechanism and support a FIFO mode.
Exemplary method
The embodiment of the invention provides a sensor time stamp calibration method which is deployed on an automatic driving computing platform of an unmanned system and used for calibrating time stamps of received IMU sensor data, so that the accuracy of the time stamps is ensured when other sensor data are fused. Of course, the system can also be deployed on other types of main control terminals, such as intelligent terminals, single-chip computers, MCU (micro control unit) and the like.
The main control terminal of this embodiment is shown in fig. 1, and the main control terminal is a single chip microcomputer running an autopilot computing platform, and an IMU sensor is installed beside a vehicle engine. Comprising the following steps: intelligent polling and frame sequence prediction unit, read-write unit (W/R), and interrupt processing unit (IRQ). The read-write unit is used for reading the data frame on the IMU sensor, and the interrupt processing unit is used for receiving the interrupt signal sent by the terminal manager (Interrupt Manager) on the IMU sensor and sending the signal to the read-write unit. The read-write unit is connected with a read-write Interface (Interface) of the IMU sensor, such as an RS232/422/485 serial port module, and the number of data frames stored in a register (Regs Array) of the IMU sensor can be inquired through the read-write Interface; and reading the data frame from the register of the IMU sensor.
Specifically, as shown in fig. 2, the sensor timestamp calibration method of the present embodiment includes the following steps:
step S100: when an interrupt signal of a sensor is acquired, an interrupt time stamp is generated and a sequence number of an interrupt frame is acquired; reading a data frame of a sensor by adopting a first-in first-out mode to obtain a data frame set;
specifically, the main control terminal sets the interrupt threshold of the sensor to a preset threshold in advance by calling the interface of the sensor, so that the interrupt signal is generated only when the number of data frames in the register of the sensor reaches the preset threshold, rather than generating the interrupt signal every time one frame of data is generated.
Referring to fig. 1, assuming that the preset threshold is 5, when the number of data frames stored in the register (Regs Array) of the sensor reaches 5, the interrupt manager (Interrupt Manager) of the sensor generates an interrupt signal, and the interrupt processing unit of the master terminal can receive the interrupt signal and send the interrupt signal to the read/write unit to read the data frames of the sensor.
The disclosed embodiments of the present invention propose a new mode of combining interrupt mode with FIFO mode to read IMU sensor data frames. Different from the FIFO mode in the related art, when the number of data frames in a register of the sensor reaches a preset threshold value, the sensor actively generates an interrupt signal to inform the main control terminal, the main control terminal adopts the FIFO mode to read, and the calibration of the data frame time stamp is carried out according to the time when the main control terminal receives the interrupt signal, so that the time difference is prevented from being overlapped and enlarged, the generation frequency of the interrupt signal is controlled, and the working efficiency of the main control terminal is improved. That is, the advantages of batch reading in the FIFO mode and timely notification in the interrupt mode are utilized simultaneously, so that the master terminal can timely and efficiently read the data frames in the sensor.
Step S200: the time stamp of the data frame in the set of data frames is calibrated based on the sequence number of the interrupt frame and the interrupt time stamp.
Specifically, after the master control terminal receives the interrupt signal, since the delay between the time when the master control terminal receives the interrupt signal and the time when the sensor generates the interrupt signal is negligible, the master control terminal can directly use the current time as an interrupt time stamp after receiving the interrupt signal, and obtain the number of data frames stored in the register from the register of the sensor, where the number is the sequence number of the interrupt frame (i.e. the corresponding frame at the time of occurrence of the interrupt). Since the interrupt threshold of the sensor is preset as the preset threshold, the number of data frames in the register of the sensor gradually increases from the beginning, and when the interrupt signal is immediately generated when the interrupt threshold is reached, the number of data frames in the register of the sensor is the preset threshold. And then reading the data frames with the same number as the preset threshold value from the sensor to form a data frame set, calculating the time difference between the data frames and the interrupt frame according to the front-back relation between the sequence number of each data frame in the data frame set and the sequence number of the interrupt frame, and obtaining the accurate time stamp of each data frame and calibrating the time stamp of each data frame according to the interrupt time stamp and the time difference.
In this embodiment, the time stamp of the data frame in the data frame set is calibrated, as shown in fig. 3, and specifically includes the following steps:
step S210: acquiring a sequence number difference between a sequence number of each data frame in the data frame set and a sequence number of the interrupt frame;
specifically, each data frame in the register of the sensor is stored according to the time sequence, and when the data frames of the sensor are read by adopting the FIFO mode and stored into the data frame set, the sequence of the data frames in the data frame set is the same as the sequence stored in the register of the sensor. The sequence number of each data frame in the data frame set is the sequence number in the data frame set, and the interrupt frame is the last frame in the data frame set, so that the sequence number difference between the sequence number of each data frame and the sequence number of the interrupt frame can be obtained. For example, when 5 frames of data S1 to S5 are sequentially stored in the data frame set, the sequence numbers of the data frames are 1 to 5, the sequence number of the interrupt frame is 5, and the sequence number difference between the data frame S2 and the interrupt frame is 3.
Step S220: obtaining a time difference between each data frame in the data frame set and the interrupt frame based on the frame rate and sequence number difference of the sensor;
specifically, the frame rate of the sensor indicates how many frames of data the sensor generates per second. According to the sequence number difference and the frame rate of the sensor, the time difference corresponding to each data frame in the data frame set can be calculated. For example: in the above example, the sequence number difference between the data frame S2 and the interrupt frame is 3, and assuming that the frame rate of the sensor is 10 frames/second, the time difference between the data frame S2 and the interrupt frame can be calculated to be 0.3 seconds.
Step S230: and setting the time stamp of each data frame in the data frame set according to the interruption time stamp and the time difference between each data frame and the interruption frame so as to calibrate the time stamp of the data frame in the data frame set.
Specifically, an interruption time stamp and a time difference corresponding to each data frame are obtained, the interruption time stamp and the time difference are added, a corrected time stamp is obtained, and the time stamp of each data frame in the data frame set is calibrated. Assuming that the interruption time stamp is t, the time difference between the S1-S5 data frames is 0.4, 0.3, 0.2, 0.1, 0, and the time stamp of each data frame in the data frame set is t-0.4, t-0.3, t-0.2, t-0.1, t, respectively.
The time stamp of each data frame in the set of data frames can be calibrated simply and quickly by using the frame sequence calibration method described above.
In summary, by combining the interrupt mode and the FIFO mode, the time stamp of each data frame in the data frame set can be calibrated according to the interrupt time stamp generated during the interrupt, so that the time deviation is prevented from being overlapped and expanded, and the time stamp of each data frame of the sensor can be accurately calibrated. Although some sensors time stamp the collected data with their own clocks for use by downstream algorithms. However, in order to unify the time stamps of different sensor data, it is still necessary to calibrate the time stamps of the sensor data. Taking IMU sensors and cameras in an autopilot system as an example, it is necessary to fuse the data frames of the IMU sensors with the images captured by the cameras to estimate the pose/motion/pose of the vehicle. Although the image shot by the camera and the data frame of the IMU sensor have time stamps, the time stamp of the image shot by the camera is usually the exposure time of the camera, and the time stamp of the data frame of the IMU sensor is the generation time of the data frame of the IMU sensor. However, due to the problems of trigger delay, transmission delay, inaccurate synchronous clock and the like of the system, the time stamp of the image shot by the camera is not aligned with the time stamp of the data frame of the IMU sensor. By using the accurate time stamp of the IMU sensor data frame to align with the time stamp of the image shot by the camera, the time synchronization can be effectively maintained when the IMU sensor data frame and the image data of the camera are fused.
The main control terminal reads the sensor data in batches according to a preset threshold value, and when the total number of data frames in a register of the sensor reaches the preset threshold value, an interrupt signal is generated. Under normal conditions, although the sensor still generates data frames in the reading process of the main control terminal, after the main control terminal reads the data frames with the preset threshold number from the sensor register in time after the interrupt signal is generated, the total number of the data frames in the register of the sensor is smaller than the preset threshold value, so that the sensor can be ensured to normally generate the next interrupt; however, in some cases, the master terminal may still process other tasks to cause untimely reading of the sensor data, and after the master terminal reads the preset threshold number of data frames from the register of the sensor, the number of data frames in the sensor may exceed the preset threshold number. And although the sensor generates an interrupt signal again, the interrupt signal is lost this time because the main control terminal is still performing the processing flow of the last interrupt signal. After that, as the total number of data frames in the register of the sensor exceeds the preset threshold value all the time, the sensor does not generate an interrupt signal any more, so that the frame loss condition occurs.
Thus, in one embodiment, as shown in FIG. 4, after calibrating the time stamps of the data frames in the set of data frames, further comprises:
step S300: acquiring the number of data frames in a sensor;
step S400: when the number is greater than or equal to the preset threshold, reading the data frames with the preset threshold number, storing the data frames into a data frame set, calibrating the time stamp of the data frames in the data frame set, and returning to acquire the number of the data frames in the sensor for cyclic reading until the number is smaller than the preset threshold.
Specifically, after one data frame set is read from the register of the sensor (after the data frames in the register of the sensor are read, the data frames are not stored in the register any more), the number of the data frames in the register of the sensor is also queried, if the number of the data frames is still greater than or equal to a preset threshold value, which indicates that the condition that an interrupt signal is lost occurs, the data frames with the preset threshold value need to be continuously read, the read data frames are stored in the data frame set and the time stamp of the data frames in the data frame set is calibrated, after the calibration is finished, the number of the data frames in the register of the sensor is queried, and if the number of the data frames in the register of the sensor is still greater than or equal to the preset threshold value, the reading is continued until the number of the data frames in the register of the sensor is less than the preset threshold value. When the time stamp of the data frame in the data frame set read by the method is calibrated, the time stamp can still be calibrated by adopting the methods from step S210 to step S230. For example: assuming that the sequence number of the interrupt frame is 5 after receiving the interrupt signal, the interrupt time stamp is t, the frame rate of the sensor is 10 frames/second, and the sequence number of the data frame in the read data frame set is sequentially increased to 6-10, the time stamp of each data frame in the data frame set is t+0.1, t+0.2, t+0.3, t+0.4 and t+0.5 respectively. When the data frame is read again, the sequence number of the data frame starts from 11 and so on. And resetting the starting sequence number of the data frames to 1 until the number of the data frames in the register of the sensor is smaller than a preset threshold value.
By adopting the intelligent reading method, the data frame of the sensor can be ensured not to be lost. In order to prevent this, in some embodiments, the number of data frames in the sensor is also queried at intervals according to a preset waiting time, and when the number is greater than or equal to the preset threshold value, the data frames of the sensor with the preset threshold value are read, the time when the master control terminal starts to read is set as an interrupt timestamp, the sequence number of the interrupt frame is set as 1, and the calibration of the timestamp is performed by adopting the method of steps S210 to S230.
The preset wait time may be determined according to a frame rate of the sensor. For example: assuming that the preset threshold is 10 frames and the frame rate of the sensor is 10 frames/second, the preset waiting time is set to be 1.5 seconds, so that the triggering mechanism of the interrupt signal is not affected, and the situation that the interrupt signal is not generated any more can be ensured.
The interval inquiry method can be operated as a single thread at the master control terminal. By adopting the interval inquiry method, the data frame of the sensor can be ensured to be acquired stably and reliably without frame loss.
Exemplary apparatus
As shown in fig. 5, corresponding to the above-mentioned sensor timestamp calibration method, an embodiment of the present invention further provides a sensor timestamp calibration device, where the device includes:
the data reading module 600 is configured to read a data frame of the sensor in a first-in-first-out mode, and obtain a data frame set;
the calibration module 610 is configured to generate an interrupt timestamp and obtain a sequence number of an interrupt frame when an interrupt signal of the sensor is received; the time stamp of the data frame in the set of data frames is calibrated based on the sequence number of the interrupt frame and the interrupt time stamp.
Optionally, the data reading module includes a reading unit, where the reading unit is configured to obtain the number of data frames in a register of the sensor; and when the number is greater than or equal to a preset threshold value, reading the data frames with the preset threshold value, storing the data frames into the data frame set, calibrating the time stamp of the data frames in the data frame set, and returning to acquire the number of the data frames in the sensor for cyclic reading until the number is smaller than the preset threshold value.
Optionally, the calibration module includes a frame sequence calibration unit, where the frame sequence calibration unit is configured to obtain a sequence number difference between a sequence number of each data frame in the data frame set and a sequence number of the interrupt frame; obtaining a time difference between each data frame in the set of data frames and the interrupt frame based on a frame rate of a sensor and the sequence number difference; and setting the time stamp of each data frame in the data frame set according to the interruption time stamp and the time difference between each data frame and the interruption frame so as to calibrate the time stamp of the data frame in the data frame set.
In particular, in this embodiment, specific functions of each module of the sensor timestamp calibration system may refer to corresponding descriptions in the sensor timestamp calibration method, which are not described herein.
Based on the above embodiment, the present invention also provides an intelligent terminal, and a functional block diagram thereof may be shown in fig. 6. The intelligent terminal comprises a processor, a memory, a network interface and a display screen which are connected through a system bus. The processor of the intelligent terminal is used for providing computing and control capabilities. The memory of the intelligent terminal comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a sensor timestamp calibration program. The internal memory provides an environment for the operating system and the running of the sensor timestamp calibration program in the non-volatile storage medium. The network interface of the intelligent terminal is used for communicating with an external terminal through network connection. The sensor timestamp calibration program, when executed by the processor, performs the steps of any one of the sensor timestamp calibration methods described above. The display screen of the intelligent terminal can be a liquid crystal display screen or an electronic ink display screen.
It will be appreciated by those skilled in the art that the schematic block diagram shown in fig. 6 is merely a block diagram of a portion of the structure associated with the present inventive arrangements and is not limiting of the smart terminal to which the present inventive arrangements are applied, and that a particular smart terminal may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a smart terminal is provided, the smart terminal comprising a memory, a processor, and a sensor timestamp calibration program stored on the memory and executable on the processor, the sensor timestamp calibration program when executed by the processor performing the following instructions:
when an interrupt signal of a sensor is acquired, an interrupt time stamp is generated and a sequence number of an interrupt frame is acquired; reading a data frame of a sensor by adopting a first-in first-out mode to obtain a data frame set; the time stamp of the data frame in the set of data frames is calibrated based on the sequence number of the interrupt frame and the interrupt time stamp.
Optionally, after obtaining the data frame set, the method further includes:
acquiring the number of data frames in a sensor;
and when the number is greater than or equal to a preset threshold value, reading the data frames with the preset threshold value, storing the data frames into the data frame set, calibrating the time stamp of the data frames in the data frame set, and returning to acquire the number of the data frames in the sensor for cyclic reading until the number is smaller than the preset threshold value.
Optionally, the calibrating the time stamp of the data frame in the data frame set based on the sequence number of the interrupt frame and the interrupt time stamp includes:
acquiring a sequence number difference between a sequence number of each data frame in the data frame set and a sequence number of the interrupt frame;
obtaining a time difference between each data frame in the set of data frames and the interrupt frame based on a frame rate of a sensor and the sequence number difference;
and setting the time stamp of each data frame in the data frame set according to the interruption time stamp and the time difference between each data frame and the interruption frame so as to calibrate the time stamp of the data frame in the data frame set.
Optionally, the method further comprises: inquiring the number of data frames in the sensor at preset waiting time intervals, and when the number is larger than or equal to the preset threshold value, reading the data frames with the preset threshold value in the sensor and calibrating the time stamp of the data frames.
Optionally, the preset waiting time is determined according to a frame rate of the sensor.
The embodiment of the invention also provides a computer readable storage medium, wherein the computer readable storage medium stores a sensor time stamp calibration program, and the sensor time stamp calibration program realizes the steps of any one of the sensor time stamp calibration methods provided by the embodiment of the invention when being executed by a processor.
It should be understood that the sequence number of each step in the above embodiment does not mean the sequence of execution, and the execution sequence of each process should be determined by its function and internal logic, and should not be construed as limiting the implementation process of the embodiment of the present invention.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present invention. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other manners. For example, the apparatus/terminal device embodiments described above are merely illustrative, e.g., the division of the modules or units described above is merely a logical function division, and may be implemented in other manners, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed.
The integrated modules/units described above, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer-readable storage medium. Based on such understanding, the present invention may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the steps of each method embodiment may be implemented. The computer program comprises computer program code, and the computer program code can be in a source code form, an object code form, an executable file or some intermediate form and the like. The computer readable medium may include: any entity or device capable of carrying the computer program code described above, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. The content of the computer readable storage medium can be appropriately increased or decreased according to the requirements of the legislation and the patent practice in the jurisdiction.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art will understand that; the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions are not intended to depart from the spirit and scope of the various embodiments of the invention, which are also within the spirit and scope of the invention.

Claims (10)

1. A method of sensor time stamp calibration, the method comprising:
when an interrupt signal of a sensor is acquired, an interrupt time stamp is generated and a sequence number of an interrupt frame is acquired;
reading a data frame of a sensor by adopting a first-in first-out mode to obtain a data frame set;
the time stamp of the data frame in the set of data frames is calibrated based on the sequence number of the interrupt frame and the interrupt time stamp.
2. The sensor time stamp calibration method of claim 1, further comprising, after calibrating the time stamps of the data frames in the set of data frames:
acquiring the number of data frames in a sensor;
and when the number is greater than or equal to a preset threshold value, reading the data frames with the preset threshold value, storing the data frames into the data frame set, calibrating the time stamp of the data frames in the data frame set, and returning to acquire the number of the data frames in the sensor for cyclic reading until the number is smaller than the preset threshold value.
3. The sensor timestamp calibration method of claim 1 wherein the calibrating the timestamps of the data frames in the set of data frames based on the sequence numbers of the interrupt frames and the interrupt timestamps comprises:
acquiring a sequence number difference between a sequence number of each data frame in the data frame set and a sequence number of the interrupt frame;
obtaining a time difference between each data frame in the set of data frames and the interrupt frame based on a frame rate of a sensor and the sequence number difference;
and setting the time stamp of each data frame in the data frame set according to the interruption time stamp and the time difference between each data frame and the interruption frame so as to calibrate the time stamp of the data frame in the data frame set.
4. The sensor time stamp calibration method of claim 1, further comprising:
inquiring the number of data frames in the sensor at preset waiting time intervals;
and when the number is greater than or equal to a preset threshold value, reading the data frames with the preset threshold value in the sensor and calibrating the time stamp of the data frames.
5. The sensor time stamp calibration method of claim 4, wherein the preset wait time is determined according to a frame rate of the sensor.
6. A sensor timestamp calibration apparatus, the apparatus comprising:
the data reading module is used for reading the data frames of the sensor by adopting a first-in-first-out mode to obtain a data frame set;
the calibration module is used for generating an interrupt time stamp and acquiring the sequence number of an interrupt frame when the interrupt signal of the sensor is acquired; the time stamp of the data frame in the set of data frames is calibrated based on the sequence number of the interrupt frame and the interrupt time stamp.
7. The sensor time stamp calibration apparatus of claim 6, wherein the data reading module comprises a reading unit for acquiring the number of data frames in the sensor; and when the number is greater than or equal to the preset threshold, reading the data frames with the preset threshold number, storing the data frames into the data frame set, calibrating the time stamp of the data frames in the data frame set, and returning to acquire the number of the data frames in the sensor for cyclic reading until the number is smaller than the preset threshold.
8. The sensor timestamp calibration apparatus of claim 6 wherein said calibration module includes a frame sequence calibration unit for obtaining a sequence number difference between a sequence number of each data frame in said set of data frames and a sequence number of said interrupt frame; obtaining a time difference between each data frame in the set of data frames and the interrupt frame based on a frame rate of a sensor and the sequence number difference; and setting the time stamp of each data frame in the data frame set according to the interruption time stamp and the time difference between each data frame and the interruption frame so as to calibrate the time stamp of the data frame in the data frame set.
9. A smart terminal comprising a memory, a processor, and a sensor time stamp calibration program stored on the memory and executable on the processor, which when executed by the processor, implements the steps of the sensor time stamp calibration method of any of claims 1-5.
10. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a sensor timestamp calibration program, which when executed by a processor, implements the steps of the sensor timestamp calibration method according to any of claims 1-5.
CN202310372184.3A 2023-04-07 2023-04-07 Sensor timestamp calibration method and device, intelligent terminal and storage medium Pending CN116527185A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310372184.3A CN116527185A (en) 2023-04-07 2023-04-07 Sensor timestamp calibration method and device, intelligent terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310372184.3A CN116527185A (en) 2023-04-07 2023-04-07 Sensor timestamp calibration method and device, intelligent terminal and storage medium

Publications (1)

Publication Number Publication Date
CN116527185A true CN116527185A (en) 2023-08-01

Family

ID=87393207

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310372184.3A Pending CN116527185A (en) 2023-04-07 2023-04-07 Sensor timestamp calibration method and device, intelligent terminal and storage medium

Country Status (1)

Country Link
CN (1) CN116527185A (en)

Similar Documents

Publication Publication Date Title
EP2222003B1 (en) Field control system
CN108701055B (en) Vehicle control device and vehicle system
EP3621286B1 (en) Method, and apparatus for clock synchronization, device, storage medium and vehicle
US20200014525A1 (en) Method for time synchronization between two computing devices of a driver assistance system, driver assistance system, and motor vehicle
CN111585682A (en) Sensor time synchronization method and device and terminal equipment
CN112751983B (en) Image time synchronization method and device, electronic equipment and storage medium
CN112154614B (en) Sensing system, sensing apparatus, control method thereof, movable platform, and storage medium
US9600023B2 (en) Method and data processing unit for providing a timestamp
CN115371689A (en) Fusion positioning method and device for automatic driving vehicle and electronic equipment
US6543000B1 (en) Interrupt management system with timers and controller able to detect the interrupt missed and generate appropriate warning signal for error handling
CN116527185A (en) Sensor timestamp calibration method and device, intelligent terminal and storage medium
JP2001318807A (en) Method and device for controlling task switching
CN115866154B (en) Time delay measurement method, device and system of vehicle-mounted multi-camera system and automobile
CN113765611B (en) Time stamp determination method and related equipment
CN113132453B (en) Time synchronization circuit and method for synchronizing sensor data
CN114449129A (en) Multi-sensor time synchronization method and apparatus, electronic device, and storage medium
EP3936952A1 (en) Counter unit, counter unit control method, control device, and control system
US20230102907A1 (en) Device with time stamp synchronizing and related method
CN115047937B (en) Task control method and device based on real-time communication and vehicle control system
CN117270630A (en) System-on-chip and timestamp capturing method, device and storage medium thereof
CN112463125B (en) Timing method and equipment of virtual timer
CN116414766A (en) Heterogeneous system inter-core time synchronization method, heterogeneous system and mobile terminal
US20240086348A1 (en) Capturing timestamp-based data in a dynamically aligned window
CN117201423A (en) Data transmission method, device, computer equipment and storage medium
US5307488A (en) System interruption apparatus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination