Method for distance measurement between devices, electronic device and storage medium

By sending a continuous wave signal on multiple channels and generating a spectrum function, the processing accuracy of the equipment spacing accuracy under the impact of the signal multi -path transmission is solved, and the more accurate equipment spacing measurement is achieved.

CN119375867APending Publication Date: 2025-01-28HONOR DEVICE CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310929951.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-26
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

In the prior art, when measuring distances between devices, due to the influence of multi-path transmission of signals, there may be a deviation between the measured distance and the actual distance.

Method used

Through the first and second devices, the continuous wave signals of different frequencies are sent to multiple channels, the first matrix is ​​generated, and its feature values ​​and feature vectors are determined. Based on this information constructor, the actual signal transmission path between the device is determined through the peak of the spectrum function to accurately measure the distance between the device.

Benefits of technology

The impact of the accuracy of the distance between the signal multi -path transmission on the spacing of the device is reduced, the accuracy of the ranging is improved, and the distance between the measured device is closer to the distance of the actual signal transmission path.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119375867A_ABST
    Figure CN119375867A_ABST
Patent Text Reader

Abstract

The invention provides an inter-device distance measurement method, an electronic device and a storage medium, and the method comprises the steps that a first device sends a plurality of first continuous wave signals to a second device, and receives a plurality of second continuous wave signals sent by the second device after the second device receives the first continuous wave signals; generating a first matrix based on the plurality of first continuous wave signals and the plurality of second continuous wave signals, and determining a plurality of feature values corresponding to the first matrix and a plurality of feature vectors corresponding to the plurality of feature values; constructing a spectral function based on the frequencies corresponding to the plurality of channels, a preset time interval, a to-be-determined first duration and a target feature vector in the plurality of feature vectors; and determining the distance between the two devices according to the light velocity and a first duration determined based on the peak value of the spectral function. According to the method, the influence of multi-path transmission of the signal on the accuracy of distance measurement between the devices can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of distance measurement, and in particular to a method for distance measurement between devices, an electronic device and a storage medium. Background Art

[0002] Currently, in some scenarios, it is necessary to measure the distance between two devices. For example, in the password-free unlocking scenario between a watch and a mobile phone, it is necessary to measure the distance between the watch and the mobile phone. When the distance between the watch and the mobile phone is within a preset distance range, the mobile phone can be unlocked without a password.

[0003] A technology for measuring the distance between devices is known. A first device and a second device send continuous wave signals of different frequencies to each other on multiple adjacent channels. The devices at both ends respectively determine the phase corresponding to the continuous wave signal of the same frequency from the device at the other end. The device at one end uses the result of adding the phases determined by the devices at both ends as the vertical coordinate and the frequency as the horizontal coordinate. The slope of the curve of the result of the corresponding addition of the phases changes with the frequency is estimated, and the estimated slope is substituted into the relationship corresponding to the curve to obtain the distance between the two devices.

[0004] However, since the continuous wave signal used when estimating the slope of the above curve is a signal formed by superimposing signals from multiple signal transmission paths of a device at one end, the signal formed after superposition includes information of multiple paths, and only one path among the multiple signal transmission paths represents the actual distance between the two devices, therefore, the distance between the two devices determined by the above method is affected by the multi-path transmission of the signal, and there may be a deviation between the actual distance between the two devices. Summary of the invention

[0005] The present application provides a method for measuring distance between devices, an electronic device and a readable storage medium. The solution can reduce the influence of multi-path transmission of signals on the accuracy of measuring distance between devices.

[0006] In order to achieve the above purpose, this application adopts the following technical solutions:

[0007] In a first aspect, a method for measuring distance between devices is provided, the method comprising:

[0008] The first device sends a plurality of first continuous wave signals of different frequencies to the second device on a plurality of channels at a preset time interval, and receives a plurality of second continuous wave signals of different frequencies sent by the second device on a plurality of channels after receiving the first continuous wave signals, wherein the plurality of first continuous wave signals and the plurality of second continuous wave signals correspond to the plurality of channels one by one, and the first continuous wave signal and the second continuous wave signal sent on the same channel have the same frequency;

[0009] Based on the plurality of first continuous wave signals and the plurality of second continuous wave signals, a first matrix is ​​generated, and a plurality of eigenvalues ​​corresponding to the first matrix and a plurality of eigenvectors corresponding to the plurality of eigenvalues ​​are determined;

[0010] Constructing a spectral function based on the frequencies corresponding to the multiple channels, the preset time intervals, the first duration to be determined, and the target feature vector in the multiple feature vectors, wherein the first duration is the duration from when the first device sends a first continuous wave signal to the second device to when the second continuous wave signal sent by the second device is received, and the feature value corresponding to the target feature vector is less than or equal to a preset threshold value;

[0011] The value of the first time duration to be determined corresponding to the peak value of the spectrum function is determined as the first time duration, and the distance between the first device and the second device is determined according to the speed of light and the first time duration.

[0012] In this embodiment, a first matrix is ​​generated by using a plurality of first continuous wave signals and a plurality of second continuous wave signals. Since the plurality of first continuous wave signals received by the second device are related to the duration of their transmission from the first device to the second device, and the plurality of second continuous wave signals received by the first device are related to the duration of their transmission from the second device to the first device, that is, the first matrix is ​​related to the duration (that is, the first duration to be determined) from the first device sending the first continuous wave signal to the second device to the receipt of the second continuous wave signal sent by the second device, and the first continuous wave signal is the result of the superposition of signals and noise from a plurality of signal transmission paths of the first device, and the second continuous wave signal is the result of the superposition of signals and noise from a plurality of signal transmission paths of the second device, then the first matrix includes both information corresponding to the signals of the plurality of signal transmission paths and information corresponding to the noise. However, since the energy of the noise of the first matrix is ​​much smaller than the energy of the signal, in order to solve the problem that the signal formed by the superposition of signals of the plurality of signal transmission paths makes the measured device time To solve the problem of distance deviation, a feature vector whose eigenvalue is less than or equal to a preset threshold value among multiple eigenvectors determined according to the first matrix is ​​used as a target eigenvector. Then, according to the target eigenvector, the frequencies corresponding to multiple channels, the preset time interval, and the first time length to be determined, a spectral function with the first time length to be determined as the independent variable is constructed. Since, when constructing the spectral function, the information corresponding to the signals of the multiple signal transmission paths included in the first matrix is ​​excluded by selecting the target eigenvector, and only the information corresponding to the noise is retained, the first time length corresponding to the peak value of the spectral function is infinitely close to the time length corresponding to the actual signal transmission path between the first device sending the first continuous wave signal to the second device and receiving the second continuous wave signal sent by the second device. Then, the distance between the first device and the second device determined based on the speed of light and the value of the first time length is infinitely close to the distance corresponding to the actual signal transmission path between the first device and the second device. Therefore, the above scheme can reduce the influence of multi-path transmission of signals on the accuracy of ranging between devices.

[0013] In some possible implementations, generating a first matrix based on a plurality of first continuous wave signals and a plurality of second continuous wave signals includes:

[0014] Acquire a plurality of first data sets associated with a plurality of first continuous wave signals, wherein the plurality of first data sets correspond one-to-one to the plurality of first continuous wave signals, each first data set includes a plurality of groups of first data obtained by sampling the first continuous wave signals of the same frequency, or includes a first phase determined according to at least one group of first data, or includes a first phase and a first amplitude determined according to at least one group of first data, the plurality of groups of first data correspond one-to-one to a plurality of sampling points, and each group of first data includes a first in-phase data and a first orthogonal data;

[0015] Acquire a plurality of second data sets associated with a plurality of second continuous wave signals, wherein the plurality of second data sets correspond one-to-one to the plurality of second continuous wave signals, each second data set includes a plurality of groups of second data obtained by sampling the second continuous wave signals of the same frequency, or includes a second phase determined according to at least one group of second data, or includes a second phase and a second amplitude determined according to at least one group of second data, the plurality of groups of second data correspond one-to-one to a plurality of sampling points, each group of second data includes a second in-phase data and a second orthogonal data, and the plurality of second data sets correspond one-to-one to the plurality of first data sets;

[0016] A first matrix is ​​generated according to a plurality of first data sets and a plurality of second data sets.

[0017] In this embodiment, a plurality of first data sets associated with a plurality of first continuous wave signals are obtained, a plurality of second data sets associated with a plurality of second continuous wave signals are obtained, and a first matrix is ​​generated based on the plurality of first data sets and the plurality of second data sets, so that the first matrix contains both information of the plurality of first continuous wave signals and information of the plurality of second continuous wave signals. Since the plurality of first continuous wave signals received by the second device are related to the duration of their transmission from the first device to the second device, and the plurality of second continuous wave signals received by the first device are related to the duration of their transmission from the second device to the first device, the first matrix is ​​related to the duration (i.e., the first duration to be determined) between sending the first continuous wave signal from the first device to the second device and receiving the second continuous wave signal sent by the second device, so as to facilitate the subsequent determination of the target eigenvector corresponding to the first matrix.

[0018] In some possible implementations, each first data set includes multiple groups of first data obtained by sampling a first continuous wave signal of the same frequency, the multiple groups of first data correspond to multiple sampling points one-to-one, and each group of first data includes a first in-phase data and a first orthogonal data; each second data set includes multiple groups of second data obtained by sampling a second continuous wave signal of the same frequency, the multiple groups of second data correspond to multiple sampling points one-to-one, and each group of second data includes a second in-phase data and a second orthogonal data. In this case, generating a first matrix according to the multiple first data sets and the multiple second data sets includes:

[0019] For each first data set in the plurality of first data sets, based on first in-phase data and first orthogonal data included in at least one group of first data in each first data set, determine a first complex number corresponding to each first data set;

[0020] For each second data set in the plurality of second data sets, based on second in-phase data and second orthogonal data included in at least one set of second data in each second data set, determine a second complex number corresponding to each second data set;

[0021] A plurality of third complex numbers are determined according to a plurality of first complex numbers corresponding to a plurality of first data sets and a plurality of second complex numbers corresponding to a plurality of second data sets, and a first matrix is ​​determined according to a first vector formed by the plurality of third complex numbers and a conjugate transposed vector corresponding to the first vector.

[0022] In this embodiment, the real part of the first complex number is determined based on the first in-phase data included in at least one group of first data in each first data set, the imaginary part of the first complex number is determined based on the first orthogonal data included in at least one group of first data in each first data set, and the real part of the second complex number is determined based on the second in-phase data included in at least one group of second data in each second data set, and the imaginary part of the second complex number is determined based on the second orthogonal data included in at least one group of second data in each second data set. The method for determining the first complex number and the second complex number is simple. A plurality of third complex numbers are obtained according to a plurality of first complex numbers corresponding to a plurality of first data sets and a plurality of second complex numbers corresponding to a plurality of second data sets, and a first matrix is ​​determined according to a first vector formed by the plurality of third complex numbers and a conjugate transposed vector corresponding to the first vector. Since the first in-phase data and the first orthogonal data can characterize the amplitude and phase information of the first continuous wave signal, and the second in-phase data and the second orthogonal data can characterize the amplitude and phase information of the second continuous wave signal, and the amplitude and phase information of the two are related to the first time length to be determined, then the first matrix is ​​also related to the first time length to be determined. The first matrix capable of characteristic decomposition is determined in the above manner, which facilitates the subsequent determination of the spectral function.

