Disclosure of Invention
In view of this, an object of the present application is to provide a multi-channel time measurement system and method based on an FPGA, and a laser scanner, so as to solve the problem of low accuracy of time measurement of a timing unit implemented based on an FPGA in the prior art. The specific technical scheme is as follows:
in one aspect, the present application provides a multichannel time measurement system based on an FPGA, including: the device comprises a preprocessing unit, a coarse time measuring unit, a fine time measuring unit, an integration unit and a calibration unit;
the preprocessing unit is used for preprocessing a laser signal emitted by the laser scanner and a laser echo signal received by any channel to obtain a processed signal;
the coarse time measuring unit is used for measuring coarse grain time between two pulses in the processed signal corresponding to any channel and transmitting the coarse grain time to the integration unit;
the fine time measuring unit is configured to measure fine-grained time between two pulses in the processed signal corresponding to any one channel and transmit the fine-grained time to the integrating unit, and a measurement time unit of the fine time measuring unit is smaller than a measurement time unit of the coarse time measuring unit;
the integration unit is used for integrating the coarse-grained time and the fine-grained time corresponding to the same channel to obtain a measurement time result corresponding to the channel;
and the calibration unit is used for calibrating the measurement time result corresponding to each channel by using the calibration parameters corresponding to each channel sent by the upper computer to obtain the calibration measurement time corresponding to each channel.
Optionally, the preprocessing unit is specifically configured to:
and carrying out exclusive or logical operation on the laser signal transmitted by the laser scanner and the laser echo signal received by any channel to obtain the processed signal.
Optionally, the integration unit comprises a decoder and an output buffer;
the decoder is used for receiving the fine-grained time output by the fine-grained time measuring unit, converting the fine-grained time into a digital signal and then transmitting the digital signal to the output buffer;
and the output buffer is used for receiving the coarse-grained time output by the coarse time measuring unit and integrating the coarse-grained time and the fine-grained time corresponding to the same channel to obtain a measuring time result corresponding to the channel.
Optionally, the calibration unit is specifically configured to:
receiving calibration parameters corresponding to each channel sent by an upper computer, wherein the calibration parameters are obtained by calibrating the measurement results of each channel and are stored in the upper computer;
and receiving the measuring time results output by the output buffer according to the channel sequence, and correcting the measuring time results of any channel by using the calibration parameters corresponding to the channel to obtain the calibration measuring time corresponding to the channel.
Optionally, the calibration unit is further configured to:
and sending the calibration measurement time corresponding to each channel to an upper computer, wherein the calibration measurement time is used for converting the upper computer into distance information according to the calibration measurement time.
On the other hand, the application also provides a multichannel time measuring method based on the FPGA, which comprises the following steps:
detecting a laser signal emitted by a laser scanner and a laser echo signal received by any channel of the laser scanner;
preprocessing the laser signal and a laser echo signal received by any channel to obtain a processed signal;
measuring the coarse grain time between two pulses in the processed signal corresponding to any channel;
measuring fine-grained time between two pulses in the processed signal corresponding to any channel;
integrating the coarse-grained time and the fine-grained time corresponding to the same channel to obtain a measurement time result corresponding to the channel;
and calibrating the measuring time result corresponding to the corresponding channel by using the received calibration parameter corresponding to each channel to obtain the calibration measuring time corresponding to each channel.
Optionally, the preprocessing the laser signal and the laser echo signal received by any channel to obtain a processed signal includes:
and carrying out exclusive or logical operation on the laser signal transmitted by the laser scanner and the laser echo signal received by any channel to obtain the processed signal.
Optionally, the integrating the coarse-grained time and the fine-grained time corresponding to the same channel to obtain a measurement time result corresponding to the channel includes:
converting the fine-grained time corresponding to the channel into a digital signal;
and integrating the digital signals of the coarse-grained time and the fine-grained time in a digital form to obtain a measurement time result corresponding to the channel.
Optionally, the calibrating the measurement time result corresponding to the corresponding channel by using the received calibration parameter corresponding to each channel to obtain the calibration measurement time corresponding to each channel includes:
receiving calibration parameters corresponding to each channel sent by an upper computer, wherein the calibration parameters are obtained by calibrating the measurement results of each channel and are stored in the upper computer;
and receiving the measuring time results corresponding to the channels according to the channel sequence, and correcting the measuring time results of the channels by using the calibration parameters corresponding to the channels for any channel to obtain the calibration measuring time corresponding to the channel.
In yet another aspect, the present application further provides a laser scanner comprising a laser transmitter for transmitting a laser signal, an echo receiver for receiving a laser echo signal reflected by a target object, and a time measurement system as described in any one of the above.
The application provides a multichannel time measurement system based on FPGA utilizes the laser signal of preprocessing unit to laser scanner transmission and the laser echo signal that arbitrary passageway was received to carry out the preliminary treatment to eliminate the instability of the input signal of inputing to this system, improved the degree of accuracy of input signal promptly, consequently, can improve the accuracy of measuring time result to a certain extent. Meanwhile, the system comprises a plurality of measuring channels, the measuring difference among the channels is not negligible, and in order to solve the measuring error existing among the channels, after the measuring time result corresponding to each channel is obtained, the measuring time result corresponding to each channel is calibrated by using a calibration unit, so that the measured time of each channel keeps good consistency, namely the time measuring accuracy of each measuring channel is improved to a certain extent. Moreover, if the application scenes are different, the calibration parameters of the corresponding measurement channels of the system are possibly different, the calibration parameters corresponding to the measurement channels in the scene can be respectively calibrated according to the actual application scenes and stored in the upper computer, and then the upper computer sends the calibration parameters corresponding to the current scene of the system to the FPGA, so that the calibration parameters are not required to be burnt in the FPGA, the operation is simple, and the calibration parameters can be adjusted at any time according to different use scenes.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, a schematic structural diagram of an FPGA-based multi-channel time measurement system for measuring a time between a laser signal emitted by a laser scanner and a laser echo signal returned after the laser signal reaches a target according to an embodiment of the present application is shown. And then, the distance information from the laser scanner to the target is calculated from the time.
As shown in fig. 1, the system includes a preprocessing unit 110, a coarse time measurement unit 120, a fine time measurement unit 130, an integration unit 140, and a calibration unit 150.
The preprocessing unit 110 is configured to preprocess a laser signal emitted by the laser scanner and a laser echo signal received by any channel to obtain a processed signal.
In one embodiment of the present application, 16 laser echo receiving channels (herein simply referred to as channels) are designed using internal resources of an FPGA chip. Thereby solve the laser scanner multichannel and receive and the demand of little volume, both guaranteed laser radar time measurement precision and can realize the miniaturized, miniaturized demand of laser radar again, consequently adopt the laser radar of this system more to be applicable to scenes such as unmanned aerial vehicle, on-vehicle.
In a possible implementation manner of the present application, the preprocessing unit 110 performs an exclusive or process on the laser signal and the laser echo signal received by any channel to obtain a processed signal.
As shown in fig. 2, the laser scanner emits a laser signal corresponding to a waveform indicated by start, and the laser echo signal corresponds to a waveform indicated by stop, and the time measurement system is used to measure the time between the rising edges of the start signal and the stop signal. The waveform denoted by clk is a clock waveform used by a non-inverting counter in the coarse time measurement unit, and the waveform denoted by clk180 ° is a clock waveform used by an inverting counter.
Specifically, a clock module is designed in the FPGA, and the clock module can generate a clock signal of 200MHZ, sample a laser signal emitted by the laser scanner and received laser echo signals of each channel at a frequency of 200MHZ, and perform xor logic on a start signal and a stop signal obtained by sampling by using the preprocessing unit 110 to obtain a processed signal, that is, a pulse signal.
In one embodiment, when a rising edge of the start signal obtained by sampling arrives, the preprocessing unit sets the pulse signal to a high level, and the high level is set to a low level after lasting for a preset time (for example, 20 ns); when the rising edge of the stop signal is detected to arrive, the preprocessing unit puts the pulse signal to be high level again, and the high level is put to be low level after lasting for a preset time (for example, 20 ns).
After the above-mentioned processing by the preprocessing unit, the time between the rising edge of the start signal and the rising edge of the stop signal is measured and converted into the time between the two rising edges of the pulse signal. Because the stability of the pulse signal generated in the FPGA is higher, the stability of the signal obtained after the signal is processed by the preprocessing unit is higher, and the measurement accuracy of the time measurement system is further improved to a certain extent.
A coarse time measurement unit 120, configured to measure a coarse-grained time between two pulses in the processed signal corresponding to any channel, and transmit the coarse-grained time to the integration unit.
The coarse time measuring unit adopts two reverse phase counters to count time, specifically adopts two 8-bit binary counters to count circularly respectively, the two counters have 180-degree clock phase difference, and a plurality of channels adopt the same coarse time measuring unit to count coarse granularity. The whole number of cycles in the pulse signal is measured with a coarse time measurement unit.
And the fine time measuring unit 130 is configured to measure a fine-grained time between two pulses in the processed signal corresponding to any one of the channels, and transmit the fine-grained time to the integrating unit, where a measuring time unit of the fine time measuring unit is smaller than a measuring time unit of the coarse time measuring unit.
The fine time measuring unit adopts a tap delay chain method to cascade delay time into a linear structure, and a tap is introduced behind each delay unit and is input into a register. The Start signal propagates in the delay chain, and the stop signal arrival time register latches data of each tap in the delay chain. The smaller the delay time of the delay unit is, the higher the measurement resolution is; the larger the number of delayed cells in the delay chain, the larger the measurement range.
The fine time measuring unit 130 is used to measure the non-whole period time of the leading and trailing edges in the pulse signal, such as t1 and t2 in fig. 2. And each channel adopts the same fine time measuring unit to perform fine granularity timing.
In an embodiment of the present application, the average delay of each delay cell in the delay chain is τ, and then t1 ═ n1 × τ and t2 ═ n2 × τ, where n1 represents the number of delay cells in the delay chain that the leading edge of the pulse signal passes through, and n2 represents the number of delay cells in the delay chain that the trailing edge of the pulse signal passes through. Wherein τ can be measured by inputting a standard time into the delay chain.
The integration unit 140 is configured to integrate coarse-grained time and fine-grained time corresponding to the same channel to obtain a measurement time result corresponding to the channel.
For the same channel, the integration unit 140 integrates the whole period time measured by the coarse time measurement unit and the non-whole period time measured by the fine time measurement unit to obtain the time between the laser echo signal received by the channel and the laser signal emitted by the laser scanner.
For example, in the example shown in fig. 2, the whole period time of the pulse signal measured by the coarse time measurement unit is n × T, where T is the period time of the measurement clock used by the coarse time measurement unit. The fine time measuring unit measures the non-full period time of the leading edge of the pulse signal as t1 and the non-full period time of the trailing edge as t 2. The time T between two rising edges of the pulse signal is T1+ n × T-T2.
In addition, the time delay of the start signal and the stop signal transmitted from the exterior of the FPGA chip to the interior of the chip needs to be considered, and the time delay can be searched from an ISE comprehensive wiring tool.
In one embodiment of the present application, the integration unit includes a decoder 141 and an output buffer 142.
The decoder 141 is configured to convert the thermometer code output by the fine time measurement unit into a binary code. The thermometer code is a counting mode, and a fine counter adopted in the fine time measuring unit counts to generate a counting value.
The output buffer 142 is used for integrating the digital result output by the coarse time measurement unit and the digital result output by the decoder, and then transmitting the integrated result to another clock domain device, which is transmitted to the calibration module in this application. That is, the whole period time data measured by the coarse time measuring unit and the non-whole period time data measured by the fine time measuring unit are integrated together. For example, the whole period data and the non-whole period data corresponding to the same channel are integrated into one piece of data, and the measurement time result corresponding to the channel can be calculated according to the data.
In the embodiment of the present application, the result output by the coarse time measurement unit is a digital signal, so that the coarse-grained time does not need to be converted by a decoder. The result output by the fine time measuring unit is not a digital signal, so that a decoder is needed to convert the fine-grained time into the digital signal, namely, the non-binary fine-grained time is converted into a binary code.
The Output buffer adopts an asynchronous First-in First-out (FIFO) queue structure, the asynchronous FIFO queue structure refers to that reading and writing respectively adopt mutually asynchronous clock signals, and real-time data can be quickly and conveniently transmitted between two different clock systems by using the asynchronous FIFO queue structure.
The output buffer 142 outputs the result to the calibration unit 150 for calibration in the channel order.
And the calibration unit 150 is configured to calibrate the measurement time result corresponding to each channel by using the calibration parameter corresponding to each channel sent by the upper computer, so as to obtain the calibration measurement time corresponding to each channel.
The measured time of each channel may be inconsistent due to the difference between the channels, and the accuracy of the measured time result is low. In consideration of the difference between the channels, the calibration unit 150 is used to calibrate the measurement time results corresponding to each channel, wherein the calibration parameters are provided by the upper computer.
The application scenarios of the time measurement system are different, and the measurement errors of the channels may be different, so that the measurement errors of the channels in the time measurement system can be calibrated through tests according to the requirements of the actual application scenarios in consideration of the situation, and the calibration parameters required by the channels can be obtained. And then, storing the obtained calibration parameters into an upper computer, and sending the calibration parameters to the FPGA chip by the upper computer. And the FPGA chip calibrates the measurement time results according to the calibration parameters of the channels sent by the upper computer for measuring the measurement time results corresponding to the channels, so that the time obtained by each channel is kept in good consistency. Therefore, the calibration parameters are not required to be burnt into the FPGA chip, the operation is simpler, the calibration parameters are easier to modify, and the flexibility of the FPGA-based multi-channel time measurement system is improved.
In other embodiments of the invention, the calibration measurement time corresponding to each channel calibrated by the calibration module is uploaded to the upper computer through a network cable, the upper computer calculates the distance information between the laser scanner and the target by using the calibration measurement time corresponding to each channel, and then the point cloud data of the laser scanner is obtained by combining the angle information of the laser scanner.
The point cloud data of the laser scanner means that the scanning result of the laser scanner is recorded in a point form.
The multichannel time measurement system based on the FPGA provided by this embodiment utilizes the preprocessing unit to preprocess the laser signal emitted by the laser scanner and the laser echo signal received by any channel, thereby eliminating the instability of the input signal input to the system, i.e. improving the accuracy of the input signal, and therefore, the accuracy of the measurement time result can be improved to a certain extent. Meanwhile, the system comprises a plurality of measuring channels, the measuring difference among the channels is not negligible, and in order to solve the measuring error existing among the channels, after the measuring time result corresponding to each channel is obtained, the measuring time result corresponding to each channel is calibrated by using a calibration unit, so that the measured time of each channel keeps good consistency, namely the time measuring accuracy of each measuring channel is improved to a certain extent. Moreover, if the application scenes are different, the calibration parameters of the corresponding measurement channels of the system are possibly different, the calibration parameters corresponding to the measurement channels in the scene can be respectively calibrated according to the actual application scenes and stored in the upper computer, and then the upper computer sends the calibration parameters corresponding to the current scene of the system to the FPGA, so that the calibration parameters are not required to be burnt in the FPGA, the operation is simple, and the calibration parameters can be adjusted at any time according to different use scenes.
Corresponding to the embodiment of the multi-channel time measuring system based on the FPGA, the application also provides an embodiment of a multi-channel time measuring method based on the FPGA.
Referring to fig. 3, a flowchart of an FPGA-based multi-channel time measurement method according to an embodiment of the present application is shown, where the method may include the following steps:
and S110, detecting a laser signal emitted by the laser scanner and a laser echo signal received by any channel of the laser scanner.
And designing 16 laser echo information signal receiving channels by using internal resources of the FPGA chip to receive laser echo signals reflected by the target object.
And S120, preprocessing the laser signal and the laser echo signal received by any channel to obtain a processed signal.
In one possible implementation manner of the present application, an exclusive or processing is performed on a laser signal (start signal) and a laser echo signal (stop signal) received by any channel to obtain a processed signal (pulse signal).
After the above-mentioned processing by the preprocessing unit, the time between the rising edge of the start signal and the rising edge of the stop signal is measured and converted into the time between the two rising edges of the pulse signal. Because the stability of the pulse signal generated in the FPGA chip is higher, the stability of the signal obtained after the signal is processed by the preprocessing unit is higher, and the measurement accuracy of the time measurement system is further improved to a certain extent.
And S130, measuring coarse grain time between two pulses in the processed signal corresponding to any channel.
The step is mainly to measure the whole cycle time of the pulse signal, and can be implemented by using a coarse time measurement unit, please refer to the related content of the coarse time measurement unit in the above embodiments, which is not described herein again.
And S140, measuring fine-grained time between two pulses in the processed signal corresponding to any channel.
The step is mainly to measure the non-whole period time of the pulse signal, and can be implemented by using a fine time measurement unit, please refer to the related content of the fine time measurement unit in the above embodiments, which is not described herein again.
S150, integrating the coarse-grained time and the fine-grained time corresponding to the same channel to obtain a measurement time result corresponding to the channel.
The step is mainly to integrate the coarse grain time and the fine grain time of the same channel into one piece of data, and then to calculate the measuring time result corresponding to the channel by using the data.
In one embodiment of the present application, this step may include the following process: converting the fine-grained time corresponding to the channel into a digital signal; and integrating the digital signals of the coarse-grained time and the fine-grained time in a digital form to obtain a measurement time result corresponding to the channel.
And S160, calibrating the measuring time result corresponding to the corresponding channel by using the received calibration parameter corresponding to each channel to obtain the calibration measuring time corresponding to each channel.
The measured time of each channel may be inconsistent due to the difference between the channels, and the accuracy of the measured time result is low. In consideration of the difference between the channels, the measuring time results corresponding to the channels can be calibrated by using the step, so that the measuring time of each channel keeps good consistency. Wherein, the calibration parameters are provided by an upper computer.
In one embodiment of the present application, this step may include the following process:
receiving calibration parameters corresponding to each channel sent by an upper computer, wherein the calibration parameters are obtained by calibrating the measurement results of each channel and are stored in the upper computer; and then, receiving the measuring time results corresponding to the channels according to the channel sequence, and correcting the measuring time results of the channels by using the calibration parameters corresponding to the channels for any channel to obtain the calibration measuring time corresponding to the channel.
For example, if the calibration parameter for a certain channel is +0.01ms, the measurement time result for the channel is 10ms, and the measurement time after calibration is 10.01 ms.
In other embodiments of the application, the calibration measurement time corresponding to each channel is obtained and then sent to the upper computer, the upper computer converts the calibration measurement time corresponding to each channel into distance information, and the point cloud data of the laser scanner is obtained by combining the angle information of the laser scanner.
The multichannel time measuring method based on the FPGA provided in this embodiment preprocesses the laser signal emitted by the laser scanner and the laser echo signal received by any channel, so as to eliminate instability of the input signal input to the system, that is, improve accuracy of the input signal, and therefore, can improve accuracy of a time measurement result to a certain extent. Meanwhile, after the measuring time results corresponding to the channels are obtained, the measuring time results corresponding to the channels are calibrated by using the calibration unit, so that the measured time of each channel keeps good consistency, namely the time measuring accuracy of each measuring channel is improved to a certain extent. In addition, the calibration parameters of each channel are stored in the upper computer, and the upper computer sends the calibration parameters corresponding to the current scene of the system to the FPGA, so that the calibration parameters are not required to be burnt in the FPGA, the operation is simple, and the calibration parameters can be adjusted at any time according to different use scenes.
In yet another aspect, as shown in fig. 4, the present embodiment further provides a laser scanner, which includes a laser transmitter 210, an echo receiver 220, a time measurement system 230, and an upper computer 240.
A laser transmitter 210 for transmitting a laser signal to a target.
And an echo receiver 220 for receiving the laser echo signal reflected by the target.
A time measurement system 230 for measuring a time interval between the transmission of the laser signal by the transmitter and the reception of the laser echo signal by the echo receiver. The time measurement system 230 is the multi-channel time measurement system based on the FPGA provided in the above embodiments, and is not described herein again.
And the upper computer 240 is used for calculating and obtaining distance information between the laser scanner and the target according to the time interval.
In the laser scanner provided in this embodiment, the time measurement system preprocesses the laser signal emitted by the laser scanner and the laser echo signal received by any channel, so as to eliminate instability of the input signal input to the time measurement system, that is, improve the accuracy of the input signal, and therefore, the accuracy of the time measurement result can be improved to a certain extent. Meanwhile, after the measuring time results corresponding to the channels are obtained, the measuring time results corresponding to the channels are calibrated by using the calibration unit, so that the measured time of each channel keeps good consistency, namely the time measuring accuracy of each measuring channel is improved to a certain extent. In addition, the calibration parameters of each channel are stored in the upper computer, and then the upper computer sends the calibration parameters corresponding to the current scene of the system to the FPGA, so that the calibration parameters are not required to be burnt in the FPGA, the operation is simple, and the calibration parameters can be adjusted at any time according to different use scenes.
While, for purposes of simplicity of explanation, the foregoing method embodiments have been described as a series of acts or combination of acts, it will be appreciated by those skilled in the art that the present invention is not limited by the illustrated ordering of acts, as some steps may occur in other orders or concurrently with other steps in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The steps in the method of the embodiments of the present application may be sequentially adjusted, combined, and deleted according to actual needs.
The device and the modules and sub-modules in the terminal in the embodiments of the present application can be combined, divided and deleted according to actual needs.
In the several embodiments provided in the present application, it should be understood that the disclosed terminal, apparatus and method may be implemented in other manners. For example, the above-described terminal embodiments are merely illustrative, and for example, the division of a module or a sub-module is only one logical division, and there may be other divisions when the terminal is actually implemented, for example, a plurality of sub-modules or modules may be combined or integrated into another module, or some features may be omitted or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or modules, and may be in an electrical, mechanical or other form.
The modules or sub-modules described as separate parts may or may not be physically separate, and parts that are modules or sub-modules may or may not be physical modules or sub-modules, may be located in one place, or may be distributed over a plurality of network modules or sub-modules. Some or all of the modules or sub-modules can be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, each functional module or sub-module in the embodiments of the present application may be integrated into one processing module, or each module or sub-module may exist alone physically, or two or more modules or sub-modules may be integrated into one module. The integrated modules or sub-modules may be implemented in the form of hardware, or may be implemented in the form of software functional modules or sub-modules.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.