Distance measurement method and device, terminal, and storage medium
By detecting the signal strength and phase difference of the acoustic signal using an acoustic receiving device and combining it with a cross-correlation function, the cost and accuracy problems of existing wireless ranging methods are solved, achieving high-precision, low-cost ranging that is suitable for ordinary electronic devices.
Patent Information
- Application Number
- CN202110710920.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-25
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2041-06-25
AI Technical Summary
Existing wireless ranging methods, such as infrared ranging, electromagnetic ranging, and acoustic ranging, have shortcomings in terms of cost, accuracy, and anti-interference, especially acoustic ranging, which suffers from high costs due to multipath effects and time synchronization.
The method uses a sound wave receiving device to detect the sound wave signal sent by the sound wave transmitting device, determines the initial distance by the signal strength and phase difference during movement, and determines the distance to be detected by combining the initial distance at a specified position. It uses a cross-correlation function to perform accurate ranging, avoiding time synchronization and additional hardware communication.
It achieves high-precision, low-cost ranging, has a wide range of applications, requires no additional hardware costs, is easy to operate, and is suitable for ordinary electronic devices.
Smart Images

Figure CN115524707B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the field of electronic technology, and in particular, to a ranging method and device, a terminal, and a storage medium. BACKGROUND
[0002] Wireless ranging is widely used in the field of electronic devices. In short-distance ranging, commonly used methods include infrared ranging, electromagnetic wave ranging, and acoustic wave ranging. The infrared ranging method has good consistency, low cost, and fast response speed, but the minimum distance detected by this method is large, and it is difficult to detect the distance of objects with strong light absorption. Electromagnetic wave ranging has high cost and is susceptible to electromagnetic interference. Acoustic wave ranging is a simple and low-cost solution. However, if an echo ranging method is used, it is susceptible to multipath effects. If a separate acoustic wave transmitting device and receiving device are used, communication between the two devices and precise time synchronization are required, which is costly. SUMMARY
[0003] The present disclosure provides a ranging method and device, a terminal, and a storage medium.
[0004] According to a first aspect of an embodiment of the present disclosure, a ranging method is provided, which is applied to an acoustic wave receiving device, and includes:
[0005] detecting a detection acoustic wave signal sent by an acoustic wave transmitting device;
[0006] during movement of the acoustic wave receiving device to a specified location to be ranged, determining an initial distance according to a signal strength of the detection acoustic wave signal;
[0007] when the acoustic wave receiving device is located at the specified location, determining a to-be-detected distance according to the detection acoustic wave signal and the initial distance.
[0008] In some embodiments, the determining of the initial distance according to the signal strength of the detection acoustic wave signal during the movement of the acoustic wave receiving device to the specified location to be ranged includes:
[0009] during the movement of the acoustic wave receiving device to the specified location to be ranged, in response to the signal strength satisfying a predetermined signal strength range, determining the initial distance based on the detection acoustic wave signal and a predetermined reference signal.
[0010] In some embodiments, the determining of the initial distance based on the detection acoustic wave signal and the predetermined reference signal in response to the signal strength satisfying the predetermined signal strength range includes:
[0011] in response to the signal strength of the detected acoustic wave signal being greater than or equal to a predetermined signal strength threshold, determining the initial distance based on the detected acoustic wave signal and a predetermined reference signal.
[0012] In some embodiments, the determining the initial distance based on the detected acoustic wave signal and the predetermined reference signal comprises:
[0013] determining a phase difference between the detected acoustic wave signal and the reference signal based on a cross-correlation function of the detected acoustic wave signal and the reference signal;
[0014] determining the initial distance based on the phase difference.
[0015] In some embodiments, the method further comprises:
[0016] updating the initial distance based on the detected acoustic wave signal and a predetermined reference signal during movement of the acoustic wave receiving device to a specified location to be ranged.
[0017] In some embodiments, the updating the initial distance based on the detected acoustic wave signal and a predetermined reference signal during movement of the acoustic wave receiving device to a specified location to be ranged comprises:
[0018] determining a detected distance from the acoustic wave receiving device to the specified location to be ranged based on the detected acoustic wave signal and the reference signal during movement of the acoustic wave receiving device to the specified location to be ranged;
[0019] updating the detected distance to the initial distance in response to the detected distance being less than the initial distance.
[0020] In some embodiments, the determining a to-be-detected distance based on the detected acoustic wave signal and the initial distance when the acoustic wave receiving device is located at the specified location comprises:
[0021] determining a phase difference between the detected acoustic wave signal and a predetermined reference signal based on a cross-correlation function of the detected acoustic wave signal and the reference signal when the acoustic wave receiving device is located at the specified location;
[0022] determining the to-be-detected distance based on the phase difference and the initial distance.
[0023] According to a second aspect of the embodiments of the present disclosure, a ranging device is provided, which is applied to an acoustic wave receiving device and comprises:
[0024] a detection module configured to detect a detected acoustic wave signal sent by an acoustic wave transmitting device;
[0025] The first determining module is configured to determine an initial distance according to the signal strength of the detected sound wave signal when the sound wave receiving device is moving to the specified position to be measured.
[0026] The second determining module is configured to determine a to-be-detected distance according to the detected sound wave signal and the initial distance when the sound wave receiving device is located at the specified position.
[0027] In some embodiments, the first determining module comprises:
[0028] The first determining sub-module is configured to determine an initial distance based on the detected sound wave signal and a predetermined reference signal in response to the signal strength satisfying a predetermined signal strength range when the sound wave receiving device is moving to the specified position to be measured.
[0029] In some embodiments, the first determining sub-module is specifically configured to:
[0030] determine the initial distance based on the detected sound wave signal and a predetermined reference signal in response to the signal strength of the detected sound wave signal being greater than or equal to a predetermined signal strength threshold.
[0031] In some embodiments, the first determining sub-module comprises:
[0032] The second determining sub-module is configured to determine a phase difference between the detected sound wave signal and the reference signal based on a cross-correlation function of the detected sound wave signal and the reference signal.
[0033] The third determining sub-module is configured to determine the initial distance based on the phase difference.
[0034] In some embodiments, the apparatus further comprises:
[0035] The updating module is configured to update the initial distance based on the detected sound wave signal and a predetermined reference signal when the sound wave receiving device is moving to the specified position to be measured.
[0036] In some embodiments, the updating module comprises:
[0037] The fourth determining sub-module is configured to determine a detected distance according to the detected sound wave signal and the reference signal when the sound wave receiving device is moving to the specified position to be measured.
[0038] The updating sub-module is configured to update the detected distance as the initial distance in response to the detected distance being less than the initial distance.
[0039] In some embodiments, the second determining module comprises:
[0040] a fifth determining sub-module, configured to determine a phase difference between the detected sound wave signal and the reference signal according to a cross-correlation function of the detected sound wave signal and a predetermined reference signal when the sound wave receiving device is located at the specified position;
[0041] a sixth determining sub-module, configured to determine the to-be-detected distance based on the phase difference and the initial distance.
[0042] According to a third aspect of the embodiments of the present disclosure, a terminal is provided, and the terminal at least comprises: a processor and a memory for storing executable instructions capable of running on the processor, wherein:
[0043] When the processor is used to run the executable instructions, the executable instructions perform the steps in any of the ranging methods.
[0044] According to a fourth aspect of the embodiments of the present disclosure, a non-transitory computer readable storage medium is provided, and the computer readable storage medium stores computer executable instructions, and the computer executable instructions are executed by a processor to implement the steps in any of the ranging methods.
[0045] The technical solutions provided by the embodiments of the present disclosure can have the following beneficial effects: by the technical solutions of the embodiments of the present disclosure, the sound wave receiving device is used to detect the sound wave signal emitted by the sound wave emitting device, and the initial distance is determined by the movement of the sound wave receiving device and the signal strength of the detected sound wave signal. Then the actual distance is determined based on the initial distance and the detected sound wave signal. On the one hand, there is no need to keep time synchronization between the sound wave emitting device and the sound wave receiving device, so that the two devices do not need to establish a communication connection of electrical signals; on the other hand, the initial distance is dynamically determined in each measurement process, so that the technical solutions are widely applicable and have high accuracy.
[0046] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0047] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the present disclosure and serve to explain the principles of the present disclosure together with the description.
[0048] Figure 1 is a flow of a ranging method according to an exemplary embodiment Figure 1 ;
[0049] Figure 2 is a flow of a ranging method according to an exemplary embodiment Figure 2 ;
[0050] Figure 3is a schematic diagram of a hardware system structure for implementing a ranging method according to an example embodiment;
[0051] Figure 4 is a schematic diagram of a time domain processing method according to an example embodiment;
[0052] Figure 5 is a schematic diagram of a frequency domain processing method according to an example embodiment;
[0053] Figure 6 is a schematic diagram of a sound wave receiving device for ranging according to an example embodiment;
[0054] Figure 7 is a structural block diagram of a ranging device according to an example embodiment;
[0055] Figure 8 is a structural block diagram of a terminal according to an example embodiment. DETAILED DESCRIPTION
[0056] The example embodiments will be described in detail herein with reference to the attached drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following example embodiments are not meant to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0057] Figure 1 is a flowchart of a ranging method according to an example embodiment, as shown in Figure 1 The method is applied to a first device and includes:
[0058] Step S101, detecting a detection sound wave signal sent by a sound wave transmitting device;
[0059] Step S102, determining an initial distance according to a signal strength of the detection sound wave signal during movement of the sound wave receiving device to a specified position to be ranged;
[0060] Step S103, determining a to-be-detected distance according to the detection sound wave signal and the initial distance when the sound wave receiving device is located at the specified position.
[0061] In the embodiments of the present disclosure, the sound wave emitting device has the function of emitting a detection sound wave signal with a predetermined wavelength or volume, and can send the detection sound wave signal by using the sound wave emitting device when distance detection is needed. In actual application, the sound wave emitting device can be any electronic device with audio output related hardware, including a sound box, a mobile phone, a television set, a computer device, and the like. In order to facilitate the measurement of the distance of any position, the sound wave emitting device can be a small device that is easy to move, such as a small sound box device, and the like.
[0062] The sound wave receiving device is a device with an audio receiving function, that is, an electronic device carrying audio signal receiving related hardware (such as a microphone or a microphone array, and the like). It can include a mobile phone, a microphone, a smart watch, and other sound pickup devices, and the like. In actual application, the sound wave receiving device can also be an electronic device that is easy to move, and in the embodiments of the present disclosure, a mobile phone can be taken as an example. It should be noted that in the embodiments of the present disclosure, the mobile phone can have one audio receiving channel, or can have multiple audio receiving channels located at different sides or the same side of the mobile phone.
[0063] In the embodiments of the present disclosure, the above-mentioned detection sound wave signal can be a sound wave signal with a predetermined amplitude and frequency and a fixed period emitted by the sound wave emitting device, or can be any sound wave signal with a known waveform. The sound wave receiving device can obtain corresponding signal strength, phase, and the like information based on the received detection sound wave signal.
[0064] The distance between the specified position to be measured and the sound wave emitting device is the distance to be measured. In the process of measuring the distance, the initial distance can be determined by moving the sound wave receiving device first, and then the distance to be measured can be determined based on the initial distance and the detection sound wave signal after the sound wave receiving device moves to the specified position to be measured.
[0065] Since the position of the sound wave emitting device does not change in the process of moving the sound wave detecting device, and the distance between the sound wave receiving device and the sound wave emitting device changes, the signal strength and phase information of the detection sound wave signal received by the sound wave receiving device will change.
[0066] In the embodiments of the present disclosure, the initial distance can be determined based on the signal strength of the detection sound wave signal. For example, when the signal strength is greater than a predetermined threshold, the initial distance is determined based on the phase information of the current detection sound wave signal. Exemplarily, when the signal strength meets the preset value, the phase information of the currently detected sound wave signal is recorded, and the initial distance at this time is 0. Then, after moving the sound wave receiving device, the phase change of the received detection sound wave signal compared with the recorded initial distance is the detected distance.
[0067] In this way, the ranging can be achieved by detecting the signal strength and the signal waveform of the sound wave signal, and cooperating with the movement of the sound wave receiving device. Moreover, since the initial phase and the signal strength of the signal transmitted by the sound wave transmitting device do not need to be determined, the sound wave receiving device does not need to be time-synchronized with the sound wave transmitting device, and thus the interaction of the electrical signals is not needed.
[0068] In this way, without additional hardware devices, the distance measurement can be achieved by using the existing electronic device with the sound wave transmitting function and the electronic device with the sound wave receiving function. Moreover, the signal communication between the sound wave transmitting device and the sound wave receiving device is not needed, and the ranging can be achieved only by transmitting and receiving the sound wave, and thus the information matching between the electronic devices is not needed. Therefore, the technical scheme of the embodiments of the present disclosure does not need additional hardware costs, is easy to operate, and has a wide application range.
[0069] In some embodiments, the initial distance is determined according to the signal strength of the detected sound wave signal during the movement of the sound wave receiving device to the specified position to be measured.
[0070] During the movement of the sound wave receiving device to the specified position to be measured, the initial distance is determined based on the detected sound wave signal and a predetermined reference signal in response to the signal strength satisfying a predetermined signal strength range.
[0071] In the embodiments of the present disclosure, the sound wave receiving device can move, and the direction of the movement of the sound wave receiving device can be uncertain, but the sound wave receiving device needs to move to the specified position to be measured for the final ranging. During the movement of the sound wave receiving device, the distance between the sound wave receiving device and the sound wave transmitting device changes, and thus the signal strength of the detected sound wave signal also changes. The closer the distance between the sound wave receiving device and the sound wave transmitting device, the stronger the signal strength of the detected sound wave signal; the farther the distance, the greater the loss of the signal energy, and thus the weaker the signal strength of the detected sound wave signal. Therefore, the distance can be estimated based on the signal strength.
[0072] In order to accurately measure the distance between the specified position to be measured and the sound wave transmitting device, the signal strength of the sound wave signal needs to satisfy the predetermined signal strength range based on the above-mentioned method of determining the initial distance. In the signal strength range, the initial distance estimated based on the signal strength is relatively accurate. Therefore, the accurate distance measurement can be obtained based on the initial distance determined in this way and the determined relative position relationship of the detected sound wave signal received at the specified position to be measured.
[0073] In some embodiments, the initial distance is determined based on the detected sound wave signal and a predetermined reference signal in response to the signal strength satisfying a predetermined signal strength range.
[0074] In response to the signal strength of the detected sound wave signal being greater than or equal to a predetermined signal strength threshold, the initial distance is determined based on the detected sound wave signal and a predetermined reference signal.
[0075] In the embodiments of the present disclosure, the predetermined signal strength range can be a signal strength greater than or equal to a predetermined strength threshold. It can be understood that the greater the signal strength, the closer the distance between the sound wave receiving device and the sound wave transmitting device. When the signal strength is greater than a certain threshold, the distance between the sound wave receiving device and the sound wave transmitting device can be negligible.
[0076] Here, when the signal strength of the detected sound wave signal meets the predetermined condition, the initial distance can be determined based on the detected sound wave signal and a predetermined reference signal. Here, the reference signal can be a sound wave signal with a predetermined amplitude and frequency and a fixed period, or any sound wave signal with a known waveform. In an embodiment, the reference signal is a signal with the same period as the detected sound wave signal.
[0077] Since the predetermined reference signal can be pre-stored in the sound wave receiving device, it does not need to be embodied in the form of a played sound wave, but is stored in the sound wave receiving device in a digitized signal. The reference signal carries predetermined phase, period, and amplitude information, and therefore, when the sound wave receiving device receives the detected sound wave signal, a relative distance can be determined based on the difference between the detected sound wave signal and the reference signal. For example, based on the difference between the signal strength of the reference signal and the signal strength of the detected sound wave signal, the relative distance is determined; or based on the phase information of the reference signal and the phase information of the detected sound wave signal, the relative distance is determined. The relative distance is determined as the initial distance for subsequent distance measurement.
[0078] In an embodiment, based on the signal strength being greater than or equal to a predetermined signal strength threshold, it can be determined that the initial distance is approximately 0, and therefore, the relative distance determined by the detected sound wave signal and the reference signal can be initialized as an initial distance with a value of 0. In this way, after the signal detection device moves to the specified position to be measured, the actual detection distance can be determined based on the waveform change of the detected sound wave signal relative to the position at the initial distance.
[0079] In some embodiments, the initial distance is determined based on the detected sound wave signal and a predetermined reference signal, including:
[0080] Based on the cross-correlation function of the detected sound wave signal and the reference signal, a phase difference between the detected sound wave signal and the reference signal is determined.
[0081] Based on the phase difference, the initial distance is determined.
[0082] In the embodiments of the present disclosure, the initial distance can be determined by detecting the phase difference between the detected sound wave signal and the reference signal. By detecting the cross-correlation function between the detected sound wave signal and the reference signal, the degree of correlation between the detected sound wave signal and the reference signal can be determined. This process can be understood as sequentially multiplying the detected sound wave signal by the reference signal by moving the detected sound wave signal (i.e., phase shift). When the cross-correlation function takes the maximum value, the detected sound wave signal coincides with the reference signal (the same phase) at the corresponding phase shift. At this time, the corresponding phase shift is the phase difference between the sound wave signal and the reference signal. Therefore, the phase difference can be determined by the method of calculating the cross-correlation function, and the initial distance can be further determined based on the phase difference.
[0083] In some embodiments, as shown in Figure 2 The method further includes:
[0084] In step S201, the initial distance is updated based on the detected sound wave signal and the predetermined reference signal during the movement of the sound wave receiving device to the specified position to be measured.
[0085] In the embodiments of the present disclosure, the sound wave receiving device can continuously detect signals during the movement, and determine the corresponding distance based on the received detected sound wave signal. If the initial distance is determined during this process, the signal energy of the detected sound wave signal becomes larger, which indicates that the distance between the sound wave receiving device and the sound wave transmitting device becomes closer, and therefore the distance at this time can be updated as the initial distance. That is, the current distance is closer to 0 than the previously determined initial distance. Therefore, the detected sound wave signal can be continuously received during the movement of the sound wave receiving device, and the initial distance can be updated based on the detected sound wave signal. In this way, a more accurate initial distance can be obtained during the detection process, so that more accurate detection data can be obtained when the sound wave receiving device moves to the specified position to determine the distance to be measured.
[0086] In some embodiments, the initial distance is updated based on the detected sound wave signal and the predetermined reference signal during the movement of the sound wave receiving device to the specified position to be measured, including:
[0087] During the movement of the sound wave receiving device to the specified position to be measured, a detection distance is determined according to the detected sound wave signal and the reference signal.
[0088] In response to the detection distance being less than the initial distance, the detection distance is updated as the initial distance.
[0089] Here, the way of updating the initial distance can be that the detection sound wave signal is continuously received in the movement of the sound wave receiving device, and the corresponding detection distance is determined based on the detection sound wave signal and the reference signal. When the value of the detection distance is less than the current initial distance, it indicates that the distance between the sound wave receiving device and the sound wave transmitting device at this time is closer, and therefore the current detected distance can be updated as the initial distance.
[0090] In some embodiments, the determining the to-be-detected distance according to the detection sound wave signal and the initial distance when the sound wave receiving device is located at the specified position comprises:
[0091] determining a phase difference between the detection sound wave signal and the reference signal according to a cross-correlation function of the detection sound wave signal and a predetermined reference signal when the sound wave receiving device is located at the specified position;
[0092] determining the to-be-detected distance based on the phase difference and the initial distance.
[0093] In the embodiments of the present disclosure, after the sound wave receiving device moves to the specified position for distance measurement, distance measurement can be performed at the specified position.
[0094] At the specified position, the sound wave receiving device can determine a phase difference between the detection sound wave signal and the reference signal based on a cross-correlation function of the detection sound wave signal and the predetermined reference signal. Since the phase difference represents a relative distance difference based on the reference signal, rather than an actual distance. Therefore, the actual detection distance can be determined based on the initial distance and the phase difference detected at this time.
[0095] In this way, the sound wave receiving device can achieve accurate distance measurement through position movement and sound wave detection, without the need for matching and establishing a communication connection with the sound wave transmitting device, without additional hardware costs, simple operation, and wide application range, and ordinary household electronic devices with audio transceiving function can be used.
[0096] The embodiments of the present disclosure also provide the following examples:
[0097] The embodiments of the present disclosure utilize one sound wave transmitting device to transmit periodic sound wave signals, and utilize two sound wave receiving devices at different positions to receive and solve, without the need for communication between the sound wave transmitting device and the sound wave receiving device, simple operation, and no additional hardware costs.
[0098] As Figure 3 shown, the principle is to use the device to measure the distance, the sound wave generating device generates a sound wave signal and transmits it to the sound wave receiving device, and then uses the time delay calculation unit to process to obtain the time delay, and further calculates the distance information.
[0099] In the embodiments of the present disclosure, the ranging system can be initialized before ranging, and the initial distance is used to detect the relative distance, and then the final actual distance detection result is obtained.
[0100] Figure 3 The sound wave transmitting device shown can include a sound wave generator and a sound wave transmitter, and the sound wave receiving device can include one or more sound wave receivers, a time delay calculation unit, and a distance calculation unit.
[0101] The sound wave generator is used to generate a periodic sound wave signal to be transmitted.
[0102] The sound wave transmitter can be a loudspeaker of a smart phone or a speaker of a sound box, or a dedicated ultrasonic transmitting device, etc., for transmitting a periodic sound wave signal, which is then received by the sound wave receiver, and the distance between the sound wave receiving device and the sound wave transmitting device is calculated by the time delay calculation unit and the distance calculation unit.
[0103] The time delay calculation unit calculates the time delay Δt between the sound wave signal s received by the sound wave receiver and the reference signal s r Here, two schemes are given from the perspective of time domain and frequency domain calculation.
[0104] Scheme 1: Time domain processing.
[0105] As shown in Figure 4 , the received signal s is a digital signal collected by the sound wave receiver, and the reference signal s r is a periodic sound wave signal, and the digital information of the signal can be pre-stored in the memory. The sound wave volume, i.e., the signal strength of the sound wave signal, is calculated from the received sound wave digital signal. The volume calculation method can use the average value method, the root mean square value method, etc. The signal is processed according to frames, and the frame length is N. The volume calculation formula is as follows:
[0106] Average value method: vol = mean(s);
[0107] Root mean square value method: vol = RMS(s).
[0108] The cross-correlation function (convolution calculation) of the received signal and the reference signal is calculated, and the calculation formula is as follows:
[0109]
[0110] In the formula, k is the delay point number, and K is the maximum delay point number.
[0111] The time delay between the received signal and the reference signal is obtained according to the cross-correlation function. The calculation formula is as follows:
[0112] Δt = p max / fs
[0113] Where, p max To find the maximum value of k for the cross-correlation function, f s The sampling frequency.
[0114] Option 2: Frequency domain processing.
[0115] like Figure 5 As shown, the received signal and the reference signal are processed by framing and windowing respectively. Framing is to ensure the short-term nature of the processed data, and windowing is to reduce spectral energy leakage. Window functions that can be used include the Blackman-Harris window, the triangular window, and the Hamming window. The windowing process is shown in the following formula:
[0116] s w (t)=s(t)·w(t),t=1,2,3,...,N
[0117] s rw (t)=s r (t)·w(t),t=1,2,3,...,N
[0118] Where w(t) is the window function.
[0119] Then, a spectral transform is performed to obtain the spectrum of the framed and windowed signal. Here, a Fast Fourier Transform is used as an example. The spectra of the received signal and the reference signal are obtained based on the amplitude spectrum of the received signal:
[0120] F = FFT(s) w (t))t=1,2,3,...,n
[0121] F r =FFT(s) rw (t)), t=1,2,3,...,n
[0122] In the formula, FFT represents Fast Fourier Transform, and n is the number of FFT points.
[0123] The volume of the received signal is calculated:
[0124] vol=RMS(abs(F(l:h)))
[0125] In the formula, l represents the frequency point in the FFT spectrum corresponding to the lowest frequency of the transmitted ultrasonic signal, and h represents the frequency point in the FFT spectrum corresponding to the highest frequency of the transmitted ultrasonic signal.
[0126] The cross-correlation function is obtained by performing cross-correlation calculations using the spectra of the received signal and the reference signal.
[0127] R 12 =IFFT(F*Fr * )
[0128] wherein F r * is the conjugate of F r .
[0129] The time delay between the received signal and the reference signal is obtained according to the cross-correlation function. The calculation formula is as follows:
[0130] Δt = p max / f s
[0131] wherein p max is the corresponding frequency shift when the maximum value of the cross-correlation function is obtained, and f s is the sampling frequency.
[0132] The distance calculation unit calculates the distance between the sound wave receiver and the sound wave transmitter according to the result of the time delay calculation unit, and the principle is shown in Figure 6 The sound wave receiving device determines the received signal volume based on the detected sound wave signal, determines whether the received signal volume meets the preset threshold Th, when vol>Th, triggers the ultrasonic ranging function, records the distance measurement value D0 at this time as the correction value, and initializes the distance at the current time as 0, and then the distance difference between the current time and the initialization time is the actual distance, and the specific calculation formula is as follows:
[0133] The distance OA between the signal receiver at A and the signal transmitter is:
[0134] D = Δt * u
[0135] In the formula, Δt is the time delay determined by the delay calculation module, and u is the speed of sound in the air.
[0136] When the calculated distance is negative (i.e. the distance is closer), the value is used to correct the initial value D0, and the distance measurement is completed through the above steps.
[0137] In this way, by using the method in the embodiment of the present disclosure, one sound wave transmitting device and one sound wave receiving device can be used to calculate through the initialization method, and the accurate distance can be obtained by combining the movement of the sound wave receiving device. There is no need for communication between the sound wave receiving device and the sound wave transmitting device, only the sound wave receiving device needs to be solved, therefore, the application range is wide, no additional hardware cost is needed, and the operation is simple and the detection precision is high. It should be noted that by using the distance measuring method of the embodiment of the present disclosure, the results obtained by measuring the distance through multiple sound wave receiving devices are weighted and fused or different signal receivers are adaptively switched according to different measurement environments for distance detection, which can also obtain better accuracy and reliability.
[0138] Figure 7 is a structural block diagram of a ranging device according to an exemplary embodiment, as shown in Figure 7 The device 700 is applied to a sound wave receiving device, and includes:
[0139] A detection module 701 is configured to detect a detection sound wave signal sent by a sound wave sending device.
[0140] A first determination module 702 is configured to determine an initial distance according to a signal strength of the detection sound wave signal when the sound wave receiving device moves to a specified position to be ranged.
[0141] A second determination module 703 is configured to determine a distance to be detected according to the detection sound wave signal and the initial distance when the sound wave receiving device is located at the specified position.
[0142] In some embodiments, the first determination module includes:
[0143] A first determination sub-module is configured to determine the initial distance based on the detection sound wave signal and a predetermined reference signal in response to the signal strength satisfying a predetermined signal strength range when the sound wave receiving device moves to the specified position to be ranged.
[0144] In some embodiments, the first determination sub-module is specifically configured to:
[0145] determine the initial distance based on the detection sound wave signal and the predetermined reference signal in response to the signal strength of the detection sound wave signal being greater than or equal to a predetermined signal strength threshold.
[0146] In some embodiments, the first determination sub-module includes:
[0147] A second determination sub-module is configured to determine a phase difference between the detection sound wave signal and the reference signal based on a cross-correlation function of the detection sound wave signal and the reference signal.
[0148] A third determination sub-module is configured to determine the initial distance based on the phase difference.
[0149] In some embodiments, the device further includes:
[0150] An updating module is configured to update the initial distance based on the detection sound wave signal and a predetermined reference signal when the sound wave receiving device moves to the specified position to be ranged.
[0151] In some embodiments, the updating module includes:
[0152] A fourth determining sub-module is configured to determine a detection distance according to the detected sound wave signal and the reference signal during movement of the sound wave receiving device to a designated position to be measured;
[0153] An updating sub-module is configured to update the detection distance as the initial distance in response to the detection distance being less than the initial distance.
[0154] In some embodiments, the second determining module comprises:
[0155] A fifth determining sub-module is configured to determine a phase difference between the detected sound wave signal and the reference signal according to a cross-correlation function of the detected sound wave signal and a predetermined reference signal when the sound wave receiving device is located at the designated position.
[0156] A sixth determining sub-module is configured to determine the distance to be detected based on the phase difference and the initial distance.
[0157] As to the apparatus in the above-described embodiments, specific manners in which various modules perform operations have been described in details in the embodiments of the method, and thus will not be described in details here.
[0158] Figure 8 is a block diagram of a terminal 700 according to an exemplary embodiment. The terminal 800 can be a mobile phone, a computer, a digital broadcast terminal, a messaging equipment, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and the like, for example.
[0159] Referring to Figure 8 The terminal 800 can include one or more of the following components: a processing component 801, a memory 802, a power supply component 803, a multimedia component 804, an audio component 805, an input / output (I / O) interface 806, a sensor component 807, and a communication component 808.
[0160] The processing component 801 generally controls the overall operations of the terminal 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 801 can include one or more processors 810 to execute instructions to complete all or part of steps of the methods described above. In addition, the processing component 801 can include one or more modules to facilitate interaction between the processing component 801 and other components. For example, the processing component 801 can include a multimedia module to facilitate the interaction between the multimedia component 804 and the processing component 801.
[0161] The memory 810 is configured to store various types of data to support the operation of the terminal 800. Examples of such data include instructions for any application or method operating on the terminal 800, contact data, phonebook data, messages, pictures, videos, etc. The memory 802 can be implemented by any type of volatile or nonvolatile memory, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable programmable read only memory (EPROM), programmable read only memory (PROM), read only memory (ROM), magnetic memory, flash memory, magnetic disc or optical disc.
[0162] The power supply component 803 supplies power for various components of the terminal 800. The power supply component 803 can include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the terminal 800.
[0163] The multimedia component 804 includes a screen providing an output interface between the terminal 800 and a user. In some embodiments, the screen can include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense a touch, a slide, and a gesture on the touch panel. The touch sensor can not only sense a boundary of a touching or a sliding action, but also detect duration and pressure related to the touching or sliding action. In some embodiments, the multimedia component 804 includes a front camera and / or a back camera. The front and / or back camera can receive external multimedia data when the terminal 800 is in an operation mode, such as a shooting mode or a video mode. Each of the front and / or back camera can be a fixed optical lens system or have a focus and an optical zooming capability.
[0164] The audio component 805 is configured to output and / or input audio signals. For example, the audio component 805 includes a microphone (MIC) configured to receive external audio signals when the terminal 800 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory 810 or transmitted via the communication component 808. In some embodiments, the audio component 805 also includes a speaker for outputting audio signals.
[0165] The I / O interface 806 provides an interface between the processing component 801 and peripheral interface modules, which can be a keypad, a click wheel, buttons, etc. The buttons can include, but are not limited to, a home button, a volume button, a start button, and a lock button.
[0166] The sensor component 807 includes one or more sensors for providing status assessments for various aspects of the terminal 800. For example, the sensor component 807 can detect an open / closed position of the terminal 800, relative positioning of components, such as a display and a keypad of the terminal 800, changes in position of the terminal 800 or a component of the terminal 800, presence or absence of user contact with the terminal 800, changes in orientation of the terminal 800 or acceleration / deceleration, and temperature changes of the terminal 800. The sensor component 807 can include proximity sensor(s) configured to detect presence of an object in proximity without any physical contact. The sensor component 807 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 807 can further include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0167] The communication component 808 is configured to facilitate wired or wireless communication between the terminal 800 and another device. The terminal 800 can access a wireless network based on a communication standard, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 808 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 808 further includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra-WideBand (UWB) technology, Bluetooth (BT) technology, or other technology.
[0168] In an exemplary embodiment, the terminal 800 can be implemented with one or more Application-Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements to perform the above-described methods.
[0169] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions, such as the memory 802 including instructions, is also provided, which can be executed by the processor 810 of the terminal 800 to perform the above-described methods. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disc, and an optical data storage device, etc.
[0170] The embodiments of the present disclosure also provide a non-transitory computer-readable storage medium, which, when instructions in the storage medium are executed by a processor of a mobile terminal, enables the mobile terminal to perform the method provided by any of the above-described embodiments.
[0171] Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. It is intended that the specification and examples be considered as exemplary only, with the true scope and spirit of the application being indicated by the following claims.
[0172] It is to be understood that the application is not limited to the precise construction herein described and as shown in the attached drawings, and that various modifications and changes can be made by those skilled in the art without departing from the scope of the application. The scope of the application is limited only by the claims that follow.
Claims
1. A distance measurement method, characterized in that, The method is applied to a sound wave receiving device, including: Detect the detection sound wave signal sent by the sound wave transmitting device; During the process of the sound wave receiving device moving towards the designated position to be measured, the initial distance is determined based on the signal strength of the detected sound wave signal; When the sound wave receiving device is located at the designated position, the phase difference between the detected sound wave signal and the reference signal is determined according to the cross-correlation function between the detected sound wave signal and the predetermined reference signal. The distance to be detected is determined based on the phase difference and the initial distance.
2. The method according to claim 1, characterized in that, The process of determining the initial distance based on the signal strength of the detected sound wave signal during the movement of the sound wave receiving device towards the designated position to be measured includes: During the movement of the acoustic wave receiving device toward the designated position to be measured, in response to the signal strength satisfying a predetermined signal strength range, an initial distance is determined based on the detected acoustic wave signal and a predetermined reference signal.
3. The method according to claim 2, characterized in that, The step of determining an initial distance based on the detected acoustic signal and a predetermined reference signal in response to the signal strength falling within a predetermined range includes: In response to the detection of an acoustic signal strength greater than or equal to a predetermined signal strength threshold, the initial distance is determined based on the detection of the acoustic signal and a predetermined reference signal.
4. The method according to claim 3, characterized in that, Determining the initial distance based on the detected acoustic signal and a predetermined reference signal includes: Based on the cross-correlation function between the detected acoustic signal and the reference signal, the phase difference between the detected acoustic signal and the reference signal is determined; The initial distance is determined based on the phase difference.
5. The method according to claim 1, characterized in that, The method further includes: As the acoustic receiving device moves toward the designated position to be measured, the initial distance is updated based on the detected acoustic signal and a predetermined reference signal.
6. The method according to claim 5, characterized in that, The step of updating the initial distance based on the detected acoustic signal and a predetermined reference signal during the movement of the acoustic receiving device towards the designated position to be measured includes: During the process of the sound wave receiving device moving towards the designated position to be measured, the detection distance is determined based on the detected sound wave signal and the reference signal; In response to the detection distance being less than the initial distance, the detection distance is updated to the initial distance.
7. A ranging device, characterized in that, The device is used in a sound wave receiving equipment and includes: The detection module is used to detect the detection acoustic wave signal sent by the acoustic wave transmitting device; The first determining module is used to determine the initial distance based on the signal strength of the detected acoustic signal during the process of the acoustic receiving device moving towards the designated position to be measured. The second determining module is configured to, when the acoustic receiving device is located at the designated position, determine the phase difference between the detected acoustic signal and the reference signal based on the cross-correlation function between the detected acoustic signal and the predetermined reference signal; and determine the detection distance based on the phase difference and the initial distance.
8. The apparatus according to claim 7, characterized in that, The first determining module includes: The first determining submodule is used to determine an initial distance based on the detected acoustic signal and a predetermined reference signal in response to the signal strength satisfying a predetermined signal strength range during the movement of the acoustic receiving device toward the designated position to be measured.
9. The apparatus according to claim 8, characterized in that, The first determining submodule is specifically used for: In response to the detection of an acoustic signal strength greater than or equal to a predetermined signal strength threshold, the initial distance is determined based on the detection of the acoustic signal and a predetermined reference signal.
10. The apparatus according to claim 9, characterized in that, The first determining submodule includes: The second determining submodule is used to determine the phase difference between the detected acoustic signal and the reference signal based on the cross-correlation function between the detected acoustic signal and the reference signal; The third determining submodule is used to determine the initial distance based on the phase difference.
11. The apparatus according to claim 7, characterized in that, The device further includes: An update module is used to update the initial distance based on the detected acoustic signal and a predetermined reference signal as the acoustic receiving device moves toward the designated position to be measured.
12. The apparatus according to claim 11, characterized in that, The update module includes: The fourth determining submodule is used to determine the detection distance based on the detected acoustic signal and the reference signal during the process of the acoustic receiving device moving towards the designated position to be measured. An update submodule is used to update the detection distance to the initial distance in response to the detection distance being less than the initial distance.
13. A terminal, characterized in that, The terminal includes at least: a processor and a memory for storing executable instructions capable of running on the processor, wherein: When the processor is used to run the executable instructions, the executable instructions perform the steps in the ranging method provided by any one of claims 1 to 6.
14. A non-transitory computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions that, when executed by a processor, implement the steps of the ranging method provided in any one of claims 1 to 6.
Citation Information
Patent Citations
Acoustic system for detecting and locating low intensity and low frequency sound sources and related locating method
CN112119642A
Ranging method and device, terminal and storage medium
CN112904324A