[0023] In some possible implementations, when each first data set includes a first phase determined according to at least one set of first data, and each second data set includes a second phase determined according to at least one set of second data, generating a first matrix according to multiple first data sets and multiple second data sets includes:

[0024] Adding a plurality of first phases corresponding to a plurality of first data sets and a plurality of second phases corresponding to a plurality of second data sets to obtain a plurality of first results;

[0025] A first matrix is ​​determined according to a second vector and a conjugate transposed vector corresponding to the second vector, wherein the second vector represents a plurality of first results in a complex form and is generated according to the plurality of first results represented in the complex form.

[0026] In this embodiment, since the multiple first results can characterize the multiple phases of the continuous wave signal during bidirectional transmission between the two devices, and these phases are related to the first time length to be determined, the first matrix constructed based on this contains the phase information of the multiple first continuous wave signals and the multiple second continuous wave signals, and the first matrix is ​​also related to the first time length to be determined. The first matrix that can be characteristically decomposed is determined in the above manner, which facilitates the subsequent determination of the spectral function.

[0027] In some possible implementations, when each first data set includes a first phase and a first amplitude determined according to at least one set of first data, and each second data set includes a second phase and a second amplitude determined according to at least one set of second data, generating a first matrix according to multiple first data sets and multiple second data sets includes:

[0028] Adding a plurality of first phases corresponding to a plurality of first data sets and a plurality of second phases corresponding to a plurality of second data sets to obtain a plurality of first results;

[0029] Multiplying a plurality of first amplitudes corresponding to a plurality of first data sets with a plurality of second amplitudes corresponding to a plurality of second data sets to obtain a plurality of second results, wherein the plurality of second results correspond one-to-one to the plurality of first results;

[0030] Expressing the plurality of first results and the plurality of second results in complex form to obtain a plurality of fourth complex numbers;

[0031] A first matrix is ​​determined according to a third vector formed by a plurality of fourth complex numbers and a conjugate transposed vector corresponding to the third vector.

[0032] In this embodiment, since the multiple first results can characterize the multiple phases of the continuous wave signal during bidirectional transmission between the two devices, and these phases are related to the first time length to be determined, and the multiple second results can characterize the multiple amplitudes of the continuous wave signal during bidirectional transmission between the two devices, and these amplitudes are also related to the first time length to be determined, then the first matrix constructed based on this not only includes the phase information of the multiple first continuous wave signals and the multiple second continuous wave signals, but also includes the amplitude information of the multiple first continuous wave signals and the multiple second continuous wave signals. The first matrix is ​​also related to the first time length to be determined. The first matrix that can be characteristically decomposed is determined in the above manner, which facilitates the subsequent determination of the spectral function.

[0033] In some possible implementations, determining the distance between the first device and the second device according to the speed of light and the first duration includes:

[0034] The speed of light is multiplied by the first duration, and half of a third result obtained after the multiplication is determined as the distance between the first device and the second device.

[0035] In this embodiment, determining the distance between the first device and the second device by the above method is simple, efficient and fast.

[0036] In some possible implementations, constructing a spectral function based on frequencies corresponding to multiple channels, a preset time interval, a first duration to be determined, and a target feature vector among multiple feature vectors includes:

[0037] A spectral function is constructed based on the second matrix, the conjugate transposed matrix corresponding to the second matrix, the third matrix, and the conjugate transposed matrix corresponding to the third matrix, wherein the elements in the second matrix are determined according to the frequencies corresponding to multiple channels, the preset time intervals, and the first time length to be determined, and the third matrix is ​​determined according to the target eigenvector.

[0038] In this embodiment, based on the characteristic that the eigenvectors corresponding to different eigenvalues ​​of the first matrix are mutually orthogonal, the second matrix is ​​determined by the frequencies corresponding to multiple channels, the preset time intervals, and the first time length to be determined, and the spectral function is constructed based on the orthogonality of the second matrix and the noise subspace (i.e., the third matrix), so as to facilitate the subsequent estimation of the first time length through the spectral peak search of the spectral function.

[0039] In some possible implementations, the spectral function is determined based on the following formula:

[0040]

[0041] Where P(τ) represents the spectral function, τ represents the first time length to be determined, a(τ) represents the second matrix, and a H (τ) represents the conjugate transposed matrix corresponding to the second matrix, U n represents the third matrix, U n H represents the conjugate transposed matrix corresponding to the third matrix, f i represents the frequency of the channel corresponding to the frequency point i, and Δt represents the preset time interval.

[0042] In some possible implementations, the first device and the second device communicate based on a Bluetooth connection.

[0043] In a second aspect, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the steps of processing in the first aspect or any one of the methods in the first aspect when executing the computer program.

[0044] In a third aspect, a device for measuring distance between devices is provided, the device is included in an electronic device, and the device has the function of implementing the behavior of the electronic device in the first aspect or the possible implementation of the first aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above functions. For example, a processing module or unit, etc.

[0045] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the steps of processing in the first aspect or any one of the methods in the first aspect.

[0046] In a fifth aspect, a computer program product is provided, the computer program product comprising: a computer program code, when the computer program code is executed by an electronic device, the electronic device executes the steps of processing in the first aspect or any one of the methods in the first aspect.

[0047] Among them, the beneficial effects of the second to fifth aspects can refer to the first aspect and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 It is a flowchart of a method for measuring distance between devices provided in an embodiment of the present application;

[0049] Figure 2 It is a schematic diagram of a process in which a first device and a second device send continuous wave signals to each other on multiple channels, provided by an embodiment of the present application;

[0050] Figure 3 It is a flowchart of another method for measuring distance between devices provided in an embodiment of the present application;

[0051] Figure 4 It is a structural schematic diagram of an apparatus for measuring distance between devices provided in an embodiment of the present application;

[0052] Figure 5 It is a schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical scheme and advantages of the present application clearer, the implementation mode of the present application will be further described in detail below with reference to the accompanying drawings. Hereinafter, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present embodiment, unless otherwise specified, the meaning of "multiple" is two or more.

[0054] First, the nouns involved in this application are explained:

[0055] (1) Frequency

[0056] Bluetooth low energy operates in the 2.4GHz ISM (industrial scientific medical) band. The available frequency range of this band is 2400MHz to 2483.5MHz. This band is divided into 40 RF channels, starting from 2402MHz with a channel interval of 2MHz. The highest channel frequency is 2480MHz, numbered from 0 to 39. These channel frequency numbers are the frequency points. Therefore, Bluetooth low energy includes 40 frequency points, from 0 to 39.

[0057] Classic Bluetooth operates in the 2.4GHz ISM band, which is divided into 79 RF channels, starting from 2402MHz with one channel every 1MHz. The highest channel frequency is 2480MHz, numbered from 0 to 78. These channel frequency numbers are the frequency points. Therefore, classic Bluetooth includes 79 frequency points, from 0 to 78.

[0058] The 2.4 GHz wireless fidelity (Wi-Fi) frequency band is divided into 14 radio frequency channels, numbered from 1 to 14. These channel frequency numbers are called frequency points. Therefore, Wi-Fi includes 14 frequency points, from 1 to 14.

[0059] ZigBee operates in the 2.4GHz ISM band, which is divided into 16 RF channels with adjacent channels spaced 5MHz apart. The channels are numbered from 11 to 26. These channel frequency numbers are called frequency points. Therefore, ZigBee includes 16 frequency points, from 11 to 26.

[0060] (2) IQ data

[0061] In signal analysis, we often perform vector decomposition on the signal, that is, decomposing the signal into two components with the same frequency and peak amplitude but a phase difference of 90°.

[0062] Using vectors to describe signals can fully describe the amplitude, frequency and phase of the signal. As a graphical tool, a vector is a rotating arrow in a rectangular coordinate system. The length of the arrow represents the peak amplitude of the signal. The counterclockwise rotation direction is the positive direction. The angle between the arrow and the positive half axis of the horizontal axis is the phase. The signal period corresponds to the time it takes for the arrow to rotate once. The number of times the signal completes a rotation per second corresponds to the signal frequency.

[0063] The length of the projection of the signal vector onto the vertical axis is equal to the peak amplitude of the signal multiplied by the sine of the phase, so if the signal is a sine wave, the projection corresponds to the instantaneous amplitude of the signal.

[0064] A sine signal (Asinωt) and a cosine signal (Acosωt) are usually used to describe these two components, where the cosine component is called the in-phase component, i.e., the I component; and the sine component is called the orthogonal component, i.e., the Q component.

[0065] IQ data is a time domain data that records the amplitude and phase characteristics of the signal. A set of IQ data includes an in-phase data and a quadrature data. Among them, I stands for In-phase, i.e. in-phase; Q stands for Quardrature, i.e. quadrature. IQ data is also called in-phase and quadrature data.

[0066] The following first briefly introduces the ranging process between two devices.

[0067] The application scenarios of distance measurement between devices are relatively wide. For example, in the password-free unlocking scenario between a watch and a mobile phone based on Bluetooth wireless communication protocol communication, it is necessary to measure the distance between the watch and the mobile phone. When the distance between the watch and the mobile phone is within the preset distance range, the mobile phone can be unlocked without a password. For another example, in the password-free unlocking scenario between a key and a vehicle based on Bluetooth wireless communication protocol communication, it is necessary to measure the distance between the key and the vehicle. When the distance between the key and the vehicle is within the preset distance range, the vehicle can be unlocked without a password.

[0068] Taking device A and device B as an example, both of which are Bluetooth devices, the distance measurement principle of device A and device B is explained.

[0069] Device A sends a continuous wave signal to device B at time t1. Device B receives the continuous wave signal sent by device A at time t2. Device B processes the received continuous wave signal. The processing time is t d After processing, device B sends a continuous wave signal to device A at the same frequency at time t3, and device A receives the continuous wave signal sent by device B at time t4.

[0070] Therefore, the time it takes for the continuous wave signal to be transmitted twice is Δt = (t4-t1)-t d , it is known that the transmission speed of the continuous wave signal is the speed of light c, then the distance d between device A and device B can be expressed by the following formula (1):

[0071]

[0072] Taking the continuous wave signal as a sine wave as an example, assuming that device B moves the frequency of the baseband signal to be sent to the frequency corresponding to a channel in the Bluetooth frequency band, the frequency conversion is required. The signal obtained after the frequency conversion is the continuous wave signal to be sent to device A. When the frequency conversion is performed, a phase-locked loop is introduced, which causes the phase of the continuous wave signal sent to device A to shift. The phase shift is The delay of the continuous wave signal received by device A is assumed to be τ, then the phase is Device A down-converts the received continuous wave signal, and the phase offset introduced is Then the final phase of the continuous wave signal received by device A from device B is Accordingly, the final phase of the continuous wave signal received by device B from device A is Device A and device B exchange the phases of their respective sampled continuous wave signals, and then the phases of the two are added together to offset the phase offset introduced by the phase-locked loop, resulting in 4πfτ.

