Abstract:
A method for measuring distance involves calculating a distance based on light speed and a time taken by an optical signal to travel to an object and return therefrom. The method includes calculating a time based on a cycle number of a reference signal under a clock mask synchronized with emission and reception of the optical signal; correcting the time according to a plurality of phase shift signals generated based on the reference signal; and minimizing an error of the time by increasing the quantity of the phase shift signals. The method enhances the accuracy of the measured time taken by an optical signal to travel to an object and return therefrom, speeds up measurement, and reduces the required circuit areas. A system for measuring distance is further introduced for use with the method.

Description:
CROSS-REFERENCE TO RELATED APPLICATION 
       [0001]    This non-provisional application claims priority under 35 U.S.C. §119(a) on Patent Application No(s). 100125209 filed in Taiwan, R.O.C. on Jul. 15, 2011, the entire contents of which are hereby incorporated by reference. 
       FIELD OF TECHNOLOGY 
       [0002]    The present invention relates to methods and systems for measuring distance, and more particularly, to a precise method and system for measuring distance. 
       BACKGROUND 
       [0003]    A method and system for measuring distance of an object usually entails performing two tasks, that is, receiving and emitting an optical signal, and performing time measurement, and then involve performing distance computation according to the light speed and an obtained time, so as to obtain the distance between the optical signal and the object. Time measurement requires measuring the time taken by the optical signal to travel to the object and return from the object and estimating the distance of the object according to the time and the light speed. Time measurement usually involves calculating, by conversion, the time taken by the optical signal to alternate between reception and emission according to a fundamental frequency signal (or a known time as defined). 
         [0004]    To be specific, time measurement involves calculating the time taken by the optical signal to alternate between reception and emission according to the number of cycles of a fundamental frequency signal and a preset frequency of the fundamental frequency signal, and thus the precision of the calculated number of cycles of the fundamental frequency signal affects the accuracy of the calculated time. 
         [0005]    Normally, calculation of the number of cycles of the fundamental frequency signal requires counting, that is, counting the number of cycles of the fundamental frequency signal during a gate time period that starts from a point in time of reception of an optical signal and ends at a point in time of emission of the optical signal. Nonetheless, the number of cycles of the fundamental frequency signal during the gate time period is seldom an integer, and thus the method is likely to cause an error at the beginning and the end of the gate time period—underestimating or overestimating by a half cycle, for example. 
       SUMMARY 
       [0006]    It is an objective of the present invention to enhance the computation speed and accuracy of distance measurement. 
         [0007]    Another objective of the present invention is to reduce circuit-occupied area and reduce power consumption. 
         [0008]    In order to achieve the above and other objectives, the present invention provides a method for measuring distance, by performing computation of a distance of an object based on a light speed of an optical signal and a time taken by the optical signal to travel to the object and return from the object and obtained by means of time measurement, characterized in that the time measurement comprises the steps of: providing a reference signal; generating a plurality of phase shift signals of a same frequency based on the reference signal, the phase shift signals being spaced apart from each other by a fixed phase; setting a clock mask, the clock mask starting from an emitting signal when emitting the optical signal and ending at a receiving signal when receiving the optical signal reflected; counting a number Nd 1  of second triggering states occurring to the phase shift signals during a time period from a point in time of commencement of the clock mask to occurrence of a first triggering state to the reference signal; counting a number Nb of cycles of the reference signal during the time period of the clock mask based on the first triggering state; counting a number Nd 2  of the second triggering states occurring to the phase shift signals during a time period from a point in time of termination of the clock mask to occurrence of the first triggering state to the reference signal; and obtaining a time t taken by the optical signal to travel to the object and return from the object with the equation below: t=(Nb/Fb)+[Nd 1 /(Fb/M)]−[Nd 2 /(Fb/M)], wherein frequency of the reference signal is denoted by Fb and number of the phase shift signals by M, and M≧2. 
         [0009]    In order to achieve the above and other objectives, the present invention provides a system for measuring distance, comprising: an optical signal generating unit for emitting an optical signal, receiving the optical signal reflected from an object, and generating an emitting signal and a receiving signal based on emission and reception of the optical signal, respectively; a signal input end for receiving the emitting signal and the receiving signal; a distance measurement apparatus connected to the signal input end for receiving the emitting signal and the receiving signal, generating a reference signal of a frequency Fb, generating M phase shift signals based on the reference signal, characterized by a same frequency, and spaced apart from each other by a fixed phase, generating a clock mask starting from the emitting signal and ending at the receiving signal, counting a number Nd 1  of second triggering states occurring to the phase shift signals during a time period from a point in time of commencement of the clock mask to occurrence of a first triggering state to the reference signal, counting a number Nb of cycles of the reference signal during the time period of the clock mask based on the first triggering state, counting a number Nd 2  of second triggering states occurring to the phase shift signals during a time period from a point in time of termination of the clock mask to occurrence of a first triggering state to the reference signal, and outputting values Fb, M, Nb, Nd 1 , and Nd 2 ; and a computing device connected to the distance measurement apparatus for receiving the values, performing computation with the equation below to obtain a time t taken by the optical signal to travel to the object and return from the object, and performing computation of distance of the object based on the time t and a light speed c, t=(Nb/Fb)+[Nd 1 /(Fb/M)]−[Nd 2 /(Fb/M)] where M≧2. 
         [0010]    In an embodiment, the distance measurement apparatus comprises: a fundamental frequency generating unit for generating a fundamental frequency signal; a frequency multiplying unit connected to the fundamental frequency generating unit for turning the fundamental frequency signal into the reference signal by frequency multiplication; and a programmable gate array connected to the signal input end for receiving the emitting signal and the receiving signal, connected to the frequency multiplying unit for receiving the reference signal, and adapted to generate the values M, Nb, Nd 1 , and Nd 2  and output the values Fb, M, Nb, Nd 1 , and Nd 2 . 
         [0011]    In an embodiment, the computing device is one of a control unit and a computer device. 
         [0012]    In an embodiment, the first triggering state is one of a rising edge triggering state and a falling edge triggering state, and the second triggering state is one of a rising edge triggering state and a falling edge triggering state. 
         [0013]    In an embodiment, four or eight said phase shift signals are generated. 
         [0014]    In an embodiment, the computing device replaces the value Fb with a default value. 
         [0015]    Accordingly, a method and system for measuring distance of the present invention eliminate time measurement errors by quick and precise multiphase processing and multiply the accuracy of measurement in accordance with the quantity of generated phase shift signals, so as to reduce the area occupied by a circuit and reduce power consumption. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0016]    Objectives, features, and advantages of the present invention are hereunder illustrated with specific embodiments in conjunction with the accompanying drawings, in which: 
           [0017]      FIG. 1  is a timing diagram of a method for measuring distance according to an embodiment of the present invention; 
           [0018]      FIG. 2  is a flow chart of the method for measuring distance according to an embodiment of the present invention; and 
           [0019]      FIG. 3  is a function block diagram of a system for measuring distance according to an embodiment of the present invention. 
       
    
    
     DETAILED DESCRIPTION 
       [0020]    The steps of a method for measuring distance of the present invention are described in specific embodiments thereof and are, unless otherwise specified, interchangeable in terms of sequence. Furthermore, the concept of “connection” used in the description of specific embodiments of a system for measuring distance according to the present invention is not limited to direct connection; instead, connection can also be effectuated by an intervening element. Also, a “first triggering state” and a “second triggering state” used in the description of the method and system for measuring distance of the present invention comprise one of a rising edge triggering state and a falling edge triggering state. The first triggering state and the second triggering state are not mutually exclusive; hence, both the first triggering state and the second triggering state may be rising edge triggering states or falling edge triggering states. 
         [0021]    In the embodiments of the present invention, a measured time is obtained by making reference to the course of a journey undertaken by an optical signal to and fro between an object and a measurement system, by multiphase processing, and by predetermined equations, and eventually the measured distance between the optical signal and the object is obtained based on the light speed of the optical signal and the measured time. 
         [0022]    Referring to  FIG. 1 , there is shown a timing diagram of a method for measuring distance according to an embodiment of the present invention. As shown in  FIG. 1 , this embodiment is exemplified by eight phase shift signals. Persons skilled in the art should be able to understand that, given at least two phase shift signals, the method and system for measuring distance of the present invention is effective in eliminating errors of time measurement and thereby enhancing the accuracy of the time measured. 
         [0023]    A method for measuring distance according to an embodiment of the present invention comprises the steps of: 
         [0024]    As shown in  FIG. 1 , in the course of the distance measurement of an object, an optical signal generating unit generates an emitting signal SS and a receiving signal ES when emitting an optical signal and receiving the optical signal from the object, respectively. In an embodiment of the present invention, time measurement starts with the step of providing a reference signal Fb and the step of generating multilevel phase shift signals Fb-p 1 ˜Fb-p 8  of the same frequency based on the reference signal, wherein the phase shift signals Fb-p 1 ˜Fb-p 8  are spaced apart from each other by a fixed phase. 
         [0025]    The reference signal Fb functions as a fundamental frequency. The phase shift signals are generated from the reference signal Fb. Normally, the phase shift of a signal is effectuated by a digital clock manager (DCM) of a programmable gate array (FPGA). In this embodiment, eight phase shift signals Fb-p 1 ˜Fb-p 8  are processed by two digital clock managers, and the reference signal Fb is decomposed by a digital clock manager to form four phase shift signals. However, persons skilled in the art should be able to understand that a user can still selectively shut down four of the phase shift decomposition processes even with just one digital clock manager. Hence, with only one digital clock manager, it is still possible to decompose the reference signal Fb into two or three phase shift signals. Hence, users can select the quantity of required phase shift signals as needed and as appropriate for operation of a digital clock manager. Regarding the spacing of phase shift signals, a digital clock manager divides 360° into equal phase portions and distributes the equal phase portions among the phase shift signals. For example, the phase equals 360°/(M−1), where M denotes the number of phase shift signals. 
         [0026]    Afterward, a clock mask mk is set. The clock mask mk thus set starts from the emitting signal SS when emitting the optical signal and ends at the receiving signal ES when receiving the optical signal. Hence, the clock mask mk can be triggered synchronously with the signal SS and the signal ES, such that the time period of time measurement equals the time taken by the optical signal to undertake a journey to and fro between the object and a measurement system. Regarding the rising edge triggering signal SS and signal ES shown in  FIG. 1 , persons skilled in the art understand that the signal SS and the signal ES can be replaced by the falling edge triggering states for denoting the point in time of sending the optical signal and the point in time of receiving the optical signal, respectively. 
         [0027]    Upon initialization of the clock mask mk, time measurement kicks off. Referring to  FIG. 1 , the reference signal Fb does not synchronize with the clock mask mk; hence, the time actually taken to effect the number Nb of cycles of the reference signal Fb measured does not fall within the range of the clock mask mk, thereby resulting in front-end errors and back-end errors. 
         [0028]    Hence, in an embodiment of the present invention, the front-end and back-end errors which occur in the course of time measurement are eliminated by means of the phase shift signals. 
         [0029]    Regarding the front-end errors, the number Nd 1  of second triggering states (rising-edge or falling-edge triggering states) that occur to the phase shift signals Fb-p 1 ˜Fb-p 8  during the time period from the point in time of commencement of the clock mask mk to the point in time when a first triggering state occurs to the reference signal Fb is counted. 
         [0030]    Regarding the back-end errors, the number Nd 2  of second triggering states (rising-edge or falling-edge triggering states) that occur to the phase shift signals Fb-p 1 ˜Fb-p 8  during the time period from the point in time of termination of the clock mask mk to the point in time when a first triggering state occurs to the reference signal Fb is counted. 
         [0031]    Counting the second triggering states that occur to the phase shift signals Fb-p 1 ˜Fb-p 8  means that a back-end error time period requires selecting the rising edge triggering state as the second triggering state when a front-end error time period requires selecting the rising edge triggering state as the second triggering state, or means that a back-end error time period requires selecting the falling edge triggering state as the second triggering state when a front-end error time period requires selecting the falling edge triggering state as the second triggering state. As shown in  FIG. 1 , the rising edge triggering state is selected to be the second triggering state, thereby setting Nd 1  to 3 and Nd 2  to 5. 
         [0032]    As shown in  FIG. 1 , the time actually taken by the optical signal to travel to and fro between the object and the measurement system is denoted by t as expressed by equation (1): 
         [0000]        t=tb+td 1 −td 2  (1)
 
         [0033]    Hence, in a subsequent calculation process, the number Nd 1  and the number Nd 2  are used in calculating front-end error time td 1  and back-end error time td 2  to therefore eliminate front-end and back-end errors. 
         [0034]    Nb denotes the number of cycles of the reference signal Fb measured based on the first triggering state within the time period of the clock mask mk Fb also denotes the frequency of the reference signal Fb. M denotes the number of the phase shift signals. The feature “being based on the first triggering state” means that the counting of the number of cycles of the reference signal Fb is in line with the point in time of termination of the front-end error time period td 1 . Hence, as shown in  FIG. 1 , the point in time of commencement of the counting of the number of cycles of the reference signal Fb starts from the rising edge triggering state rather than the falling edge triggering state. Conversely, if the time period td 1  is changed to a time period starting from the point in time of commencement of the clock mask mk and ending at the point in time of occurrence of a falling edge triggering state (first triggering state) to the reference signal Fb, the front-end error time period td 1  will end at the falling edge triggering state, and the point in time of commencement of the counting of the number of cycles of the reference signal Fb will start from the falling edge triggering state. Hence, as indicated by the relationship between time, frequency, and number of cycles, clock mask time tb can be calculated by equation (2), 
         [0000]        tb =( Nb/Fb )  (2)
 
         [0035]    the front-end error time td 1  is calculated by equation (3), 
         [0000]        td 1 =[Nd 1/( Fb/M )]  (3)
 
         [0036]    the back-end error time td 2  is calculated by equation (4), 
         [0000]        td 2 =[Nd 2/( Fb/M )]  (4)
 
         [0037]    Accordingly, the measured time t is calculated by equation (5), 
         [0000]        t =( Nb/Fb )+[ Nd 1/( Fb/M )]−[ Nd 2/( Fb/M )]  (5)
 
         [0000]    wherein M denotes the number of the phase shift signals, with M≧2, indicating that at least two said phase shift signals are generated. 
         [0038]    Furthermore, as indicated by equation (5), the more the phase shift signals are, the more the multiplication of enhancement of accuracy of measurement is. Hence, when compared with a conventional method which is not based on calibration of front-end errors and back-end errors, the method shown in  FIG. 1  and disclosed in an embodiment of the present invention increases accuracy eightfold. The more the phase shift signals are, the shorter the time period is, thereby eliminating increasingly small errors. 
         [0039]    Referring to  FIG. 2 , there is shown a flow chart of the method for measuring distance according to an embodiment of the present invention. Referring to  FIG. 1 , time measurement depends on distance measurement, except for provision of the reference signal Fb and the phase shift signals Fb-p 1 ˜Fb-p 8  thereof in advance (or in synchrony with the clock mask). The method for measuring time comprises the steps of: (S 101 ) providing a reference signal Fb and a plurality of phase shift signals Fb-p 1 ˜Fb-p 8 ; (S 102 ) setting a clock mask mk based on signals SS and ES; (S 103 ) counting the number Nd 1  of front-end errors; (S 104 ) shutting down the clock mask mk and obtaining the cycle number Nb; (S 105 ) counting the number Nd 2  of back-end errors; (S 106 ) performing computation by equation (5); and (S 107 ) performing computation of distance of the object based on the time t and a light speed c, that is, (c×t). 
         [0040]    Referring to  FIG. 3 , there is shown a function block diagram of a system for measuring distance according to an embodiment of the present invention. As shown in  FIG. 3 , the distance measuring system  100  comprises an optical signal generating unit  105 , a signal input end  110 , a distance measurement apparatus  120 , and a computing device  130 . 
         [0041]    The optical signal generating unit  105  emits an optical signal, receives the optical signal reflected from an object, and generates an emitting signal SS and a receiving signal ES based on the emission and reception of the optical signal, respectively. 
         [0042]    The signal input end  110  receives the emitting signal SS and the receiving signal ES. 
         [0043]    The distance measurement apparatus  120  is connected to the signal input end  110  for receiving the emitting signal SS and the receiving signal ES. The distance measurement apparatus  120  generates the following signals and/or values: the reference signal Fb; M phase shift signals based on the reference signal, characterized by a same frequency, and spaced apart from each other by a fixed phase; a clock mask mk starting from the emitting signal SS and ending at the receiving signal ES; a number Nd 1  of second triggering states occurring to the phase shift signals during a front-end error time period; a number Nb of cycles of the first triggering state occurring to the reference signal Fb during the time period of the clock mask mk; a number Nd 2  of second triggering states occurring to the phase shift signals during a back-end error time period; and the output values Fb, M, Nb, Nd 1 , and Nd 2 . 
         [0044]    In an embodiment, the distance measurement apparatus  120  comprises: a fundamental frequency generating unit  121 , a frequency multiplying unit  123 , and a programmable gate array  125 . The fundamental frequency generating unit  121  generates a fundamental frequency signal. Normally, a low fundamental frequency is generated by a crystal oscillator to cut costs, and then the fundamental frequency is boosted by the frequency multiplying unit  123  connected to the fundamental frequency generating unit  121  for functioning as the reference signal Fb. 
         [0045]    The programmable gate array  125  comprises a digital clock manager for functioning as a phase shift generating circuit, a differential circuit for performing upper or lower differentiation (rising edge triggering or falling edge triggering) to count Nd 1  and Nd 2 , and a mask circuit for generating the clock mask mk and counting the reference signal Fb. Accordingly, the programmable gate array  125  generates the values M, Nb, Nd 1 , and Nd 2  and outputs the count values Fb, M, Nb, Nd 1 , and Nd 2 . 
         [0046]    The programmable gate array is a conventional element. The system for measuring distance according to an embodiment of the present invention achieves the objectives of the present invention by means of logical elements of the system for measuring distance. The method for measuring distance according to an embodiment of the present invention reduces the required number of the logical elements, dispenses with a large-sized programmable gate array chip, and thus reduces the circuit-occupied area and downsizes the product. For example, if the computing function of a computing device is also incorporated into the programmable gate array, the required number of the logical elements will be greatly increased, thereby increasing the circuit-occupied area. Due to its structural design, the programmable gate array has to effectuate the computation operation by a logical means at the cost of increasing the requirement of high-speed logical elements. Although a special programmable gate array having a computing structure circuit therein can perform high-speed computation and reduce the space requirement of logical elements, it incurs an excessively high cost. 
         [0047]    The computing device  130  is connected to the distance measurement apparatus  120  for receiving the values and performing computation thereon with equation (5) to obtain the measured time t, and perform distance computation with the light speed c so as to calculate the distance between the measuring system and the object. The computing device  130  is a control unit (MCU) or a computer device. If the computing device  130  is a control unit, then the control unit is usually disposed on the same circuit board as the distance measurement apparatus  120  is, such that the distance measuring system  100  in its entirety is integrated onto a module; however, the computing device  130  can also be an external computer device for processing a computation procedure in whole with data provided by a measuring module. 
         [0048]    To reduce errors further, it is feasible to perform a high-precision measurement process on the generated reference signal Fb beforehand. To preclude any error which might otherwise be produced because a frequency actually generated by a fundamental frequency generating unit and a frequency multiplier is different from a given frequency level (that is, a frequency level set forth in the specifications of the fundamental frequency generating unit and the frequency multiplier), it is feasible to measure the reference signal Fb in advance by means of a high-precision frequency counter having a higher resolution than the frequency of the reference signal Fb, and then use the measured reference signal Fb as a default value to be directly stored in the computing device  130 . In doing so, in every instance of measurement, the default value always applies to the frequency of the reference signal Fb, thereby dispensing with the need to use a parameter set forth in the specifications of the fundamental frequency generating unit and the frequency multiplier. 
         [0049]    Accordingly, a method and system for measuring distance of the present invention eliminate time measurement errors by quick and precise multiphase processing and multiply the accuracy of measurement in accordance with the quantity of generated phase shift signals. In the embodiments of the present invention, the errors are reduced eightfold (corresponding to eight phase shift signals) so as to achieve high-precision distance measurement and reduce the area occupied by a circuit. 
         [0050]    The present invention is disclosed above by preferred embodiments. However, persons skilled in the art should understand that the preferred embodiments are illustrative of the present invention only, but should not be interpreted as restrictive of the scope of the present invention. Hence, all equivalent modifications and replacements made to the aforesaid embodiments should fall within the scope of the present invention. Accordingly, the legal protection for the present invention should be defined by the appended claims.