[0073] Since continuous wave signals are sent between devices A and B on multiple channels, assuming that continuous wave signals are sent on the first channel, the phases obtained by sampling the continuous wave signals received by devices A and B are added to obtain 4πf1τ1, where f1 is the frequency corresponding to the first channel, and τ1 is the delay of the continuous wave signal sent between devices A and B. Assuming that continuous wave signals are sent on the second channel, the phases obtained by sampling the continuous wave signals received by devices A and B are added to obtain 4πf2τ2, where f2 is the frequency of the second channel, and τ2 is the delay of the continuous wave signal sent between devices A and B. Since the distance between devices A and B is fixed, the delay of the continuous wave signal sent between devices A and B is the same, that is, τ1=τ2=τ.

[0074] Assume that the difference between the first addition result (i.e., the phase addition result obtained by device A and device B respectively sampling the continuous wave signal received on the first channel) and the second addition result (i.e., the phase addition result obtained by device A and device B respectively sampling the continuous wave signal received on the second channel) is but It can be expressed by the following formula (2):

[0075]

[0076] Since the time delay τ = d / c, where d is the distance between device A and device B, and c is the speed of light, substituting the time delay formula into the above formula (2) yields the following formula (3):

[0077]

[0078] In this way, the distance d between device A and device B can be calculated by the following formula (4):

[0079]

[0080] Among them, 4π is a constant, so in order to get the distance d between device A and device B, we need to calculate The ratio of the frequency difference Δf of different channels.

[0081] That is to say, in a coordinate system with the frequency of different channels as the horizontal coordinate and the phases obtained by device A and device B sampling under different channels as the vertical coordinate, the slope k of the curve (the curve is a straight line) of the phase corresponding addition result versus frequency is: Since the frequency of the channel is known, the distance between device A and device B can be determined by calculating the phases obtained by sampling the received continuous wave signal of device A and device B under different channels.

[0082] In order to calculate the phase obtained by sampling the continuous wave signal received by device A and device B in different channels, the calculation can be performed through the IQ data sampled by device A and device B, where the IQ data is obtained by sampling the continuous wave signal received by device A and device B. In the process of inter-device ranging, device A and device B send continuous wave signals to each other on several consecutive channels, and device A and device B respectively sample the continuous wave signal corresponding to each channel to obtain IQ data. According to the IQ data, the phase obtained by sampling the continuous wave signal received by device A and device B in different channels can be calculated.

[0083] At present, there are two methods for estimating the slope k of the above curve. One is the differential averaging method, that is, calculating the phase differences between multiple adjacent channels, and then taking the average of these phase differences as The frequency difference between adjacent channels is known to be 2 MHz. Substituting it into formula (4) can calculate the distance between device A and device B. Another method is the time-frequency transformation method, that is, performing Fourier transform on the curve, converting the curve from the time domain to the frequency domain, performing peak detection on the Fourier transform result, dividing 2π by the horizontal coordinate value of the first peak to obtain the slope k, and substituting it into formula (4) can calculate the distance between device A and device B.

[0084] However, the IQ data used in the above two methods of estimating the slope is obtained by sampling the signal obtained by superimposing the signals of multiple continuous wave signal transmission paths from the other end device at one end. The signal formed after superposition includes information of multiple paths. The IQ data is affected by multiple signal transmission paths (i.e., multipath propagation of signals). Multipath propagation is mainly affected by the surrounding environment. When the continuous wave signal propagates from device A to device B, it may not be one of the signal transmission paths. The continuous wave signal sent by the device at one end propagates through multiple signal transmission paths (actual paths) before reaching the other end device. Only one path among the multiple signal transmission paths represents the actual distance between the two devices. Therefore, the distance between the two devices determined by the above method is affected by the multipath transmission of the signal, and there may be a deviation between the actual distance between the two devices.

[0085] Based on this, an embodiment of the present application provides a method for measuring the distance between devices, which is used to solve the problem in the known technology that the distance between two devices determined by the signal formed by superimposing signals from multiple signal transmission paths is affected by the multi-path transmission of the signal, and there may be a deviation between the actual distance between the two devices.

[0086] The following specific embodiments are used to describe in detail the technical solution of the present application and how the technical solution of the present application solves the above technical problems. The following specific embodiments can be implemented independently or in combination with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0087] The following is a detailed introduction to the method for measuring distance between devices provided in an embodiment of the present application.

[0088] Figure 1 A schematic flow chart of a method for measuring distance between devices is shown.

[0089] refer to Figure 1 , the distance measurement methods between devices include:

[0090] S101, a first device sends a plurality of first continuous wave signals of different frequencies on a plurality of channels to a second device at a preset time interval, and receives a plurality of second continuous wave signals of different frequencies sent by the second device on a plurality of channels after receiving the first continuous wave signals.

[0091] Among them, multiple channels for sending multiple first continuous wave signals of different frequencies and multiple channels for sending multiple second continuous wave signals of different frequencies can be determined from multiple channels divided by the wireless communication protocol used by the first device and the second device. For example, after the first device and the second device establish a wireless communication connection, the first device and the second device (hereinafter collectively referred to as the two devices) negotiate on which frequency points to send continuous wave signals to each other, as well as the time interval for sending continuous wave signals. Since the frequency point is a number for the channel frequency, the frequency point can be used to determine which channels send continuous wave signals to each other. For example, suppose that the two devices negotiate to send continuous wave signals to each other on the first frequency point (i.e., frequency point 1) to the tenth frequency point (i.e., frequency point 10), that is, the two devices send continuous wave signals to each other on the first channel to the tenth channel.

[0092] The preset time interval may be greater than or equal to 10 μs (microseconds), less than or equal to 30 μs, for example, 16 μs, or other values, which are not limited here. The wireless communication protocol may be a communication protocol such as low-power Bluetooth, Wi-Fi, and ZigBee, which are not limited here. The number of channels may be at least 2 and at most the total number of channels divided by the wireless communication protocol used by the first device and the second device. This embodiment does not specifically limit which channels are used.

[0093] Multiple first continuous wave signals and multiple second continuous wave signals correspond one-to-one to multiple channels, and the frequency of the first continuous wave signal and the second continuous wave signal sent on the same channel is the same. The first device and the second device can be devices that support wireless communication protocols, such as both devices support Bluetooth communication protocols, and both devices support Wi-Fi communication protocols, which are not limited here. Devices that support wireless communication protocols may include: Bluetooth headsets, wireless speakers, wireless bracelets, wireless cars, wireless smart glasses, wireless watches, augmented reality (AR) / virtual reality (VR) devices, media players (such as MP3, MP4, etc.), notebooks, computers, PDAs, mobile phones, televisions or smart watches and other devices that support wireless communication protocols, which are not specifically limited here.

[0094] Optionally, since different wireless communication protocols may divide channels differently, in order to ensure that the first device and the second device can normally send and receive continuous wave signals, the first device and the second device need to communicate based on the same wireless communication protocol. For example, the first device and the second device communicate based on the low-power Bluetooth wireless communication protocol. In this case, the number of multiple channels in S101 can be up to 40; for another example, the first device and the second device communicate based on the classic Bluetooth wireless communication protocol. In this case, the number of multiple channels in S101 can be up to 79; for another example, the first device and the second device communicate based on the Wi-Fi wireless communication protocol. In this case, the number of multiple channels in S101 can be up to 14; for another example, the first device and the second device communicate based on the wireless communication protocol ZigBee. In this case, the number of multiple channels in S101 can be up to 16.

[0095] Figure 2 Taking two channels as an example, a process in which a first device and a second device send continuous wave signals to each other on multiple channels is illustrated. The following example takes two devices communicating based on the low-power Bluetooth wireless communication protocol, and the frequencies of the two channels are numbered as frequency points 1 and 2. The frequency point 1 corresponds to the first channel, and the frequency point 2 corresponds to the second channel. The frequency of the first channel corresponding to the frequency point 1 is f1, and the frequency of the second channel corresponding to the frequency point 2 is f2. Figure 2 The implementation process of S101 is described.

[0096] The first device and the second device communicate based on a Bluetooth connection. The first device and the second device are equipped with a Bluetooth chip. The Bluetooth chip can realize communication between the two devices. The Bluetooth chip configured in the first device can send a continuous wave signal to the second device and receive a continuous wave signal sent by the second device. The Bluetooth chip configured in the second device can send a continuous wave signal to the first device and receive a continuous wave signal sent by the first device. The Bluetooth chip can be a low-power Bluetooth chip or a classic Bluetooth chip, which is not limited here.

[0097] refer to Figure 2 , the process of two devices sending continuous wave signals to each other on two channels includes:

[0098] S201: A first device sends a first continuous wave signal with a frequency of f1 to a second device on a first channel.

[0099] The first device controls its own transceiver (such as an antenna) through the Bluetooth chip configured in the first device to send a first continuous wave signal with a frequency of f1 to the second device through the first channel.

[0100] S202: The second device receives a first continuous wave signal with a frequency of f1 through a first channel.

[0101] The second device controls its own transceiver (such as an antenna) through the Bluetooth chip configured in the second device to receive the first continuous wave signal with a frequency of f1 sent by the first device through the first channel.

[0102] S203: The second device sends a second continuous wave signal with a frequency of f1 to the first device on the first channel.

[0103] After receiving the first continuous wave signal with a frequency of f1 sent by the first device, the second device controls its own transceiver through the Bluetooth chip configured in the second device to send a second continuous wave signal with a frequency of f1 to the first device through the first channel.

[0104] S204: The first device receives a second continuous wave signal with a frequency of f1 through the first channel.

[0105] The first device controls its own transceiver through the Bluetooth chip configured in the first device to receive the second continuous wave signal with a frequency of f1 sent by the second device through the first channel.

[0106] S205: After a preset time interval, the first device sends a first continuous wave signal with a frequency of f2 to the second device on the second channel.

[0107] The first device receives a second continuous wave signal with a frequency of f1 sent by the second device, and after a preset time interval, controls its own transceiver through its own configured Bluetooth chip to send a first continuous wave signal with a frequency of f2 to the second device through the second channel.

[0108] S206: The second device receives a first continuous wave signal with a frequency of f2 through a second channel.

[0109] The second device controls its own transceiver through the Bluetooth chip configured in the second device to receive the first continuous wave signal with a frequency of f2 sent by the first device through the second channel.

[0110] S207: The second device sends a second continuous wave signal with a frequency of f2 to the first device on a second channel.

[0111] After receiving the first continuous wave signal with a frequency of f2 sent by the first device, the second device controls its own transceiver through the Bluetooth chip configured in the second device to send a second continuous wave signal with a frequency of f2 to the first device through the second channel.

[0112] S208: The first device receives a second continuous wave signal with a frequency of f2 through a second channel.

[0113] The first device controls its own transceiver through the Bluetooth chip configured in the first device to receive the second continuous wave signal with a frequency of f2 sent by the second device through the second channel.

[0114] It should be noted that: Figure 2 The first channel and the second channel shown are only used to exemplify the channels used in the process of two devices sending continuous wave signals to each other. Other channels can also be selected from the multiple channels, which is not limited here.

[0115] S102, generating a first matrix based on a plurality of first continuous wave signals and a plurality of second continuous wave signals, and determining a plurality of eigenvalues ​​corresponding to the first matrix and a plurality of eigenvectors corresponding to the plurality of eigenvalues.

[0116] The eigendecomposition function may be an eig function or other functions that can be used for eigendecomposition, which is not limited here.

[0117] Specifically, after the first device receives multiple second continuous wave signals of different frequencies sent by the second device on multiple channels after receiving the first continuous wave signal, the first device processes the multiple first continuous wave signals and the multiple second continuous wave signals according to the multiple first continuous wave signals received by the second device from the first device and the multiple second continuous wave signals received by the first device from the second device, and generates a first matrix capable of eigendecomposition through the data obtained after the processing. After the first matrix is ​​generated, the first matrix is ​​eigendecomposed through the eigendecomposition function, and the first matrix can be expressed as the following formula after the eigendecomposition:

[0118] R=UΛU H (5)

[0119] Where R represents the first matrix, Λ represents the diagonal matrix composed of the eigenvalues ​​of the first matrix, U represents the matrix composed of the eigenvectors corresponding to the eigenvalues, and U H The conjugate transposed matrix corresponding to the matrix composed of eigenvectors is represented. The first matrix is ​​a square matrix, and its order is the same as the number of multiple channels that send continuous wave signals to each other.

[0120] Therefore, through the above eigendecomposition, multiple eigenvalues ​​corresponding to the first matrix and multiple eigenvectors corresponding to the multiple eigenvalues ​​can be obtained.

[0121] S103: construct a spectral function based on the frequencies corresponding to the multiple channels, the preset time interval, the first time length to be determined, and the target feature vector in the multiple feature vectors.

[0122] The first duration is the duration from when the first device sends the first continuous wave signal to the second device to when the second continuous wave signal sent by the second device is received, and the eigenvalue corresponding to the target eigenvector is less than or equal to the preset threshold. The preset threshold can be the average value of the maximum eigenvalue and the minimum eigenvalue among the multiple eigenvalues ​​corresponding to the first matrix, or the average value of all eigenvalues ​​corresponding to the first matrix, which is not specifically limited here.

[0123] Specifically, after obtaining multiple eigenvalues ​​corresponding to the first matrix and multiple eigenvectors corresponding to the multiple eigenvalues, the first device determines the eigenvector corresponding to the eigenvalue that is less than or equal to a preset threshold among the multiple eigenvalues ​​as the target vector, and constructs a spectral function with the first time length to be determined as the independent variable based on the frequencies corresponding to the multiple channels, the preset time interval, the first time length to be determined, and the target eigenvector, so as to facilitate the subsequent determination of the value of the first time length to be determined through the spectral function.

[0124] In some embodiments, constructing a spectral function based on the frequencies corresponding to the multiple channels, the preset time interval, the first duration to be determined, and the target feature vector in the multiple feature vectors includes:

[0125] A spectral function is constructed based on the second matrix, the conjugate transposed matrix corresponding to the second matrix, the third matrix, and the conjugate transposed matrix corresponding to the third matrix, wherein the elements in the second matrix are determined according to the frequencies corresponding to multiple channels, the preset time intervals, and the first time length to be determined, and the third matrix is ​​determined according to the target eigenvector.

[0126] Specifically, the elements in the second matrix are determined according to the frequencies corresponding to the multiple channels, the preset time intervals, and the first time length to be determined, thereby obtaining the second matrix. The eigenvalues ​​less than or equal to the preset threshold value among the multiple eigenvalues ​​are arranged in order from large to small, and the target eigenvectors corresponding to these eigenvalues ​​are formed into a third matrix according to their corresponding relationship with the eigenvalues. According to the second matrix, the conjugate transposed matrix corresponding to the second matrix, the third matrix, and the conjugate transposed matrix corresponding to the third matrix, the spectral function is obtained by performing mathematical operations on these four matrices.

[0127] In order to illustrate the determination process of the third matrix, the Λ in the above formula (5) is arranged in descending order, and Λ is expressed as ∑ x and∑ n Two diagonal matrices, U is represented by U x and U n Two matrices, then the above formula (5) can be expressed as follows:

[0128]

[0129] Among them, ∑ x=diag{λ1,λ2,…,λ L}, n =diag{λ L+1 ,λ L+2 ,…,λ M},λ1≥λ2≥…≥λ M , and λ1,λ2,…,λ L are greater than the preset threshold, λ L+1 ,λ L+2 ,…,λ M are all less than or equal to the preset threshold, M represents the value corresponding to the number of multiple channels that send continuous wave signals to each other, L represents the number of signal transmission paths, 0<L<M, L is a positive integer, and the eigenvector u L+1 ,u L+2 ,…,u M is the target feature vector, U x is composed of λ1,λ2,…,λ L The corresponding eigenvectors u1,u2,…,u L The generated subspace, U n is L+1 ,λ L+2 ,…,λ M The corresponding eigenvector u L+1 ,u L+2 ,…,u M The generated subspace, U n That is, the third matrix. Since the energy of the signal is much greater than the energy of the noise, it is reflected in the eigenvalue that the eigenvalue corresponding to the signal is greater than the eigenvalue corresponding to the noise. Therefore, U x ∈C M×L is called the signal subspace, C represents the set of complex numbers, U n ∈C M×(M-L) is called the noise subspace.

[0130] It should be noted that the above-mentioned construction of the spectral function based on the second matrix, the conjugate transposed matrix corresponding to the second matrix, the third matrix, and the conjugate transposed matrix corresponding to the third matrix is ​​only an example of the spectral function construction method. The spectral function can also be constructed in other ways, and this embodiment does not make any specific limitations on this.

[0131] In this embodiment, based on the characteristic that the eigenvectors corresponding to different eigenvalues ​​of the first matrix are mutually orthogonal, the second matrix is ​​determined by the frequencies corresponding to multiple channels, the preset time intervals, and the first time length to be determined, and the spectral function is constructed based on the orthogonality of the second matrix and the noise subspace (i.e., the third matrix), so as to facilitate the subsequent estimation of the first time length through the spectral peak search of the spectral function.

[0132] S104: Determine the value of the first time duration to be determined corresponding to the peak value of the spectrum function as the first time duration, and determine the distance between the first device and the second device according to the speed of light and the first time duration.

[0133] Among them, the value range corresponding to the first time length τ to be determined is: d max Indicates the maximum transmission distance corresponding to the wireless communication protocol used by the first device and the second device, and max indicates the maximum value.

[0134] After the first device determines the spectral function, it searches for a spectral peak of the spectral function within the value range corresponding to the first time length τ to be determined, and determines the value of the first time length to be determined corresponding to the peak value of the spectral function as the first time length. Since the transmission speed of the continuous wave signal is equal to the speed of light, after determining the first time length, the distance between the first device and the second device can be obtained through corresponding mathematical operations based on the speed of light and the first time length.

[0135] In some embodiments, determining the distance between the first device and the second device according to the speed of light and the first duration includes:

[0136] The speed of light is multiplied by the first duration, and half of a third result obtained after the multiplication is determined as the distance between the first device and the second device.

[0137] Specifically, after obtaining the first time length, since the first time length is the time length between the first device sending the first continuous wave signal to the second device and receiving the second continuous wave signal sent by the second device, that is to say, the first time length corresponds to the time length of the two-way transmission of the continuous wave signal between the two devices, which corresponds to twice the distance between the first device and the second device, therefore, multiply the speed of light and the first time length, and multiply the third result obtained after the multiplication by one half, the distance between the first device and the second device is obtained.

[0138] The distance between the first device and the second device can be expressed by the following formula:

[0139]

[0140] Where d represents the distance between the first device and the second device, τ * Indicates the value of the first duration to be determined corresponding to the peak value of the spectral function.

[0141] In this embodiment, a first matrix is ​​generated by using a plurality of first continuous wave signals and a plurality of second continuous wave signals. Since the plurality of first continuous wave signals received by the second device are related to the duration of their transmission from the first device to the second device, and the plurality of second continuous wave signals received by the first device are related to the duration of their transmission from the second device to the first device, that is, the first matrix is ​​related to the duration (that is, the first duration to be determined) from the first device sending the first continuous wave signal to the second device to the receipt of the second continuous wave signal sent by the second device, and the first continuous wave signal is the result of the superposition of signals and noise from a plurality of signal transmission paths of the first device, and the second continuous wave signal is the result of the superposition of signals and noise from a plurality of signal transmission paths of the second device, then the first matrix includes both information corresponding to the signals of the plurality of signal transmission paths and information corresponding to the noise. However, since the energy of the noise of the first matrix is ​​much smaller than the energy of the signal, in order to solve the problem that the signal formed by the superposition of signals of the plurality of signal transmission paths makes the measured device time To solve the problem of distance deviation, a feature vector whose eigenvalue is less than or equal to a preset threshold value among multiple eigenvectors determined according to the first matrix is ​​used as a target eigenvector. Then, according to the target eigenvector, the frequencies corresponding to multiple channels, the preset time interval, and the first time length to be determined, a spectral function with the first time length to be determined as the independent variable is constructed. Since, when constructing the spectral function, the information corresponding to the signals of the multiple signal transmission paths included in the first matrix is ​​excluded by selecting the target eigenvector, and only the information corresponding to the noise is retained, the first time length corresponding to the peak value of the spectral function is infinitely close to the time length corresponding to the actual signal transmission path between the first device sending the first continuous wave signal to the second device and receiving the second continuous wave signal sent by the second device. Then, the distance between the first device and the second device determined based on the speed of light and the value of the first time length is infinitely close to the distance corresponding to the actual signal transmission path between the first device and the second device. Therefore, the above scheme can reduce the influence of multi-path transmission of signals on the accuracy of ranging between devices.

[0142] Figure 3 A schematic flow chart of another method for measuring distance between devices is shown.

[0143] refer to Figure 3 , the distance measurement methods between devices include:

[0144] S301, a first device sends a plurality of first continuous wave signals of different frequencies on a plurality of channels to a second device at a preset time interval, and receives a plurality of second continuous wave signals of different frequencies sent by the second device on a plurality of channels after receiving the first continuous wave signals.

[0145] The specific implementation method of this step refers to the description in S101 above, and will not be repeated here to avoid repetition.

[0146] S302: Acquire a plurality of first data sets associated with a plurality of first continuous wave signals.

[0147] Among them, multiple first data sets correspond one-to-one to multiple first continuous wave signals, each first data set includes multiple groups of first data obtained after sampling the first continuous wave signal of the same frequency, or includes a first phase determined based on at least one group of first data, or includes a first phase and a first amplitude determined based on at least one group of first data, multiple groups of first data correspond one-to-one to multiple sampling points, and each group of first data includes a first in-phase data and a first orthogonal data.

[0148] Specifically, after the second device receives multiple first continuous wave signals of different frequencies sent by the first device on multiple channels at preset time intervals, the second device processes each first continuous wave signal to obtain multiple first data sets associated with the multiple first continuous wave signals, and sends the multiple first data sets to the first device. Alternatively, the second device samples each first continuous wave signal and obtains multiple groups of first data corresponding to each first continuous wave signal to the first device, and the first device determines the first phase according to at least one group of first data corresponding to each first continuous wave signal. The multiple first phases corresponding to the multiple first continuous wave signals are the multiple first data sets associated with the multiple first continuous wave signals. Alternatively, the first device determines the first phase and the first amplitude according to at least one group of first data corresponding to each first continuous wave signal. The multiple first phases and the multiple first amplitudes corresponding to the multiple first continuous wave signals are the multiple first data sets associated with the multiple first continuous wave signals.

[0149] The second device processes each first continuous wave signal in the same way. Taking the reception of the first continuous wave signal with a frequency of f1 as an example, the process of obtaining the first data set associated with the first continuous wave signal with a frequency of f1 is specifically described below.

[0150] In one implementation, the second device samples the first continuous wave signal with a frequency of f1 based on a first sampling rate to obtain multiple groups of first data (i.e., multiple groups of first IQ data), each group of first data includes a first in-phase data and a first orthogonal data, and the above multiple groups of first data are the first data sets corresponding to the first continuous wave signal with a frequency of f1.

[0151] Among them, the first sampling rate can be determined according to the sampling rate corresponding to the chip of the wireless communication protocol configured in the second device. According to the first sampling rate, the corresponding sampling interval and number of sampling points can be determined, and the number of sampling points is equal to the number of groups of the first data.

[0152] In another implementation, the second device selects a group of first data corresponding to at least one sampling point from multiple groups of first data obtained by sampling a first continuous wave signal with a frequency of f1, and calculates a first phase based on the group of first data corresponding to the at least one sampling point. The first phase is the first data set corresponding to the first continuous wave signal with a frequency of f1.

[0153] Exemplarily, a group of first data corresponding to the hth (0<h≤N, N is the total number of sampling points, h is an integer) sampling point is selected, and a first in-phase data of the group of first data is I 1h Indicates that a first orthogonal data is represented by Q 1h In the case of 1h It can be expressed by the following formula (8):

[0154]

[0155] Here, arctan represents the inverse tangent function.

[0156] Exemplarily, when multiple groups of first data corresponding to multiple sampling points are selected, a phase corresponding to each sampling point can be determined by the above formula (8), and multiple phases corresponding to the multiple sampling points are added, and the average value of the phase sum obtained after the addition is calculated, and the average value is used as the first phase.

[0157] Exemplarily, when multiple groups of first data corresponding to multiple sampling points are selected, a phase corresponding to each sampling point can be determined by the above formula (8), and the phase is used as the vertical coordinate and the hth sampling point is used as the horizontal coordinate. A linear fit is performed on the multiple phases to obtain a straight line, and then the phase corresponding to any point in the straight line is used as the first phase.

[0158] The linear fitting method may be the least square method or other methods, which are not limited here.

[0159] It should be noted that the above method for determining the first phase is only for illustrative purposes and is not intended to be limiting. Other methods may also be used to determine the first phase.

[0160] In another implementation, the second device can send multiple groups of first data corresponding to each first continuous wave signal obtained by sampling each first continuous wave signal to the first device, and the first device executes the above-mentioned process of determining the first phase to obtain the first data set corresponding to the first continuous wave signal with a frequency of f1. The process of the first device determining the first phase refers to the above-mentioned description of the second device determining the first phase, and in order to avoid repetition, it will not be repeated here.

[0161] In another implementation, the second device selects a group of first data corresponding to at least one sampling point from multiple groups of first data obtained by sampling the first continuous wave signal with a frequency of f1, and calculates a first phase and a first amplitude based on the group of first data corresponding to the at least one sampling point. The first phase and the first amplitude are the first data set corresponding to the first continuous wave signal with a frequency of f1.

[0162] The process of the second device calculating the first phase has been described above, and will not be repeated here to avoid repetition.

[0163] Exemplarily, in the selected first data corresponding to the h-th sampling point, a first in-phase data of the first data is represented by I 1h Indicates that a first orthogonal data is represented by Q 1h In the case of the first amplitude (A 1h It can be expressed by the following formula (9):

[0164]

[0165] It should be noted that the first amplitude in the above formula (9) and the first phase in the above formula (8) are calculated for the same set of first data, and therefore, the two are corresponding.

[0166] Exemplarily, when multiple groups of first data corresponding to multiple sampling points are selected, an amplitude corresponding to each sampling point can be determined by the above formula (9), and multiple amplitudes corresponding to the multiple sampling points are added, and the average value of the amplitudes obtained after the addition is calculated, and the average value is used as the first amplitude.

[0167] It should be noted that the above method for determining the first amplitude is only for illustrative purposes and is not intended to be limiting. Other methods may also be used to determine the first amplitude.

[0168] In another implementation, the second device can send multiple groups of first data corresponding to each first continuous wave signal obtained by sampling each first continuous wave signal to the first device, and the first device executes the above-mentioned process of determining the first phase and the first amplitude to obtain the first data set corresponding to the first continuous wave signal with a frequency of f1. The process of the first device determining the first phase and the first amplitude refers to the above-mentioned process of the second device determining the first phase and the first amplitude, and in order to avoid repetition, it will not be repeated here.

[0169] S303: Acquire a plurality of second data sets associated with a plurality of second continuous wave signals.

[0170] Among them, multiple second data sets correspond one-to-one to multiple second continuous wave signals, each second data set includes multiple groups of second data obtained after sampling the second continuous wave signal of the same frequency, or includes a second phase determined based on at least one group of second data, or includes a second phase and a second amplitude determined based on at least one group of second data, multiple groups of second data correspond one-to-one to multiple sampling points, each group of second data includes a second in-phase data and a second orthogonal data, and multiple second data sets correspond one-to-one to multiple first data sets.

[0171] Specifically, after the first device receives multiple second continuous wave signals of different frequencies sent by the second device on multiple channels after receiving the first continuous wave signal, the first device processes each second continuous wave signal to obtain multiple second data sets associated with the multiple second continuous wave signals.

[0172] The first device processes each second continuous wave signal in the same manner. Taking the reception of the second continuous wave signal with a frequency of f1 as an example, the process of obtaining the second data set associated with the second continuous wave signal with a frequency of f1 is specifically described below.

[0173] In one implementation, the first device samples a second continuous wave signal with a frequency of f1 based on a second sampling rate to obtain multiple groups of second data (i.e., multiple groups of second IQ data), each group of second data includes a second in-phase data and a second orthogonal data, and the above multiple groups of second data are the second data sets corresponding to the second continuous wave signal with a frequency of f1.

[0174] The second sampling rate can be determined according to the sampling rate corresponding to the chip of the wireless communication protocol configured in the first device, and the sampling interval and the number of sampling points corresponding to the second sampling rate can be determined, and the number of sampling points is equal to the number of groups of the second data. Preferably, the second sampling rate is equal to the first sampling rate to ensure that the number of groups of the first data is equal to the number of groups of the second data.

[0175] In another implementation, the first device selects a group of second data corresponding to at least one sampling point from multiple groups of second data obtained by sampling a second continuous wave signal with a frequency of f1, and calculates a second phase based on the group of second data corresponding to the at least one sampling point. The second phase is the second data set corresponding to the second continuous wave signal with a frequency of f1.

[0176] It should be noted that: in order to maintain data consistency, preferably, the first device selects a set of second data corresponding to at least one sampling point when calculating the second phase, and the sampling point selected here should be the same as at least one sampling point corresponding to at least one set of first data selected by the second device or the first device when calculating the first phase. For example, assuming that in S302, the multiple sets of first data selected by the second device or the first device when calculating the first phase correspond to the data of the 3rd to the 10th sampling points (a total of 8 sampling points), then the multiple sets of second data selected by the first device when calculating the second phase should also correspond to the data of the 3rd to the 10th sampling points.

[0177] Exemplarily, when a group of second data corresponding to the hth sampling point is selected, a second in-phase data of the group of second data is represented by I 2h Indicates that a second orthogonal data is represented by Q 2h In the case of 2h It can be expressed by the following formula (10):

[0178]

[0179] Exemplarily, when multiple groups of second data corresponding to multiple sampling points are selected, a phase corresponding to each sampling point can be determined by the above formula (10), and multiple phases corresponding to the multiple sampling points are added, and the average value of the phase sum obtained after the addition is calculated, and the average value is used as the second phase.

[0180] Exemplarily, when multiple groups of second data corresponding to multiple sampling points are selected, a phase corresponding to each sampling point can be determined by the above formula (10), and the phase is used as the vertical coordinate and the hth sampling point is used as the horizontal coordinate. A linear fit is performed on the multiple phases to obtain a straight line, and then the phase corresponding to any point in the straight line is used as the second phase.

[0181] The linear fitting method may be the least square method or other methods, which are not limited here.

[0182] It should be noted that the above method for determining the second phase is only for illustrative purposes and is not intended to be limiting. Other methods may also be used to determine the second phase.

[0183] In another implementation, the first device selects a group of second data corresponding to at least one sampling point from multiple groups of second data obtained by sampling a second continuous wave signal with a frequency of f1, and calculates a second phase and a second amplitude based on the group of second data corresponding to the at least one sampling point. The second phase and the second amplitude are the second data set corresponding to the second continuous wave signal with a frequency of f1.

[0184] It should be noted that: in order to maintain data consistency, preferably, the first device selects a group of second data corresponding to at least one sampling point when calculating the second phase and the second amplitude, and the sampling point selected here should be the same as at least one sampling point corresponding to at least one group of first data selected by the second device or the first device when calculating the first phase and the first amplitude. For example, assuming that in S302, the multiple groups of first data selected by the second device or the first device when calculating the first phase and the first amplitude correspond to the data of the 3rd to the 10th sampling points (a total of 8 sampling points), then the multiple groups of second data selected by the first device when calculating the second phase and the second amplitude should also correspond to the data of the 3rd to the 10th sampling points.

[0185] The process of the first device calculating the second phase has been described above, and will not be repeated here to avoid repetition.

[0186] Exemplarily, when a group of second data corresponding to the hth sampling point is selected, a second in-phase data of the group of second data is represented by I 2h Indicates that a second orthogonal data is represented by Q 2h In the case of the second amplitude (A 2h It can be expressed by the following formula (11):

[0187]

[0188] It should be noted that the second amplitude in the above formula (11) and the second phase in the above formula (10) are calculated for the same set of second data, and therefore, the two are corresponding.

[0189] Exemplarily, when multiple groups of second data corresponding to multiple sampling points are selected, an amplitude corresponding to each sampling point can be determined by the above formula (11), and the multiple amplitudes corresponding to the multiple sampling points are added together, and the average value of the amplitudes obtained after the addition is calculated, and the average value is used as the second amplitude.

[0190] It should be noted that the above method for determining the second amplitude is only for illustrative purposes and is not intended to be limiting. Other methods may also be used to determine the second amplitude.

[0191] S304: Generate a first matrix according to the multiple first data sets and the multiple second data sets, and determine multiple eigenvalues ​​corresponding to the first matrix and multiple eigenvectors corresponding to the multiple eigenvalues.

[0192] Specifically, after acquiring multiple first data sets and multiple second data sets, the first device generates a first matrix based on corresponding mathematical operations according to the three data forms included in the multiple first data sets and the three data forms included in the multiple second data sets, using multiple first data sets and multiple second data sets of the same type of data form.

[0193] In one implementation, taking the example that each first data set includes multiple groups of first data obtained by sampling a first continuous wave signal of the same frequency, the multiple groups of first data correspond one-to-one to multiple sampling points, each group of first data includes a first in-phase data and a first orthogonal data, and each second data set includes multiple groups of second data obtained by sampling a second continuous wave signal of the same frequency, the multiple groups of second data correspond one-to-one to multiple sampling points, and each group of second data includes a second in-phase data and a second orthogonal data, the process of generating a first matrix according to the multiple first data sets and the multiple second data sets in S304 is described below:

[0194] For each first data set in the plurality of first data sets, based on first in-phase data and first orthogonal data included in at least one group of first data in each first data set, determine a first complex number corresponding to each first data set;

[0195] For each second data set in the plurality of second data sets, based on second in-phase data and second orthogonal data included in at least one set of second data in each second data set, determine a second complex number corresponding to each second data set;

[0196] A plurality of third complex numbers are determined according to a plurality of first complex numbers corresponding to a plurality of first data sets and a plurality of second complex numbers corresponding to a plurality of second data sets, and a first matrix is ​​determined according to a first vector formed by the plurality of third complex numbers and a conjugate transposed vector corresponding to the first vector.

[0197] Specifically, when each group of first data includes a first in-phase data and a first orthogonal data, and each group of second data includes a second in-phase data and a second orthogonal data, the first device processes each first data set to determine the first complex number corresponding thereto in the same way as the first device processes each second data set to determine the second complex number corresponding thereto. The following takes the first data set associated with the first continuous wave signal with a frequency of f1 as an example to illustrate the process of the first device determining the corresponding first complex number.

[0198] Exemplarily, if the hth group of first data (corresponding to the hth sampling point) is selected from the first data set associated with the first continuous wave signal with a frequency of f1, it includes the first in-phase data I 1h With the first orthogonal data Q 1h, then the first complex number corresponding to the first data set (using Z 1h It can be expressed by the following formula:

[0199] Z 1h =I 1h +Q 1h *j (12)

[0200] Among them, I 1h represents the real part of the first complex number, Q 1h represents the imaginary part of the first complex number, and j represents the imaginary unit.

[0201] Exemplarily, if multiple groups of first data (corresponding to multiple sampling points) are selected from a first data set associated with a first continuous wave signal with a frequency of f1, then multiple first in-phase data can be added, and a first average value can be calculated for the data obtained after the addition, and multiple first orthogonal data can be added, and a second average value can be calculated for the data obtained after the addition, and the first average value is used as the real part of the first complex number, and the second average value is used as the imaginary part of the first complex number to obtain the first complex number.

[0202] It should be noted that the above method for determining the first plural number is only for illustrative purposes and is not intended to be limiting. Other methods may also be used to determine the first plural number.

[0203] Correspondingly, if the hth group of second data (corresponding to the hth sampling point) is selected from the second data set associated with the second continuous wave signal with a frequency of f1, it includes the second in-phase data I 2h The second orthogonal data Q 2h , then the second complex number corresponding to the second data set (using Z 2h It can be expressed by the following formula:

[0204] Z 2h =I 2h +Q 2h *j (13)

[0205] Among them, I 2h represents the real part of the second complex number, Q 2h Represents the imaginary part of the second complex number.

[0206] After obtaining multiple first complex numbers corresponding to multiple first data sets and multiple second complex numbers corresponding to multiple second data sets, since the multiple first complex numbers and the multiple second complex numbers correspond one-to-one, the first device multiplies the multiple first complex numbers and the multiple second complex numbers correspondingly to obtain multiple third complex numbers.

[0207] Exemplarily, the first complex number corresponding to the first data set associated with the first continuous wave signal with a frequency of f1 is Z 1hThe second complex number corresponding to the second data set associated with the second continuous wave signal with a frequency of f1 is Z 2h In the case of the third complex number corresponding to the two (using Z 3h It can be expressed by the following formula:

[0208] Z 3h =Z 1h *Z 2h (14)

[0209] Substituting formulas (12) and (13) into formula (14) we can obtain the third complex number.

[0210] After obtaining a plurality of third complex numbers, the plurality of third complex numbers are expressed in a vector form to obtain a first vector. The first vector may be a first row vector or a first column vector. Assuming that M is 40, the frequencies of the plurality of channels that transmit continuous wave signals to each other are numbered as frequency points 1 to 40, and the channels corresponding to the frequency points 1 to 40 are the first channel to the fortieth channel. Then, the number of the third complex numbers is also 40. The first vector may be expressed by the following formula (15) or (16):

[0211] y1=(a1+b1*j a2+b2*j … a 40 +b 40 *j) (15)

[0212] y1=(a1+b1*j a2+b2*j … a 40 +b 40 *j) T (16)

[0213] Wherein, y1 represents the first vector, a1 represents the real part of the first third complex number in the plurality of third complex numbers, b1 represents the imaginary part of the first third complex number in the plurality of third complex numbers, a2 represents the real part of the second third complex number in the plurality of third complex numbers, b2 represents the imaginary part of the second third complex number in the plurality of third complex numbers, ..., a 40 represents the real part of the 40th third complex number among multiple third complex numbers, b 40 represents the imaginary part of the 40th third complex number in the plurality of third complex numbers, and T represents transposing the matrix.

[0214] In one implementation, when the first vector is a first row vector, as represented in formula (15), the first matrix is ​​determined according to the first vector formed by a plurality of third complex numbers and the conjugate transposed vector corresponding to the first vector: the conjugate transposed vector corresponding to the first vector is multiplied by the first vector to obtain the first matrix, that is, R=y1 H *y1.

[0215] In another implementation, when the first vector is a first column vector, as represented in formula (16), the first matrix is ​​determined according to the first vector formed by a plurality of third complex numbers and the conjugate transposed vector corresponding to the first vector: the first vector is multiplied by the conjugate transposed vector corresponding to the first vector to obtain the first matrix, that is, R = y1*y1 H .

[0216] Among them, the first matrix obtained in the above two methods of determining the first matrix can be called the covariance matrix corresponding to the first vector (the first vector is the first row vector or the first column vector, so it can also be called a row matrix or a column matrix). H =R H R, so R is a normal matrix, which can be eigendecomposed into the form shown in formula (5).

[0217] It should be noted that the above method of determining the first matrix based on the first vector and the conjugate transposed vector corresponding to the first vector is only for illustrative purposes and is not intended to limit it. Other methods may also be used to determine the first matrix, which is not limited in this embodiment.

[0218] In this embodiment, the real part of the first complex number is determined based on the first in-phase data included in at least one group of first data in each first data set, the imaginary part of the first complex number is determined based on the first orthogonal data included in at least one group of first data in each first data set, and the real part of the second complex number is determined based on the second in-phase data included in at least one group of second data in each second data set, and the imaginary part of the second complex number is determined based on the second orthogonal data included in at least one group of second data in each second data set. The method for determining the first complex number and the second complex number is simple. A plurality of third complex numbers are obtained according to a plurality of first complex numbers corresponding to a plurality of first data sets and a plurality of second complex numbers corresponding to a plurality of second data sets, and a first matrix is ​​determined according to a first vector formed by the plurality of third complex numbers and a conjugate transposed vector corresponding to the first vector. Since the first in-phase data and the first orthogonal data can characterize the amplitude and phase information of the first continuous wave signal, and the second in-phase data and the second orthogonal data can characterize the amplitude and phase information of the second continuous wave signal, and the amplitude and phase information of the two are related to the first time length to be determined, then the first matrix is ​​also related to the first time length to be determined. The first matrix capable of characteristic decomposition is determined in the above manner, which facilitates the subsequent determination of the spectral function.

[0219] In another implementation, taking the example that each first data set includes a first phase determined according to at least one set of first data, and each second data set includes a second phase determined according to at least one set of second data, the process of generating a first matrix according to multiple first data sets and multiple second data sets in S304 is described below:

[0220] Adding a plurality of first phases corresponding to a plurality of first data sets and a plurality of second phases corresponding to a plurality of second data sets to obtain a plurality of first results;

[0221] A first matrix is ​​determined according to a second vector and a conjugate transposed vector corresponding to the second vector, wherein the second vector represents a plurality of first results in a complex form and is generated according to the plurality of first results represented in the complex form.

[0222] Specifically, since the multiple first data sets correspond to the multiple second data sets one-to-one, and each first data set includes the first phase, and each second data set includes the second phase, the multiple first phases corresponding to the multiple first data sets and the multiple second phases corresponding to the multiple second data sets also correspond to each other one-to-one. The multiple first phases corresponding to the multiple first data sets and the multiple second phases corresponding to the multiple second data sets are added together to obtain multiple first results, which can offset the phase offset caused by the phase-locked loop introduced when the first device and the second device send continuous wave signals, and the multiple first results can characterize the multiple phases of the continuous wave signal bidirectionally transmitted between the two devices. Assuming that M is 40, the frequencies of the multiple channels that send continuous wave signals to each other are numbered from frequency points 1 to 40, and the channels corresponding to frequency points 1 to 40 are the first channel to the fortieth channel, then the number of the multiple first results is 40, and the second vector can be expressed by the following formula (17) or (18):

[0223]

[0224]

[0225] Among them, y2 represents the second vector, represents the first first result among multiple first results, Indicates the plural representation of the first first result among multiple first results. Indicates the second first result among multiple first results. represents the complex representation corresponding to the second first result among multiple first results, ..., indicates the 40th first result among multiple first results, Indicates the complex number representation corresponding to the 40th first result among multiple first results.

[0226] In one implementation, when the second vector is a second row vector, as represented in formula (17), according to the second vector and the conjugate transposed vector corresponding to the second vector, the first matrix is ​​determined as follows: the conjugate transposed vector corresponding to the second vector is multiplied by the second vector to obtain the first matrix, that is, R=y2 H *y2.

[0227] In another implementation, when the second vector is a second column vector, as shown in formula (18), according to the second vector and the conjugate transposed vector corresponding to the second vector, the first matrix is ​​determined as follows: the second vector is multiplied by the conjugate transposed vector corresponding to the second vector to obtain the first matrix, that is, R = y2*y2 H .

[0228] Among them, the first matrix obtained in the above two methods of determining the first matrix can be called the covariance matrix corresponding to the second vector (the second vector is the second row vector or the second column vector, so it can also be called a row matrix or a column matrix). H =R H R, so R is a normal matrix, which can be eigendecomposed into the form shown in formula (5).

[0229] It should be noted that the above method of determining the first matrix based on the second vector and the conjugate transposed vector corresponding to the second vector is only for illustrative purposes and is not intended to limit it. Other methods may also be used to determine the first matrix, which is not limited in this embodiment.

[0230] In this embodiment, since the multiple first results can characterize the multiple phases of the continuous wave signal during bidirectional transmission between the two devices, and these phases are related to the first time length to be determined, the first matrix constructed based on this contains the phase information of the multiple first continuous wave signals and the multiple second continuous wave signals, and the first matrix is ​​also related to the first time length to be determined. The first matrix that can be characteristically decomposed is determined in the above manner, which facilitates the subsequent determination of the spectral function.

[0231] In yet another implementation, taking the example that each first data set includes a first phase and a first amplitude determined according to at least one set of first data, and each second data set includes a second phase and a second amplitude determined according to at least one set of second data, the process of generating a first matrix according to multiple first data sets and multiple second data sets in S304 is described below:

[0232] Adding a plurality of first phases corresponding to a plurality of first data sets and a plurality of second phases corresponding to a plurality of second data sets to obtain a plurality of first results;

[0233] Multiplying a plurality of first amplitudes corresponding to a plurality of first data sets with a plurality of second amplitudes corresponding to a plurality of second data sets to obtain a plurality of second results, wherein the plurality of second results correspond one-to-one to the plurality of first results;

[0234] Expressing the plurality of first results and the plurality of second results in complex form to obtain a plurality of fourth complex numbers;

[0235] A first matrix is ​​determined according to a third vector formed by a plurality of fourth complex numbers and a conjugate transposed vector corresponding to the third vector.

[0236] Specifically, since multiple first data sets correspond one-to-one to multiple second data sets, and each first data set includes a first phase and a first amplitude, and each second data set includes a second phase and a second amplitude, the multiple first phases corresponding to the multiple first data sets correspond one-to-one to the multiple second phases corresponding to the multiple second data sets, the multiple first phases corresponding to the multiple first data sets are correspondingly added to the multiple second phases corresponding to the multiple second data sets to obtain multiple first results, the multiple first amplitudes corresponding to the multiple first data sets are correspondingly corresponding to the multiple second amplitudes corresponding to the multiple second data sets, the multiple first amplitudes corresponding to the multiple first data sets are correspondingly multiplied to obtain multiple second results, and the multiple second results correspond one-to-one to the multiple first results.

[0237] Assuming that M is 40, the frequencies of the multiple channels that transmit continuous wave signals to each other are numbered from frequency points 1 to 40, and the channels corresponding to the frequency points 1 to 40 are the first channel to the fortieth channel, then the number of the multiple first results, the multiple second results, and the multiple fourth complex numbers is 40, and the third vector can be expressed by the following formula (19) or (20):

[0238]

[0239]

[0240] Among them, y3 represents the third vector, A1 represents the first first result among multiple first results, and A2 represents the first second result among multiple second results. represents the first fourth plural number among multiple fourth plural numbers, A represents the second first result among multiple first results, A2 represents the second second result among multiple second results, represents the second fourth complex number among multiple fourth complex numbers, ..., Indicates the 40th first result among multiple first results, A 40 represents the 40th second result among multiple second results, Represents the 40th fourth plural number in a plurality of fourth plural numbers.

[0241] In one implementation, when the third vector is a third row vector, as represented in formula (19), the first matrix is ​​determined according to the third vector and the conjugate transposed vector corresponding to the third vector: the conjugate transposed vector corresponding to the third vector is multiplied by the third vector to obtain the first matrix, that is, R=y3 H*y3.

[0242] In another implementation, when the third vector is a third column vector, as represented in formula (20), the first matrix is ​​determined according to the third vector and the conjugate transposed vector corresponding to the third vector: the third vector is multiplied by the conjugate transposed vector corresponding to the third vector to obtain the first matrix, that is, R = y3*y3 H .

[0243] Among them, the first matrix obtained in the above two methods of determining the first matrix can be called the covariance matrix corresponding to the third vector (the third vector is the third row vector or the third column vector, so it can also be called a row matrix or a column matrix). H =R H R, so R is a normal matrix, which can be eigendecomposed into the form shown in formula (5).

[0244] It should be noted that the above method of determining the first matrix based on the third vector and the conjugate transposed vector corresponding to the third vector is only for illustrative purposes and is not intended to limit it. Other methods may also be used to determine the first matrix, which is not limited in this embodiment.

[0245] In this embodiment, since the multiple first results can characterize the multiple phases of the continuous wave signal during bidirectional transmission between the two devices, and these phases are related to the first time length to be determined, and the multiple second results can characterize the multiple amplitudes of the continuous wave signal during bidirectional transmission between the two devices, and these amplitudes are also related to the first time length to be determined, then the first matrix constructed based on this not only includes the phase information of the multiple first continuous wave signals and the multiple second continuous wave signals, but also includes the amplitude information of the multiple first continuous wave signals and the multiple second continuous wave signals. The first matrix is ​​also related to the first time length to be determined. The first matrix that can be characteristically decomposed is determined in the above manner, which facilitates the subsequent determination of the spectral function.

[0246] S305 , constructing a spectral function based on the frequencies corresponding to the multiple channels, the preset time interval, the first duration to be determined, and the target feature vector in the multiple feature vectors.

[0247] The specific implementation method of this step refers to the description in S103 above, and will not be repeated here to avoid repetition.

[0248] In some embodiments, in order to maintain data consistency, the construction of the spectral function is related to the way of generating the first matrix in S304, that is, it is related to whether the first vector, the second vector or the third vector is a row vector or a column vector. When the first vector, the second vector or the third vector is a column vector, the second matrix is ​​also a column vector (also called a column matrix). At this time, the spectral function is determined based on the following formula:

[0249]

[0250] Where P(τ) represents the spectral function, τ represents the first time length to be determined, a(τ) represents the second matrix, and a H (τ) represents the conjugate transposed matrix corresponding to the second matrix, U n represents the third matrix, U n H represents the conjugate transposed matrix corresponding to the third matrix, The second matrix is ​​a column matrix, f i It represents the frequency of the channel corresponding to the frequency point i, 1<i≤M, and i is an integer, and Δt represents the preset time interval.

[0251] Exemplarily, assuming that M is 40, the frequencies of the multiple channels that transmit continuous wave signals to each other are numbered as frequency points 1 to 40, and the channels corresponding to the frequency points 1 to 40 are the first channel to the fortieth channel, then the second matrix can be expressed by the following formula:

[0252]

[0253] Wherein, f1 represents the frequency of the first channel corresponding to frequency point 1, f2 represents the frequency of the second channel corresponding to frequency point 2, ..., f 40 Indicates the frequency of the 40th channel corresponding to frequency point 40.

[0254] In some embodiments, when the first vector, the second vector or the third vector is a row vector, the second matrix is ​​also a row vector (also called a row matrix). In this case, the spectral function is determined based on the following formula:

[0255]

[0256] in,

[0257] Exemplarily, assuming that M is 40, the frequencies of the multiple channels that transmit continuous wave signals to each other are numbered as frequency points 1 to 40, and the channels corresponding to the frequency points 1 to 40 are the first channel to the fortieth channel, then the second matrix can be expressed by the following formula:

[0258]

[0259] S306: Determine the value of the first time duration to be determined corresponding to the peak value of the spectrum function as the first time duration, and determine the distance between the first device and the second device according to the speed of light and the first time duration.

[0260] The specific implementation method of this step refers to the description in the above S104, and in order to avoid repetition, it will not be repeated here.

[0261] In this embodiment, multiple first data sets associated with multiple first continuous wave signals are obtained, and multiple second data sets associated with multiple second continuous wave signals are obtained, and each first data set includes multiple groups of first data obtained after sampling the first continuous wave signals of the same frequency, or includes a first phase determined based on at least one group of first data, or includes a first phase and a first amplitude determined based on at least one group of first data, and each group of first data includes a first in-phase data and a first orthogonal data. Since the first in-phase data and the first orthogonal data, the first phase, the first phase and the first amplitude are all related to the duration of the multiple first continuous wave signals being transmitted from the first device to the second device, the multiple first data sets are also related to the duration of the multiple first continuous wave signals being transmitted from the first device to the second device; each second data set includes the same A plurality of groups of second data are obtained after sampling the second continuous wave signal of a certain frequency, or, include a second phase determined according to at least one group of second data, or, include a second phase and a second amplitude determined according to at least one group of second data, each group of second data includes a second in-phase data and a second orthogonal data, since the second in-phase data and the second orthogonal data, the second phase, the second phase and the second amplitude are all related to the duration of the transmission of the plurality of second continuous wave signals from the second device to the first device, then the plurality of second data sets are also related to the duration of the transmission of the plurality of second continuous wave signals from the second device to the first device; then the first matrix generated based on the first data set and the second data set in the above three forms is not only related to the first duration to be determined, but also can characterize the distance and phase change information of the plurality of first continuous wave signals and the plurality of second continuous wave signals during the transmission process.

[0262] Since the first continuous wave signal is the result of the superposition of signals and noises from multiple signal transmission paths of the first device, and the second continuous wave signal is the result of the superposition of signals and noises from multiple signal transmission paths of the second device, the first matrix includes both the information corresponding to the signals of the multiple signal transmission paths and the information corresponding to the noises. However, since the energy of the noise in the first matrix is ​​much smaller than the energy of the signal, in order to solve the problem that the measured distance between devices is biased by the signal formed by the superposition of signals from multiple signal transmission paths, a eigenvector whose eigenvalue is less than or equal to a preset threshold among the multiple eigenvectors determined according to the first matrix is ​​used as the target eigenvector. Subsequently, based on the target eigenvector, the frequencies corresponding to the multiple channels, the preset time interval, and the to-be-determined The first time length, constructs a spectral function with the first time length to be determined as the independent variable. When constructing the spectral function, the information corresponding to the signals of the multiple signal transmission paths included in the first matrix is ​​excluded by selecting the target eigenvector, and only the information corresponding to the noise is retained. Therefore, the first time length corresponding to the peak value of the spectral function is infinitely close to the time length corresponding to the actual signal transmission path between the first device sending the first continuous wave signal to the second device and receiving the second continuous wave signal sent by the second device. Then, the distance between the first device and the second device determined based on the speed of light and the value of the first time length is infinitely close to the distance corresponding to the actual signal transmission path between the first device and the second device. Therefore, the above scheme can reduce the influence of multi-path transmission of signals on the accuracy of ranging between devices.

[0263] It should be understood that the above examples are intended to help those skilled in the art understand the embodiments of the present application, rather than to limit the embodiments of the present application to the specific numerical values ​​or specific scenarios illustrated. Those skilled in the art can obviously make various equivalent modifications or changes based on the above examples, and such modifications or changes also fall within the scope of the embodiments of the present application.

[0264] Combined with the above Figures 1 to 3 , the method for measuring the distance between devices provided in the embodiment of the present application is described, and the apparatus for executing the above method provided in the embodiment of the present application is described below. Figure 4 As shown, Figure 4 A schematic diagram of the structure of an apparatus for measuring distance between devices provided in an embodiment of the present application. The apparatus for measuring distance between devices may be an electronic device in an embodiment of the present application, or a chip or chip system in an electronic device.

[0265] like Figure 4 As shown, the apparatus 400 for measuring distance between devices includes a processing unit 401. The processing unit 401 is used to support the apparatus 400 for measuring distance between devices to perform the above processing steps.

[0266] Specifically, the processing unit 401 is used to implement the first device sending multiple first continuous wave signals of different frequencies to the second device on multiple channels at a preset time interval, and receiving multiple second continuous wave signals of different frequencies sent by the second device on multiple channels after receiving the first continuous wave signal, wherein the multiple first continuous wave signals and the multiple second continuous wave signals correspond to the multiple channels one by one, and the first continuous wave signal and the second continuous wave signal sent on the same channel have the same frequency; the processing unit 401 is used to generate a first matrix based on the multiple first continuous wave signals and the multiple second continuous wave signals, and determine the multiple eigenvalues ​​and corresponding to the first matrix Multiple eigenvectors corresponding to multiple eigenvalues; the processing unit 401 is used to construct a spectral function based on the frequencies corresponding to the multiple channels, the preset time intervals, the first time length to be determined, and the target eigenvector in the multiple eigenvectors, wherein the first time length is the time length from the first device sending a first continuous wave signal to the second device to the receipt of the second continuous wave signal sent by the second device, and the eigenvalue corresponding to the target eigenvector is less than or equal to a preset threshold; the processing unit 401 is used to determine the value of the first time length to be determined corresponding to the peak value of the spectral function as the first time length, and determine the distance between the first device and the second device based on the speed of light and the first time length.

[0267] In a possible implementation, the device 400 for measuring distance between devices further includes a storage unit 402. The storage unit 402 is connected to the processing unit 401 via a line. The storage unit 402 may include one or more memories, and the memory may be a device used to store programs or data in one or more devices or circuits. The storage unit 402 may exist independently and be connected to the processing unit 401 via a communication bus. The storage unit 402 may also be integrated with the processing unit 401.

[0268] The storage unit 402 may store computer-executable instructions of the method in the electronic device so that the processing unit 401 executes the method in the above embodiment. The storage unit 402 may be a register, a cache, or a random access memory (RAM), etc. The storage unit 402 may be integrated with the processing unit 401. The storage unit 402 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, and the storage unit 402 may be independent of the processing unit 401.

[0269] Figure 5 This is a schematic diagram of the structure of a chip provided in an embodiment of the present application. Figure 5 As shown, the chip 500 includes one or more (including two) processors 501 , a communication line 502 and a communication interface 503 . Optionally, the chip 500 also includes a memory 504 .

[0270] In some implementations, the memory 504 stores the following elements: executable modules or data structures, or a subset thereof, or an extended set thereof.

[0271] The method described in the above embodiment of the present application can be applied to the processor 501, or implemented by the processor 501. The processor 501 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware or software instructions in the processor 501. The above processor 501 can be a general-purpose processor (for example, a microprocessor or a conventional processor), a digital signal processor, an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates, transistor logic devices or discrete hardware components. The processor 501 can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.

[0272] The steps of the method disclosed in the embodiment of the present application can be directly embodied as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. Among them, the software module can be located in a mature storage medium in the field such as a random access memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable read only memory (EEPROM). The storage medium is located in the memory 504, and the processor 501 reads the information in the memory 504 and completes the steps of the above method in combination with its hardware.

[0273] The processor 501 , the memory 504 , and the communication interface 503 may communicate with each other via the communication line 502 .

[0274] In the above embodiments, the instructions stored in the memory for execution by the processor may be implemented in the form of a computer program product, wherein the computer program product may be pre-written in the memory, or may be downloaded and installed in the memory in the form of software.

[0275] An embodiment of the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of processing in the above-mentioned method for measuring distance between devices are executed.

[0276] The embodiment of the present application also provides a computer-readable storage medium, in which computer instructions are stored; when the computer-readable storage medium is run on a device for measuring the distance between devices, the device for measuring the distance between devices executes the method shown above. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more media integrated therein. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium, or a semiconductor medium (e.g., a solid state disk (SSD)), etc.

[0277] The embodiment of the present application further provides a computer program product including computer instructions, which, when executed on an apparatus for measuring distance between devices, enables the apparatus for measuring distance between devices to execute the technical solution shown above.

[0278] The electronic device, the device for measuring distance between devices, the computer-readable storage medium, and the computer program product provided in the above-mentioned embodiments of the present application are all used to execute the method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects corresponding to the method provided above, and will not be repeated here.

[0279] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0280] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and electronic devices can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0281] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0282] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0283] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0284] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0285] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0286] It should also be understood that the "multiple" mentioned in the specification and the appended claims of this application refers to two or more. In the description of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, which means any combination of one or more of the items listed in the association and all possible combinations, and includes these combinations, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.

[0287] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0288] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0289] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for measuring distance between devices, characterized in that: Applied to a first device, the method includes: The first device sends a plurality of first continuous wave signals of different frequencies to the second device on a plurality of channels at a preset time interval, and receives a plurality of second continuous wave signals of different frequencies sent by the second device on the plurality of channels after receiving the first continuous wave signal, wherein the plurality of first continuous wave signals and the plurality of second continuous wave signals correspond to the plurality of channels one by one, and the first continuous wave signal and the second continuous wave signal sent on the same channel have the same frequency; Based on the plurality of first continuous wave signals and the plurality of second continuous wave signals, generate a first matrix, and determine a plurality of eigenvalues ​​corresponding to the first matrix and a plurality of eigenvectors corresponding to the plurality of eigenvalues; Constructing a spectral function based on the frequencies corresponding to the multiple channels, the preset time intervals, the first duration to be determined, and the target feature vector among the multiple feature vectors, wherein the first duration is the duration from when the first device sends a first continuous wave signal to the second device to when the second continuous wave signal sent by the second device is received, and the eigenvalue corresponding to the target feature vector is less than or equal to a preset threshold; The value of the first time duration to be determined corresponding to the peak value of the spectrum function is determined as the first time duration, and the distance between the first device and the second device is determined according to the speed of light and the first time duration.

2. The method according to claim 1, characterized in that The step of generating a first matrix based on the plurality of first continuous wave signals and the plurality of second continuous wave signals comprises: Acquire a plurality of first data sets associated with the plurality of first continuous wave signals, wherein the plurality of first data sets correspond one-to-one to the plurality of first continuous wave signals, each first data set includes a plurality of groups of first data obtained after sampling the first continuous wave signals of the same frequency, or includes a first phase determined according to at least one group of first data, or includes a first phase and a first amplitude determined according to the at least one group of first data, the plurality of groups of first data correspond one-to-one to a plurality of sampling points, and each group of first data includes a first in-phase data and a first orthogonal data; Acquire a plurality of second data sets associated with the plurality of second continuous wave signals, wherein the plurality of second data sets correspond one-to-one to the plurality of second continuous wave signals, each second data set includes a plurality of groups of second data obtained by sampling the second continuous wave signals of the same frequency, or includes a second phase determined according to at least one group of second data, or includes a second phase and a second amplitude determined according to the at least one group of second data, the plurality of groups of second data correspond one-to-one to a plurality of sampling points, each group of second data includes a second in-phase data and a second orthogonal data, and the plurality of second data sets correspond one-to-one to the plurality of first data sets; A first matrix is ​​generated according to the plurality of first data sets and the plurality of second data sets.

3. The method according to claim 2, characterized in that In the case where each of the first data sets includes a plurality of groups of first data obtained by sampling a first continuous wave signal of the same frequency, the plurality of groups of first data correspond to a plurality of sampling points one-to-one, and each group of first data includes a first in-phase data and a first orthogonal data, and each of the second data sets includes a plurality of groups of second data obtained by sampling a second continuous wave signal of the same frequency, the plurality of groups of second data correspond to a plurality of sampling points one-to-one, and each group of second data includes a second in-phase data and a second orthogonal data, generating a first matrix according to the plurality of first data sets and the plurality of second data sets includes: For each first data set in the plurality of first data sets, based on first in-phase data and first orthogonal data included in at least one set of first data in each first data set, determine a first complex number corresponding to each first data set; For each second data set in the plurality of second data sets, based on second in-phase data and second orthogonal data included in at least one set of second data in each second data set, determine a second complex number corresponding to each second data set; A plurality of third complex numbers are determined based on a plurality of first complex numbers corresponding to the plurality of first data sets and a plurality of second complex numbers corresponding to the plurality of second data sets, and the first matrix is ​​determined based on a first vector formed by the plurality of third complex numbers and a conjugate transposed vector corresponding to the first vector.

4. The method according to claim 2, characterized in that: In a case where each of the first data sets includes a first phase determined according to at least one set of first data, and each of the second data sets includes a second phase determined according to at least one set of second data, generating a first matrix according to the plurality of first data sets and the plurality of second data sets includes: Adding a plurality of first phases corresponding to the plurality of first data sets and a plurality of second phases corresponding to the plurality of second data sets to obtain a plurality of first results; The first matrix is ​​determined according to a second vector and a conjugate transposed vector corresponding to the second vector, wherein the second vector is generated according to the plurality of first results represented in complex form.

5. The method according to claim 2, characterized in that: In a case where each of the first data sets includes a first phase and a first amplitude determined according to the at least one set of first data, and each of the second data sets includes a second phase and a second amplitude determined according to the at least one set of second data, generating a first matrix according to the plurality of first data sets and the plurality of second data sets includes: Adding a plurality of first phases corresponding to the plurality of first data sets and a plurality of second phases corresponding to the plurality of second data sets to obtain a plurality of first results; Multiplying a plurality of first amplitudes corresponding to the plurality of first data sets with a plurality of second amplitudes corresponding to the plurality of second data sets to obtain a plurality of second results, wherein the plurality of second results correspond one-to-one to the plurality of first results; Expressing the plurality of first results and the plurality of second results in complex form to obtain a plurality of fourth complex numbers; The first matrix is ​​determined according to a third vector formed by the plurality of fourth complex numbers and a conjugate transposed vector corresponding to the third vector.

6. The method according to any one of claims 1 to 5, characterized in that: The determining, according to the speed of light and the first duration, the distance between the first device and the second device includes: The speed of light and the first duration are multiplied, and half of a third result obtained after the multiplication is determined as the distance between the first device and the second device.

7. The method according to any one of claims 1 to 5, characterized in that: The constructing of a spectral function based on the frequencies corresponding to the multiple channels, the preset time interval, the first duration to be determined, and the target feature vector in the multiple feature vectors includes: A spectral function is constructed based on a second matrix, a conjugate transposed matrix corresponding to the second matrix, a third matrix, and a conjugate transposed matrix corresponding to the third matrix, wherein the elements in the second matrix are determined according to the frequencies corresponding to the multiple channels, the preset time intervals, and the first time length to be determined, and the third matrix is ​​determined according to the target eigenvector.

8. The method according to claim 7, characterized in that The spectral function is determined based on the following formula: Wherein, P(τ) represents the spectral function, τ represents the first duration to be determined, a(τ) represents the second matrix, and a H (τ) represents the conjugate transposed matrix corresponding to the second matrix, U n Denotes the third matrix, U n H represents the conjugate transposed matrix corresponding to the third matrix, f i represents the frequency of the channel corresponding to the frequency point i, and Δt represents the preset time interval.

9. The method according to any one of claims 1 to 5, characterized in that: The first device and the second device communicate with each other based on a Bluetooth connection.

10. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 9 when executing the computer program.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 9.

12. A computer program product, characterized in that The computer program product comprises: a computer program code, and when the computer program code is executed by an electronic device, the electronic device executes the method according to any one of claims 1 to 9.