Data processing method, distance measuring method, electronic equipment and storage medium
By calculating the phase data set between the computing device and the use of the reference phase to remove the noise signal, it solves the problem of reduction of the ranging accuracy caused by noise interference in the existing technology, and achieves higher range accuracy.
Patent Information
- Application Number
- CN202310932602.X
- 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
The existing ranging technology is susceptible to noise interference when receiving continuous wave signals, resulting in a decrease in ranging accuracy, and the existing filtering methods cannot effectively remove phase data corresponding to the noise signal.
By obtaining multiple sampling data sets, calculating the phase set, and using the reference phase to determine the phase collection of the ranging conditions, thereby removing the phase data corresponding to the noise signal and improved the range accuracy.
Effectively remove the phase data corresponding to the noise signal in the phase data, improve the range accuracy, and ensure the accurate calculation of the equipment spacing.
Smart Images

Figure CN119375868A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of distance measurement, and in particular to a data processing method, a distance measurement method, 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 commonly used method for measuring the distance between two devices (such as a first device and a second device) is as follows: the first device and the second device send continuous wave signals of different frequencies to each other on multiple adjacent channels, the first device and the second device each receive the continuous wave signal and sample to obtain in-phase data and quadrature data, and then calculate the phase data based on the in-phase data and the quadrature data. In this way, the distance between the first device and the second device can be calculated based on the phase data corresponding to the continuous wave signal sent by the first device and the phase data corresponding to the continuous wave signal sent by the second device.
[0004] However, when the first device or the second device receives the continuous wave signal and samples it, some channels are interfered by other signals, such as Wifi signals, microwave oven signals, etc., resulting in noise signals being mixed into the continuous wave signals received by these channels. As a result, the in-phase data and quadrature data obtained by sampling these continuous wave signals mixed with noise signals will include the in-phase data and quadrature data corresponding to the noise signals, and the phase data calculated based on the in-phase data and quadrature data will also include the phase data corresponding to the noise signal, which will ultimately cause the distance between devices determined based on the phase data to deviate from the actual distance between the devices.
[0005] At present, a filtering method can be used to remove part of the in-phase data and quadrature data corresponding to the noise signal that exceeds the filtering range in the in-phase data and quadrature data sampled by the device, so as to remove part of the phase data corresponding to the noise signal in the phase data. However, this method cannot accurately remove the in-phase data and quadrature data corresponding to the noise signal within the filtering range in the in-phase data and quadrature data, which will affect the subsequent ranging accuracy. Summary of the invention
[0006] The present application provides a data processing method, a distance measurement method, an electronic device and a storage medium, which can remove all phase data corresponding to noise signals in phase data, thereby improving the distance measurement accuracy.
[0007] In order to achieve the above objectives, this application adopts the following technical solutions:
[0008] In a first aspect, a data processing method is provided, which is applied to a first device. The data processing method is applied to a scenario where the first device and a second device measure distance. The method includes:
[0009] Acquire multiple sampling data sets, each of the sampling data sets includes multiple groups of data corresponding to multiple sampling points, each sampling point corresponds to a group of data, and each group of data includes an in-phase data and an orthogonal data;
[0010] The multiple sampling data sets are obtained by sampling multiple continuous wave signals of different frequencies from the second device, or the second device samples multiple continuous wave signals of different frequencies from the first device and sends them to the first device, and the continuous wave signals of the same frequency correspond to one sampling data set;
[0011] A plurality of phase sets are obtained by calculation according to the plurality of sampling data sets, wherein the plurality of phase sets correspond to the plurality of sampling data sets one by one, and a group of data in any of the sampling data sets corresponds to one phase;
[0012] Based on any one phase set in the multiple phase sets and a reference phase corresponding to the phase set, determine at least one phase set in the multiple phase sets that meets the condition for calculating the distance between the first device and the second device, wherein the reference phase is obtained after fitting multiple phases in the phase set.
[0013] Based on the above technical solution, in the embodiment of the present application, multiple sets of data (one set of data includes one in-phase data and one orthogonal data) obtained by sampling a continuous wave signal of the same frequency are calculated to obtain multiple phases, and the multiple phases corresponding to the continuous wave signal of the same frequency are taken as a phase set, and by setting a corresponding reference phase for each phase set, it is determined whether the phase data in the phase set includes the phase data corresponding to the noise signal. The reference phase is obtained after fitting multiple phases in the phase set. Since most of the phase data in the phase set are normal data and only a small part of the phase data corresponding to the noise signal is included, the points on the curve obtained after fitting multiple phases in the phase set are close to the real phase, and the reference phase is taken as the point on the fitting curve, so the reference phase is close to the real phase. In this case, the phase data corresponding to the noise signal in the phase set, that is, the phase that does not meet the condition for calculating the distance between devices, can be found out according to the reference phase. Compared with the filtering method (the filtering method can only filter out the phase data corresponding to the noise signal within the filtering range in the phase set, and cannot filter out the phase data corresponding to the noise signal outside the filtering range), the data processing method of the embodiment of the present application can remove all phase data corresponding to the noise signal in the phase data, so that the distance between devices can be determined subsequently only based on the phase that meets the condition for calculating the distance between devices, thereby improving the ranging accuracy.
[0014] In a possible implementation of the first aspect, the step of fitting multiple phases in the phase set includes: performing phase unwrapping processing on the multiple phases according to the sampling order of multiple sampling points corresponding to the multiple phases in the phase set; and performing linear fitting on the multiple phases after the phase unwrapping processing to obtain the reference phase.
[0015] Based on the above technical solution, in the embodiment of the present application, since the multiple phases after dewrapping processing in each phase set are monotonically increasing, the curve obtained after fitting the multiple phases after dewrapping processing is a straight line. In this way, the requirements for fitting accuracy are relatively low and the speed of data processing can be improved.
[0016] In a possible implementation manner of the first aspect, performing phase unwrapping processing on the multiple phases according to a sampling order of multiple sampling points corresponding to the multiple phases in the phase set includes: increasing or decreasing the multiple phases one by one by an integer multiple of 2π according to a sampling order of multiple sampling points corresponding to the multiple phases in the phase set, and an absolute value of a difference between phases after phase unwrapping processing corresponding to any two adjacent sampling points among the multiple sampling points is not greater than π.
[0017] In a possible implementation of the first aspect, determining at least one phase set in the multiple phase sets that satisfies the condition for calculating the distance between the first device and the second device based on any one phase set in the multiple phase sets and a reference phase corresponding to the phase set includes: calculating the root mean square error between multiple phases of any one phase set in the multiple phase sets and the reference phase that corresponds one-to-one to the multiple phases; and determining at least one phase set in the multiple phase sets that satisfies the condition for calculating the distance based on the root mean square error and a preset threshold.
[0018] Based on the above technical solution, the root mean square error of the corresponding phase set in the embodiment of the present application can indicate the degree of discreteness of the phase in the phase set relative to the reference phase. By comparing the root mean square error of the corresponding phase set with a preset threshold, it is possible to determine which phase sets include the phase data corresponding to the noise signal and which phase sets do not include the phase data corresponding to the noise signal.
[0019] In a possible implementation manner of the first aspect, the preset threshold is calculated based on multiple root mean square errors corresponding to the multiple phase sets, and one phase set corresponds to one root mean square error.
[0020] In a possible implementation of the first aspect, the preset threshold is calculated based on multiple root mean square errors corresponding to the multiple phase sets, including: determining the mean and standard deviation of the multiple root mean square errors corresponding to the multiple phase sets; and determining the preset threshold based on the mean and the standard deviation.
[0021] The method further comprises:
[0022] In a case where the multiple sampling data sets are obtained by sampling multiple continuous wave signals of different frequencies from the second device, determining a frequency offset corresponding to the continuous wave signal of any one frequency according to the baseband signal frequency of the first device and the signal frequency actually obtained by sampling the continuous wave signal of any one frequency among the multiple continuous wave signals of different frequencies;
[0023] According to the frequency offset corresponding to the continuous wave signal of the same frequency, adjusting the phase set among the multiple phase sets that meets the condition for calculating the distance and corresponds to the continuous wave signal of the same frequency;
[0024] or,
[0025] In a case where the plurality of sampling data sets are sent to the first device after the second device samples a plurality of continuous wave signals with different frequencies from the first device, determining a frequency offset corresponding to the continuous wave signal of any one frequency according to a baseband signal frequency of the second device and a signal frequency actually sampled from a continuous wave signal of any one frequency among the plurality of continuous wave signals with different frequencies;
[0026] According to the frequency offset corresponding to the continuous wave signal of the same frequency, the phase set among the multiple phase sets that meets the condition for calculating the distance and corresponds to the continuous wave signal of the same frequency is adjusted.
[0027] Based on the above technical solution, the embodiment of the present application first calculates the frequency offset corresponding to the continuous wave signal of the same frequency, and uses the frequency offset to adjust the phase in the phase set corresponding to the continuous wave signal, so that the phase in the phase set is closer to the real phase.
[0028] In a possible implementation of the first aspect, the signal frequency f obtained by actually sampling a continuous wave signal of any frequency among a plurality of continuous wave signals of different frequencies is real,i Calculated by the following formula:
[0029]
[0030] Among them, k i is the slope of the fitting line obtained by linear fitting after multiple phase unwrapping processing corresponding to the continuous wave signal of the i-th frequency, fs is the sampling frequency of the continuous wave signal.
[0031] In a possible implementation of the first aspect, the method further includes: determining at least one fitting result corresponding to the same horizontal coordinate point on the fitting straight line corresponding to at least one phase set among the multiple phase sets that satisfies the condition for calculating the distance as at least one final phase that satisfies the condition for calculating the distance.
[0032] Based on the above technical solution, in an embodiment of the present application, the final phase of the phase set is determined according to the fitting result on the fitting straight line corresponding to the phase set, and the distance between devices is calculated according to the final phase. Compared with the distance between devices calculated according to the phase in the phase set affected by the sampling error, the result is more accurate.
[0033] In a possible implementation of the first aspect, after determining at least one fitting result corresponding to the same horizontal coordinate point on the fitting straight line corresponding to at least one phase set among the multiple phase sets that meets the condition for calculating the distance as at least one final phase that meets the condition for calculating the distance, it also includes: determining the final phase corresponding to the phase set that does not meet the condition for calculating the distance based on at least one final phase that meets the condition for calculating the distance.
[0034] Based on the above technical solution, in an embodiment of the present application, the final phase corresponding to the phase set that does not meet the condition for calculating the distance is determined according to at least one final phase that meets the condition for calculating the distance, and the final phase of the phase set that does not meet the condition for calculating the distance is supplemented to avoid inaccurate calculation results due to too little data.
[0035] In a possible implementation of the first aspect, the frequency of the continuous wave signal corresponding to the phase set that does not satisfy the condition for calculating the distance is the i-th frequency, and the final phase corresponding to the continuous wave signal of the i-th frequency is Calculated by the following formula:
[0036]
[0037] in, is the final phase corresponding to the continuous wave signal of the i+nth frequency, is the final phase corresponding to the continuous wave signal of the imth frequency, f i is the reference frequency value of the continuous wave signal of the i-th frequency, f i+n is the reference frequency value of the continuous wave signal of the i+nth frequency, f i-m is the reference frequency value of the continuous wave signal of the imth frequency. The larger the i value, the higher the f iThe larger the value, the final phase corresponding to the continuous wave signal of the i+nth frequency and the final phase corresponding to the continuous wave signal of the imth frequency both meet the condition for calculating the distance.
[0038] In a possible implementation manner of the first aspect, the first device and the second device communicate with each other based on a Bluetooth connection.
[0039] In a second aspect, a ranging method is provided, which is applied to a first device and includes:
[0040] Sending a ranging request to the second device;
[0041] After receiving a response from the second device, sending a plurality of first continuous wave signals of different frequencies to the second device, and receiving a plurality of second continuous wave signals of different frequencies from the second device;
[0042] Sampling the plurality of continuous wave signals with different frequencies from the second device to obtain a plurality of second sampling data sets, wherein a continuous wave signal with the same frequency corresponds to one second sampling data set, each of the second sampling data sets includes a plurality of groups of data corresponding to a plurality of sampling points, each sampling point corresponds to a group of data, and each group of data includes one in-phase data and one orthogonal data;
[0043] Calculate a plurality of second phase sets according to the plurality of second sampling data sets, wherein the plurality of second phase sets correspond one-to-one to the plurality of second sampling data sets, and a group of data in any of the second sampling data sets corresponds to one first phase;
[0044] Determine, according to any one of the multiple second phase sets and a second reference phase corresponding to the second phase set, at least one second phase set in the multiple second phase sets that satisfies a condition for calculating the distance between the first device and the second device, wherein the reference phase is obtained after fitting multiple second phases in the second phase set;
[0045] sending at least one second phase set among the multiple phase sets that satisfies the condition for calculating the distance to the second device, and receiving at least one first phase set that satisfies the condition for calculating the distance from the second device;
[0046] A distance between the first device and the second device is calculated based on the at least one first phase set and the at least one second phase set.
[0047] In a third aspect, a ranging method is provided. The ranging method is applied to a first device and includes:
[0048] Sending a ranging request to the second device;
[0049] After receiving a response from the second device, sending a plurality of first continuous wave signals of different frequencies to the second device, and receiving a plurality of second continuous wave signals of different frequencies from the second device;
[0050] Sampling a plurality of second continuous wave signals of different frequencies from the second device to obtain a plurality of second sampling data sets, and receiving a plurality of first sampling data sets from the second device, wherein a plurality of first continuous wave signals of the same frequency correspond to a first sampling data set, a plurality of second continuous wave signals of the same frequency correspond to a second sampling data set, each of the first sampling data sets includes a plurality of groups of data corresponding to a plurality of sampling points, each of the second sampling data sets includes a plurality of groups of data corresponding to a plurality of sampling points, each sampling point corresponds to a group of data, and each group of data includes an in-phase data and an orthogonal data;
[0051] A plurality of first phase sets are calculated based on the plurality of first sampling data sets, and a plurality of second phase sets are calculated based on the plurality of second sampling data sets, wherein the plurality of first phase sets correspond to the plurality of first sampling data sets one-to-one, and a group of data in any of the first sampling data sets corresponds to one first phase; and the plurality of second phase sets correspond to the plurality of second sampling data sets one-to-one, and a group of data in any of the second sampling data sets corresponds to one first phase;
[0052] Determine at least one first phase set in the multiple first phase sets that satisfies a condition for calculating the distance between the first device and the second device based on a first reference phase corresponding to any one first phase set in the multiple first phase sets and the first phase set, and determine at least one second phase set in the multiple second phase sets that satisfies a condition for calculating the distance between the first device and the second device based on a second reference phase corresponding to any one second phase set in the multiple second phase sets and the second phase set,
[0053] The first reference phase is obtained by fitting multiple first phases in the first phase set; the second reference phase is obtained by fitting multiple second phases in the second phase set;
[0054] The distance between the first device and the second device is calculated according to at least one first phase set satisfying a condition for calculating the distance and at least one second phase set satisfying a condition for calculating the distance.
[0055] In a possible implementation manner of the second aspect or the third aspect, the first device and the second device communicate based on a Bluetooth connection.
[0056] In a fourth aspect, an electronic device is provided, comprising a memory and a processor, the memory being used to store instructions, and when the instructions are executed by the processor, the electronic device executes the data processing method in the first aspect or any possible implementation of the first aspect, or executes the ranging method in the second aspect, the third aspect, or a possible implementation of the second aspect or the third aspect.
[0057] In a fifth 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, the data processing method in the first aspect or any possible implementation of the first aspect is implemented, or the ranging method in the second aspect, the third aspect, or a possible implementation of the second aspect or the third aspect is implemented.
[0058] In a sixth aspect, a computer program product is provided, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the data processing method in the first aspect or any possible implementation of the first aspect, or to execute the ranging method in the second aspect, the third aspect, or a possible implementation of the second aspect or the third aspect.
[0059] Based on the implementations provided in the above aspects, this application can also be further combined to provide more implementations. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 It is a flowchart of the data processing method of the first aspect provided by an embodiment of the present application;
[0061] Figure 2 The embodiment of this application provides Figure 1 A specific exemplary flow chart of step 103;
[0062] Figure 3 It is another flowchart of the data processing method of the first aspect provided by an embodiment of the present application;
[0063] Figure 4 It is another flowchart of the data processing method of the first aspect provided by an embodiment of the present application;
[0064] Figure 5 It is another flowchart of the data processing method of the first aspect provided by the embodiment of the present application;
[0065] Figure 6 is a flow chart of a second aspect of a ranging method provided by an embodiment of the present application;
[0066] Figure 7 is a flowchart of a third aspect of a ranging method provided by an embodiment of the present application;
[0067] Figure 8 It is a structural diagram of the fourth aspect of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0068] The technical solution in this application will be described below in conjunction with the accompanying drawings.
[0069] In the description of the embodiments of the present application, unless otherwise specified, “ / ” means or. For example, A / B can mean A or B. The “and / or” in this article is merely a way to describe the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0070] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.
[0071] First, the nouns involved in this application are explained:
[0072] (1) Frequency
[0073] The low-power Bluetooth band operates in the 2.4GHz industrial scientific medical (ISM) band, and its available frequency range is 2400MHz to 2483.5MHz. The band is divided into 40 radio frequency channels, starting from 2402MHz, with a channel every 2MHz, numbered from 0 to 39, and each channel corresponds to a different frequency, that is, the frequency of sending and receiving signals on each channel is different, and the frequency corresponding to the channel with the largest number is 2480MHz. The number of the frequency corresponding to the channel is the frequency point. Therefore, low-power Bluetooth includes 40 frequency points, for example, the frequency f0 of the first frequency point is 2402MHz, the frequency f1 of the second frequency point is 2404MHz, and the frequency f2 of the third frequency point is 2406MHz, and so on. The frequency f39 of the 40th frequency point is 2480MHz. In the embodiment of the present application, for the convenience of expressing the calculation formula, the numbering of the frequency corresponding to the channel starts from 1, and the frequency value of the i-th frequency point is fi, that is, the frequency value of the continuous wave signal of the i-th frequency is fi.
[0074] Classic Bluetooth also operates in the 2.4GHz ISM band, which is divided into 79 RF channels, starting from 2402MHz with one channel at an interval of 1MHz. The frequency corresponding to the highest numbered channel is 2480MHz, numbered from 0 to 78. The numbers of these frequencies corresponding to the channels are the frequency points. Therefore, classic Bluetooth includes 79 frequency points, from 0 to 78.
[0075] The 2.4 GHz wireless fidelity (Wi-Fi) frequency band is divided into 14 radio frequency channels, numbered from 1 to 14. The numbers of the frequencies corresponding to the channels are the frequency points. Therefore, Wi-Fi includes 14 frequency points, from 1 to 14.
[0076] ZigBee also works 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. The numbers of the frequencies corresponding to the channels are called frequency points. Therefore, ZigBee includes 16 frequency points, from 11 to 26.
[0077] (2) In-phase data and quadrature data
[0078] 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°. Usually, a sine signal (Asinwt) and a cosine signal (Acoswt) are used to describe these two components, where the cosine component is called the in-phase component, i.e., I-channel data; the sine component is called the orthogonal component, i.e., Q-channel data. Therefore, in-phase data and orthogonal data are also called I / Q data.
[0079] (3) Untangling
[0080] Use vectors to represent signals, and consider vectors as rotating arrows 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 semi-axis of the horizontal axis is the phase, the projection length of the signal vector on the vertical axis is the Q-channel data, and the projection length of the signal vector on the horizontal axis is the I-channel data.
[0081] Since the angle between the signal vector and the positive half axis of the horizontal axis is the phase, the phase calculated based on the I / Q data is the phase within a cycle, rather than the real phase that can indicate its cycle. Therefore, the real phase can be obtained by calculating how many 2π (i.e., cycles) the phase differs by through unwrapping processing. The phase calculated for the I / Q data can be increased or decreased by an integer multiple of 2π one by one according to the sampling order of the sampling points corresponding to the I / Q data, so that the absolute value of the difference in the phase after unwrapping processing corresponding to any adjacent sampling points is not greater than π.
[0082] The following first briefly introduces the ranging process between two devices.
[0083] 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 Bluetooth key and the vehicle. When the distance between the Bluetooth key and the vehicle is within the preset distance range, the vehicle can be unlocked without a password.
[0084] Taking the two devices (the first device and the second device) as an example, both are Bluetooth devices, the distance measurement principle between the first device and the second device is explained.
[0085] like Figure 1 As shown, after the first device and the second device are connected by Bluetooth, the first device and the second device send continuous wave signals of different frequencies to each other on multiple adjacent channels, and the frequencies of the continuous wave signals sent and received by different channels are different. For example, the frequencies of the continuous wave signals sent to each other on 1 to 10 adjacent channels are f1, f2, f3, ..., f10, respectively. The process of sending continuous wave signals to each other on one channel is as follows: the first device sends a continuous wave signal of the same frequency to the second device at time t1, the second device receives the continuous wave signal sent by the first device at time t2, the second device processes the received continuous wave signal, and the processing time is td. After the processing, the second device sends a continuous wave signal to the first device at the same frequency at time t3, and the first device receives the continuous wave signal sent by the second device at time t4.
[0086] 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 the first device and the second device can be expressed by the following formula (1):
[0087]
[0088] Taking the signal wave as a sine wave as an example, assuming that the second device moves the frequency of the baseband signal to be sent to the frequency corresponding to a channel in the Bluetooth frequency band and needs to perform frequency conversion. When the frequency conversion is performed, a phase-locked loop is introduced, so that the continuous wave signal sent is phase-shifted relative to the baseband signal. The phase offset is Assume that the time delay of the first device receiving the continuous wave signal from the second device is τ, then the phase of the continuous wave signal received by the first device is The first device down-converts the received continuous wave signal, and the phase offset introduced is Then the final phase of the first device signal received by the first device is
[0089] Accordingly, the first device moves the frequency of the baseband signal to be sent to the frequency corresponding to a channel in the Bluetooth frequency band and needs to perform frequency conversion. A phase-locked loop is introduced during frequency conversion, so that the transmitted continuous wave signal has a phase shift relative to the baseband signal. The phase shift is The time delay of the second device receiving the continuous wave signal from the first device is the same as the time delay of the first device receiving the continuous wave signal from the second device. Then the phase of the continuous wave signal received by the second device is The second device down-converts the received continuous wave signal, and the phase offset introduced is Then the final phase of the continuous wave signal received by the second device from the first device is
[0090] The first device and the second device exchange the phases of the continuous wave signals they receive, and then the phase offset caused by the phase-locked loop can be offset after the two are added together, thereby obtaining 4πfτ.
[0091] Since the first device and the second device send continuous wave signals to each other on multiple channels, assuming that continuous wave signals are sent to each other on the first channel, the phases corresponding to the continuous wave signals received by the first device and the second device are added together to obtain 4πf1τ1, where f1 is the frequency corresponding to the first channel, and τ is the delay of the continuous wave signal sent between the first device and the second device. Assuming that continuous wave signals are sent to each other on the second channel, the phases corresponding to the continuous wave signals received by the first device and the second device are added together to obtain 4πf2τ2, where f2 is the frequency corresponding to the second channel, and τ2 is the delay of the continuous wave signal sent between the first device and the second device. Since the distance between the first device and the second device is fixed, the delay of the continuous wave signal sent between the first device and the second device is the same, that is, τ1=τ2=τ.
[0092] Assume that the difference between the first addition result (i.e., the result of adding the phases corresponding to the continuous wave signals received by the first device and the second device) and the second addition result (i.e., the result of adding the phases corresponding to the continuous wave signals received by the first device and the second device) is but It can be expressed by the following formula (2):
[0093]
[0094] Since the time delay τ = d / c, where d is the distance between the first device and the second device, and c is the speed of light, the formula for the time delay is substituted into the above formula (2) to obtain the following formula (3):
[0095]
[0096] In this way, the distance d between the first device and the second device can be calculated by the following formula (4):
[0097]
[0098] Where c is the speed of light and 4π is a constant. Therefore, to obtain the distance d between the first device and the second device, it is necessary to calculate The ratio of the frequency difference Δf of different channels.
[0099] That is to say, in a coordinate system with the frequency corresponding to different channels as the horizontal coordinate and the phase sum of the continuous wave signals received by the first device and the second device under different channels as the vertical coordinate, the slope of the curve (the curve is a straight line) of the phase sum with the frequency is Since the frequencies corresponding to the channels are known, the distance between the first device and the second device can be determined by calculating the phases corresponding to the continuous wave signals respectively received by the first device and the second device in different channels.
[0100] Since the first device and the second device send multiple continuous wave signals of different frequencies to each other on multiple adjacent channels, the frequencies of the continuous wave signals sent and received by different channels are different. Therefore, when the channel is interfered by environmental noise, the continuous wave signal received on the channel will be mixed with the noise signal, and the I / Q data obtained by sampling the continuous wave signal received on the channel will also include I / Q data corresponding to the noise signal, resulting in the phase data calculated based on the I / Q data including the phase data corresponding to the noise signal, which ultimately results in the distance between the devices calculated based on the phase data deviating from the actual distance between the devices.
[0101] Currently, a filtering method can be used to remove the in-phase data and quadrature data corresponding to the noise signals that exceed the filtering range in the in-phase data and quadrature data sampled by the device, so as to remove the phase data corresponding to the noise signals in the phase data. However, this method cannot accurately remove the in-phase data and quadrature data corresponding to the noise signals within the filtering range in the in-phase data and quadrature data, which will affect the subsequent ranging accuracy.
[0102] To address this, an embodiment of the present application provides a data processing method that can remove all phase data corresponding to noise signals in phase data, thereby improving ranging accuracy. The data processing method is applied to a scenario of ranging between a first device and a second device.
[0103] The data processing method is applied to a first device, and the data processing method includes: acquiring multiple sampling data sets, each of the sampling data sets includes multiple groups of data corresponding to multiple sampling points, each sampling point corresponds to a group of data, and each group of data includes an in-phase data and an orthogonal data; wherein the multiple sampling data sets are obtained by sampling multiple continuous wave signals of different frequencies from a second device, or the second device samples multiple continuous wave signals of different frequencies from a first device and sends them to the first device, and a continuous wave signal of the same frequency corresponds to a sampling data set; multiple phase sets are calculated based on the multiple sampling data sets, wherein the multiple phase sets correspond to the multiple sampling data sets one by one, and a group of data in any of the sampling data sets corresponds to a phase; according to any one of the multiple phase sets and a reference phase corresponding to the phase set, determining at least one phase set in the multiple phase sets that meets the condition for calculating the distance between the first device and the second device, wherein the reference phase is obtained after fitting multiple phases in the phase set.
[0104] In the embodiment of the present application, multiple sets of data (one set of data includes one in-phase data and one orthogonal data) obtained by sampling a continuous wave signal of the same frequency are calculated to obtain multiple phases, and the multiple phases corresponding to the continuous wave signal of the same frequency are taken as a phase set. By setting a corresponding reference phase for each phase set, it is determined whether the phase data in the phase set includes the phase data corresponding to the noise signal. The reference phase is obtained after fitting multiple phases in the phase set. Since most of the phase data in the phase set are normal data and only a small part of the phase data corresponding to the noise signal is included, the points on the curve obtained after fitting multiple phases in the phase set are close to the real phase, and the reference phase is taken as the point on the fitting curve. Therefore, the reference phase is close to the real phase. In this case, the phase data corresponding to the noise signal in the phase set, that is, the phase that does not meet the condition for calculating the distance between devices, can be found out according to the reference phase. Compared with the filtering method (the filtering method can only filter out the phase data corresponding to the noise signal within the filtering range in the phase set, and cannot filter out the phase data corresponding to the noise signal outside the filtering range), the data processing method of the embodiment of the present application can remove all phase data corresponding to the noise signal in the phase data, so that the distance between devices can be determined subsequently only based on the phase that meets the condition for calculating the distance between devices, thereby improving the ranging accuracy.
[0105] The data processing method in the embodiment of the present application is described in detail below with reference to the accompanying drawings. Figure 1 As shown, including:
[0106] Step S101: Acquire multiple sampling data sets, each sampling data set includes multiple groups of data corresponding to multiple sampling points, each sampling point corresponds to a group of data, and each group of data includes an in-phase data and an orthogonal data.
[0107] Among them, multiple sampling data sets are obtained by sampling multiple continuous wave signals of different frequencies from the second device, or the second device samples multiple continuous wave signals of different frequencies from the first device and sends them to the first device. A continuous wave signal of the same frequency corresponds to one sampling data set.
[0108] Specifically, multiple continuous wave signals of different frequencies correspond to multiple channels one by one, and the frequencies of continuous wave signals sent on the same channel are the same. The multiple channels corresponding to the multiple continuous wave signals can be determined from the 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, and the time interval for sending continuous wave signals. Since the frequency point is the number of the frequency of the channel receiving signal, the frequency point can be used to determine which channels send continuous wave signals to each other. For example, the two devices negotiate to send continuous wave signals to each other on the first frequency point (ie, frequency point 1) to the tenth frequency point (ie, frequency point 10), that is, the two devices send continuous wave signals to each other on the first channel to the tenth channel. The preset time interval can be greater than or equal to 10μs (microseconds), less than or equal to 30μs, such as 16μs, or other values, which are not limited here.
[0109] The wireless communication protocol may be a low-power Bluetooth, Wi-Fi, ZigBee or other communication protocol, which is 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.
[0110] The first device and the second device may be devices supporting wireless communication protocols, such as both devices supporting Bluetooth communication protocols, or both devices supporting Wi-Fi communication protocols, which are not limited here. Devices supporting wireless communication protocols may include: Bluetooth headsets, wireless speakers, wireless bracelets, wireless car-mounted devices, 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, etc., which are not specifically limited here.
[0111] In this embodiment, the data processing method is described in detail by taking the communication between the first device and the second device based on the Bluetooth connection as an example.
[0112] In the embodiment of the present application, during the ranging process between the first device and the second device, the first device and the second device send multiple continuous wave signals of different frequencies to each other, the first device receives multiple continuous wave signals of different frequencies from the second device and samples I / Q data, and the second device receives multiple continuous wave signals of different frequencies from the first device and samples I / Q data.
[0113] In the data processing method of the embodiment of the present application, the I / Q data processed by the first device can be obtained by sampling multiple continuous wave signals of different frequencies from the second device, or the second device can sample the I / Q data of multiple continuous wave signals of different frequencies from the first device and send them to the first device.
[0114] The sampling process is described by taking the first device sampling multiple continuous wave signals of different frequencies from the second device as an example. For each frequency of the continuous wave signal, the sampling frequency is f s , the sampling time is T s , then the number of samples of the continuous wave signal of each frequency is N = f s ·T s After sampling each sampling point, a set of data is obtained, which includes an in-phase data (i.e., I data) and an orthogonal data (i.e., Q data). For example, the data corresponding to the j-th sampling point in the continuous wave signal of the i-th frequency includes the in-phase data I i, and orthogonal data Q i, After sampling a continuous wave signal of any frequency, multiple sets of data are obtained. The multiple sets of data corresponding to the continuous wave signal of any frequency are a sampling data set. Multiple continuous wave signals correspond to multiple sampling data sets one by one.
[0115] Step S102: Calculate multiple phase sets according to multiple sampling data sets, wherein the multiple phase sets correspond to the multiple sampling data sets one by one, and a group of data in any sampling data set corresponds to one phase.
[0116] Specifically, a set of data (i.e., a set of I / Q data) can be calculated to obtain a phase. Assuming that the phase corresponding to the jth sampling point of the continuous wave signal of the i-th frequency is Phase It can be calculated by the following formula (5):
[0117]
[0118] The sampling data set including multiple groups of data can be calculated according to the above formula (5) to obtain a phase set including multiple phases, and the multiple groups of data correspond to the multiple phases one by one. After sampling multiple continuous wave signals, multiple sampling data sets are obtained. After phase calculation of the multiple sampling data sets, multiple phase sets can be obtained. A continuous wave signal of one frequency corresponds to one phase set.
[0119] Step S103: Determine at least one phase set in the multiple phase sets that meets the condition for calculating the distance between the first device and the second device based on any one phase set in the multiple phase sets and the reference phase corresponding to the phase set, wherein the reference phase is obtained after fitting multiple phases in the phase set.
[0120] Specifically, multiple sets of data (one set of data includes one in-phase data and one orthogonal data) obtained by sampling a continuous wave signal of the same frequency are calculated to obtain multiple phases, and the multiple phases corresponding to the continuous wave signal of the same frequency are taken as a phase set. By setting a corresponding reference phase for each phase set, it is determined whether the phase data in the phase set includes the phase data corresponding to the noise signal. The reference phase is obtained after fitting multiple phases in the phase set. Since most of the phase data in the phase set are normal data and only a small part of the phase data corresponding to the noise signal is included, the points on the curve obtained after fitting multiple phases in the phase set are close to the real phase, and the reference phase is taken as the point on the fitting curve. Therefore, the reference phase is close to the real phase. In this case, the phase data corresponding to the noise signal in the phase set, that is, the phase that does not meet the condition for calculating the distance between devices, can be found out according to the reference phase. Compared with the filtering method (the filtering method can only filter out the phase data corresponding to the noise signal within the filtering range in the phase set, and cannot filter out the phase data corresponding to the noise signal outside the filtering range), the data processing method of the embodiment of the present application can remove all phase data corresponding to the noise signal in the phase data, so that the distance between devices can be determined subsequently only based on the phase that meets the condition for calculating the distance between devices, thereby improving the ranging accuracy.
[0121] Realistically, the fitting method includes, but is not limited to: least squares fitting, polynomial fitting, linear regression fitting, exponential fitting.
[0122] According to the above formula (5), it can be concluded that all phases in a phase set are data within one cycle. The curve obtained by directly fitting all phases in a phase set in a coordinate system with the horizontal axis as the sampling point and the vertical axis as the phase is a sawtooth. The phases within one cycle correspond to a sawtooth in the curve. After fitting multiple phases in each phase set, a sawtooth curve corresponding to the phase set can be obtained. The points on the curve are the reference phases corresponding to the phase set.
[0123] Realistically, the step of fitting multiple phases in a phase set includes: performing phase unwrapping processing on the multiple phases according to the sampling order of multiple sampling points corresponding to the multiple phases in the phase set; and performing linear fitting on the multiple phases after the phase unwrapping processing to obtain a reference phase.
[0124] Since fitting a sawtooth curve requires high fitting accuracy, while fitting a straight line requires low fitting accuracy and high fitting speed, in this embodiment, phase unwrapping is first performed on multiple phases according to the sampling order of multiple sampling points corresponding to multiple phases in a phase set, and then a reference phase is obtained by linear fitting the multiple phases after the phase unwrapping. Since the multiple phases after the unwrapping in each phase set are monotonically increasing, the curve obtained by fitting the multiple phases after the unwrapping is a straight line. In this way, the fitting accuracy requirement is low and the data processing speed can be improved.
[0125] Assume that the phase of the jth sampling point in the phase set corresponding to the continuous wave signal of the i-th frequency is expressed as After phase unwrapping, it is expressed as The corresponding reference phase is expressed as The functional relationship of the fitting straight line obtained by linear fitting after multiple phase unwrapping processing in the phase set corresponding to the continuous wave signal of the i-th frequency can be expressed as Among them, b i represents the constant term of the fitting straight line corresponding to the continuous wave signal of the i-th frequency, k i represents the slope of the fitted straight line corresponding to the continuous wave signal of the i-th frequency, x j Indicates the index value of the j-th sampling point.
[0126] Among them, the parameter k i It can be calculated by the following formula (6):
[0127]
[0128] Parameter b i It can be calculated by the following formula (7):
[0129]
[0130] Where N is the number of samples of the continuous wave signal at each frequency.
[0131] Using the above linear function relationship The corresponding reference phase can be calculated according to the multiple phases of each phase set.
[0132] Realistically, phase unwrapping processing is performed on the multiple phases according to the sampling order of the multiple sampling points corresponding to the multiple phases in the phase set, including: according to the sampling order of the multiple sampling points corresponding to the multiple phases in the phase set, the multiple phases are increased or decreased one by one by an integer multiple of 2π, and the absolute value of the difference between the phases corresponding to any two adjacent sampling points among the multiple sampling points after the phase unwrapping processing is not greater than π.
[0133] Specifically, each phase in the phase set corresponds to a sampling point. According to the sampling order of the multiple sampling points corresponding to the multiple phases in the phase set, the multiple phases are increased or decreased by integer multiples of 2π one by one until the absolute value of the difference between the phases after phase unwrapping processing corresponding to any two adjacent sampling points in the multiple sampling points is not greater than π. At this time, the unwrapping is completed.
[0134] In the process of increasing or decreasing each phase in the phase set by an integer multiple of 2π, each phase is increased or decreased by an integer multiple of 2π, so that the absolute value of the difference between the phase after each phase is increased or decreased by an integer multiple of 2π and the phase corresponding to the adjacent sampling point is not greater than π. When increasing or decreasing each phase by an integer multiple of 2π, it can be tried in order from small to large, for example: 0, 2π, 4π, 6π, etc., or, for example: 0, -2π, -4π, -6π, etc.
[0135] The specific process of the above step S103 in the embodiment of the present application is as follows Figure 2 As shown, the specific steps include:
[0136] Step 1031: Calculate the root mean square error between the multiple phases of any one phase set in the multiple phase sets and the reference phases that correspond one to one with the multiple phases.
[0137] Specifically, there are multiple reference phases corresponding to the phase set, and the multiple reference phases correspond one-to-one to the multiple phases of the phase set. The root mean square error between the multiple phases of the phase set and the multiple reference phases is calculated. The root mean square error can indicate the degree of discreteness of the multiple phases in the phase set relative to the reference phase.
[0138] The root mean square error RMSE calculated from the phase set corresponding to the continuous wave signal of the i-th frequency i It can be calculated by the following formula (8):
[0139]
[0140] in, is the phase of the jth sampling point in the phase set corresponding to the continuous wave signal of the i-th frequency, For After phase unwrapping, The corresponding reference phase is N is the number of samples of the continuous wave signal at each frequency.
[0141] In an example, multiple phase sets can be directly sorted from small to large according to the sizes of multiple root mean square errors corresponding to the multiple phase sets, and it can be directly determined according to the order of arrangement that the phase data of the first M phase sets do not include the phase data corresponding to the noise signal, and the first M phase sets meet the conditions for calculating the distance.
[0142] In another example, a preset threshold may be set, and whether the phase data of the phase set meets the condition for calculating the distance may be determined according to the root mean square error between the preset threshold and the phase set, as shown in step 1032 below:
[0143] Step 1032: Determine at least one phase set that meets the condition for calculating the distance among the multiple phase sets according to the root mean square error and a preset threshold.
[0144] Specifically, in this embodiment, whether the phase set includes the phase data corresponding to the noise signal can be determined based on the degree of discreteness of the phase in the phase set corresponding to the continuous wave signal relative to the reference phase. A phase set with an excessively large degree of discreteness includes the phase data corresponding to the noise signal, and the phase set with an excessively large degree of discreteness does not meet the conditions for calculating the distance; a phase set with a small degree of discreteness does not include the phase data corresponding to the noise signal, and the phase set with a small degree of discreteness meets the conditions for calculating the distance.
[0145] The root mean square error of the corresponding phase set can indicate the degree of discreteness of the phase in the phase set relative to the reference phase. By comparing the root mean square error of the corresponding phase set with a preset threshold, it is possible to determine which phase sets include the phase data corresponding to the noise signal and which phase sets do not include the phase data corresponding to the noise signal.
[0146] In one example, the preset threshold value may be preset. If the root mean square error corresponding to the phase set is greater than or equal to the preset threshold value, it can be determined that the phase dispersion degree in the phase set is too large, and it is determined that the phase set includes phase data corresponding to the noise signal, and the phase set does not meet the condition for calculating the distance; if the root mean square error corresponding to the phase set is less than the preset threshold value, it can be determined that the phase dispersion degree in the phase set is small, and it is determined that the phase set does not include phase data corresponding to the noise signal, and the phase set meets the condition for calculating the distance.
[0147] In another example, the preset threshold may be calculated based on multiple root mean square errors corresponding to multiple phase sets, where one phase set corresponds to one root mean square error.
[0148] Realistically, calculating the preset threshold based on multiple root mean square errors corresponding to multiple phase sets includes: determining the mean and standard deviation of the multiple root mean square errors corresponding to the multiple phase sets; and determining the preset threshold based on the mean and standard deviation.
[0149] Specifically, if the difference between the root mean square error and the mean corresponding to the phase set is outside the range of a preset multiple of the standard deviation, it is determined that the phase set includes the phase data corresponding to the noise signal, and the phase set does not meet the condition for calculating the distance, that is, the continuous wave signal corresponding to the phase set is doped with the noise signal; if the difference between the root mean square error and the mean corresponding to the phase set is within the range of a preset multiple of the standard deviation, it is determined that the phase set does not include the phase data corresponding to the noise signal, and the phase set meets the condition for calculating the distance, that is, the continuous wave signal corresponding to the phase set is not doped with the noise signal.
[0150] For example, you can choose 3 times the standard or 2 times the standard deviation. The multiple of the standard deviation can be determined according to the accuracy requirements. For example, if the data accuracy requirements are average, you can choose 3 times the standard deviation; if the data accuracy requirements are high, you can choose 2 times or 2.5 times the standard deviation.
[0151] It should be noted that, in one implementation, after obtaining at least one phase set that satisfies the condition for calculating the distance, the distance between the first device and the second device may be directly calculated based on the at least one phase set that satisfies the condition for calculating the distance. In another implementation, at least one phase set that satisfies the condition for calculating the distance may be processed to obtain at least one final phase, and then the distance may be calculated based on the at least one final phase that satisfies the condition for calculating the distance.
[0152] The following is a detailed description of the latter implementation method. Figure 3 As shown, Figure 3 Step S10301 shown in FIG. Figure 1 The step S103 shown in is substantially the same as that in FIG. Figure 1 The reference phase in step S103 shown in FIG. 1 is obtained after fitting multiple phases in the phase set; and Figure 3 The reference phase in step S10301 is obtained by performing linear fitting on multiple phases in the phase set.
[0153] Figure 3 The data processing method shown may further include the following steps.
[0154] Step S104: determining at least one fitting result corresponding to the same horizontal coordinate point on the fitting straight line corresponding to at least one phase set that meets the condition for calculating the distance among the multiple phase sets as at least one final phase that meets the condition for calculating the distance.
[0155] Specifically, in a coordinate system with the frequency corresponding to different channels as the horizontal coordinate and the phase sum of the continuous wave signals received by the first device and the second device under different channels as the vertical coordinate, the slope of the curve (the curve is a straight line) of the phase sum with the frequency is Therefore, to calculate the slope It is necessary to first calculate the final phase of the continuous wave signal received by the first device and the final phase of the continuous wave signal received by the second device, and then calculate the slope based on the result of adding the above two final phases.
[0156] It can be seen that the phase corresponding to the continuous wave signal mentioned here is a single phase, while in the embodiment of the present application, the continuous wave signal of each frequency corresponds to multiple phases, and the multiple phases in the phase set correspond to the I / Q data obtained by sampling. Therefore, the multiple phases in the phase set are greatly affected by the sampling error. In order to eliminate the influence of the sampling error, in this embodiment, the final phase of the phase set is determined based on the fitting result on the fitting straight line corresponding to the phase set.
[0157] Since there are multiple fitting results on the fitting line corresponding to a phase set, one fitting result needs to be selected as the final phase of the phase set. In this embodiment, multiple phase sets correspond to multiple fitting lines one by one, and multiple fitting results corresponding to the same horizontal coordinate point on the multiple fitting lines can be selected as multiple final phases of the multiple phase sets. One phase set corresponds to one fitting result, that is, one final phase.
[0158] For example, the fitting result when the horizontal axis is 0 can be selected, that is, the constant b of the fitting line can be selected. i As the final phase. The final phase can be directly obtained according to the constant of the fitting line, and there is no need to recalculate the final phase after determining the fitting line.
[0159] It should be noted that, in one implementation, the distance is calculated directly according to at least one final phase that satisfies the conditions for calculating the distance in an embodiment of the present application. In another implementation, it is also necessary to complete the final phase of the phase set that does not meet the conditions for calculating the distance to avoid inaccurate calculation results due to too little data. Since the phase data in the phase set that does not meet the conditions for calculating the distance is directly discarded in the embodiment of the present application, the final phase corresponding to the phase set that does not meet the conditions for calculating the distance can be determined based on at least one final phase that meets the conditions for calculating the distance. Afterwards, the distance is calculated based on all the final phases.
[0160] The following is a detailed description of the latter implementation method. Figure 3As shown, the data processing method may further include the following steps.
[0161] Step S105: According to at least one final phase that satisfies the condition for calculating the distance, determine a final phase corresponding to a set of phases that do not satisfy the condition for calculating the distance.
[0162] Specifically, since the frequencies of the continuous wave signals are different, that is, the frequencies of the continuous wave signal transmission are different, and the frequency of the signal transmission is related to the phase, the larger the frequency of the continuous wave signal, the larger the final phase of the phase set corresponding to the continuous wave signal, that is, the final phase of the phase set increases with the increase of the frequency of the continuous wave signal corresponding to the phase set. Based on this principle, the final phases of other phase sets that do not meet the conditions for calculating the distance can be supplemented by a linear interpolation algorithm based on at least one final phase that meets the conditions for calculating the distance, so that each phase set can determine a final phase to avoid inaccurate calculation results due to too little data.
[0163] Realistically, the frequency of the continuous wave signal corresponding to the phase set that does not meet the condition for calculating the distance is the i-th frequency, and the final phase corresponding to the continuous wave signal of the i-th frequency is It is calculated by the following formula (9):
[0164]
[0165] in, is the final phase corresponding to the continuous wave signal of the i+nth frequency, is the final phase corresponding to the continuous wave signal of the imth frequency, f i is the reference frequency value of the continuous wave signal of the i-th frequency, f i+n is the reference frequency value of the continuous wave signal of the i+nth frequency, f i-m is the reference frequency value of the continuous wave signal of the imth frequency. The larger the i value, the higher the f i The larger the value, the final phase corresponding to the continuous wave signal of the i+nth frequency and the final phase corresponding to the continuous wave signal of the imth frequency both meet the condition for calculating the distance.
[0166] It should be noted that the reference frequency value of the continuous wave signal is the same as the frequency value of the channel corresponding to the continuous wave signal. The frequency value of the channel corresponding to the continuous wave signal is a fixed value. For example, the frequency value of the first channel is 2402 MHz, and the reference frequency value of the continuous wave signal of the first frequency is 2402 MHz; the frequency value of the second channel is 2404 MHz, and the reference frequency value of the continuous wave signal of the second frequency is 2404 MHz, and so on.
[0167] Ideally, the frequency of the baseband signal to be sent by the first device and the second device is fixed, denoted by f base , which is 250khz or 500khz. In actual situations, due to the influence of crystal frequency deviation or radio wave interference during signal propagation, the baseband signal frequency after the first device or the second device receives the continuous wave signal down-converted on different channels deviates, resulting in a deviation in the phase corresponding to the continuous wave signal.
[0168] To compensate for this deviation, the frequency offset corresponding to the continuous wave signal can be calculated first, and the signal frequency actually sampled by the continuous wave signal can be adjusted according to the frequency offset. Alternatively, the phase in the phase set corresponding to the continuous wave signal can be adjusted according to the frequency offset.
[0169] In the case where the plurality of sampling data sets are obtained by sampling a plurality of continuous wave signals of different frequencies from the second device, such as Figure 4 As shown, after step S103, the data processing method in this embodiment further includes:
[0170] Step 204: When the multiple sampling data sets are obtained by sampling multiple continuous wave signals of different frequencies from the second device, determine the frequency offset corresponding to the continuous wave signal of any frequency based on the baseband signal frequency of the first device and the signal frequency actually sampled from the continuous wave signal of any frequency among the multiple continuous wave signals of different frequencies.
[0171] Step 205: According to the frequency offset corresponding to the continuous wave signal of the same frequency, the phase set that meets the distance calculation condition and corresponds to the continuous wave signal of the same frequency among the multiple phase sets is adjusted.
[0172] In the case where the plurality of sampling data sets are sent to the first device after the second device samples a plurality of continuous wave signals with different frequencies from the first device, such as Figure 5 As shown, after step S103, the data processing method in this embodiment further includes:
[0173] Step 304: In the case where the multiple sampling data sets are generated by the second device sampling multiple continuous wave signals with different frequencies from the first device and then sending them to the first device, the frequency offset corresponding to the continuous wave signal of any frequency is determined based on the baseband signal frequency of the second device and the signal frequency actually sampled from the continuous wave signal of any frequency among the multiple continuous wave signals of different frequencies.
[0174] Step 305: According to the frequency offset corresponding to the continuous wave signal of the same frequency, the phase set that meets the distance calculation condition and corresponds to the continuous wave signal of the same frequency among the multiple phase sets is adjusted.
[0175] The above step 204 is substantially the same as step 304, except that step 204 calculates the frequency offset according to the baseband signal frequency of the first device, while step 304 calculates the frequency offset according to the baseband signal frequency of the second device.
[0176] Specifically, the signal frequency obtained by actually sampling a continuous wave signal of any frequency among multiple continuous wave signals of different frequencies is expressed as f real,i , the continuous wave signal is uniformly sampled. The sampling frequency of the continuous wave signal is fs, and the sampling interval is Ts = 1 / fs.
[0177] Assume that the I / Q data obtained by sampling is converted into phase and linearly fitted, and the expression of the fitting line obtained is: Assume that the sampling time of the j sampling points is t, if the continuous wave signal of the i-th frequency is expressed as y(t)=sin(2πf real,i t), then the phase fitting result corresponding to the sampling time t can be expressed as express.
[0178] Ideally, the parameter k in the expression for the fitted line is i The slope can be calculated using the fitting results corresponding to any two sampling points. Assume that the point at the mth moment on the fitting line is and the point at the nth moment Then the slope k i It can be calculated by the following formula (10):
[0179]
[0180] It can be seen that the slope k of the fitting straight line of the phase set corresponding to the continuous wave signal of the i-th frequency is i The signal frequency f obtained by sampling the continuous wave signal of the i-th frequency real,i The relationship k is satisfied i =2πf real,i / f s , then the signal frequency f obtained by sampling any one of the continuous wave signals of different frequencies is real,i It is calculated by the following formula (11):
[0181]
[0182] Among them, k i is the slope of the fitting line obtained by linear fitting after multiple phase unwrapping processing corresponding to the continuous wave signal of the i-th frequency, f s is the sampling frequency of the continuous wave signal.
[0183] Then the frequency offset f corresponding to the continuous wave signal of the i-th frequency is offset,i It can be calculated by the following formula (12):
[0184]
[0185] It should be noted that after determining the frequency offset corresponding to the continuous wave signal of different frequencies, all phases in the phase set corresponding to the continuous wave signal may be adjusted, or only the final phase of the phase set corresponding to the continuous wave signal may be adjusted.
[0186] The specific adjustment algorithm is described below by taking the adjustment of the final phase of the phase set corresponding only to the continuous wave signal as an example.
[0187] Assume that the final phase after adjustment is It can be calculated by the following formula (13):
[0188]
[0189] in, is the final phase corresponding to the continuous wave signal of the i-th frequency, f offset,i is the frequency offset corresponding to the continuous wave signal of the i-th frequency, f i is the reference frequency value of the continuous wave signal of the i-th frequency; is the final phase corresponding to the continuous wave signal of the i+1th frequency, f offset,i+1 is the frequency offset corresponding to the continuous wave signal of the i+1th frequency, f i+1 is the reference frequency value of the continuous wave signal of the i+1th frequency.
[0190] It is worth noting that after determining the final phase corresponding to the phase set that does not meet the condition for calculating the distance based on at least one final phase that meets the condition for calculating the distance, the frequency offset adjustment can be performed on at least one final phase that meets the condition for calculating the distance and the final phase corresponding to the phase set that does not meet the condition for calculating the distance; or after performing the frequency offset adjustment on at least one final phase that meets the condition for calculating the distance, the final phase corresponding to the phase set that does not meet the condition for calculating the distance can be directly determined based on the adjusted at least one final phase that meets the condition for calculating the distance.
[0191] 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.
[0192] Figure 6 A distance measurement method provided in an embodiment of the present application is applied to a first device, and the distance measurement method includes:
[0193] Step 400: The first device sends a ranging request to the second device.
[0194] Step 401: The second device responds to the ranging request of the first device.
[0195] It is worth noting that the device that sends the ranging request is generally the master device, and the slave device will respond to the master device after receiving the ranging request, and Bluetooth ranging can be performed after the response. In this embodiment, the process of Bluetooth ranging is described with the first device as the master device and the second device as the slave device. It can be understood that in actual applications, the master device and the slave device can be selected independently.
[0196] Step 402: After receiving the response from the second device, the first device sends a plurality of continuous wave signals of different frequencies to the second device.
[0197] Step 403: After receiving the multiple continuous wave signals of different frequencies from the first device, the second device sends the multiple continuous wave signals of different frequencies to the first device.
[0198] Step 404: The first device receives a plurality of continuous wave signals of different frequencies from the second device.
[0199] For the first device, after receiving a plurality of continuous wave signals of different frequencies from the second device, the following steps are further performed:
[0200] Step 405: Sampling multiple continuous wave signals with different frequencies from the second device to obtain multiple first sampling data sets, a continuous wave signal with the same frequency corresponds to a first sampling data set, each first sampling data set includes multiple groups of data corresponding to multiple sampling points, each sampling point corresponds to a group of data, and each group of data includes an in-phase data and an orthogonal data.
[0201] Step 406: Calculate a plurality of first phase sets according to the plurality of first sampling data sets, wherein the plurality of first phase sets correspond one-to-one to the plurality of first sampling data sets, and a group of data in any first sampling data set corresponds to a first phase.
[0202] Step 407: Determine at least one first phase set in the multiple first phase sets that meets the condition for calculating the distance between the first device and the second device based on any one of the multiple first phase sets and the first reference phase corresponding to the first phase set, wherein the first reference phase is obtained after fitting multiple first phases in the first phase set.
[0203] For the second device, after receiving a plurality of continuous wave signals of different frequencies from the first device, the following steps are further performed:
[0204] Step 408: Sampling multiple continuous wave signals with different frequencies from the first device obtains multiple second sampling data sets, a continuous wave signal with the same frequency corresponds to a second sampling data set, each second sampling data set includes multiple groups of data corresponding to multiple sampling points, each sampling point corresponds to a group of data, and each group of data includes an in-phase data and an orthogonal data.
[0205] Step 409: Calculate a plurality of second phase sets according to the plurality of second sampling data sets, wherein the plurality of second phase sets correspond one-to-one to the plurality of second sampling data sets, and a group of data in any second sampling data set corresponds to one second phase.
[0206] Step 410: Determine at least one second phase set in the multiple second phase sets that meets the condition for calculating the distance between the first device and the second device based on any second phase set in the multiple second phase sets and the second reference phase corresponding to the second phase set, wherein the second reference phase is obtained after fitting multiple second phases in the second phase set.
[0207] The above steps 405 to 407 are steps for the first device to perform data processing on multiple continuous wave signals of different frequencies received from the second device, and the above steps 408 to 410 are steps for the second device to perform data processing on multiple continuous wave signals of different frequencies received from the first device. The specific process of data processing can be referred to the embodiment of the above data processing method, which will not be repeated here.
[0208] Step 411: The first device sends at least one first phase set among multiple phase sets that meets the condition for calculating the distance to the second device.
[0209] Step 412: The second device sends at least one second phase set among the multiple phase sets that meets the condition for calculating the distance to the first device.
[0210] Step 413: The first device calculates the distance between the first device and the second device according to at least one phase set and at least one second phase set.
[0211] Step 414: The second device calculates the distance between the first device and the second device according to at least one phase set and at least one second phase set.
[0212] Figure 7 A distance measurement method provided in an embodiment of the present application is applied to a first device, and the distance measurement method includes:
[0213] Step 500: The first device sends a ranging request to the second device.
[0214] Step 501: The second device responds to the ranging request of the first device.
[0215] It is worth noting that the device that sends the ranging request is generally the master device, and the slave device will respond to the master device after receiving the ranging request, and Bluetooth ranging can be performed after the response. In this embodiment, the process of Bluetooth ranging is described with the first device as the master device and the second device as the slave device. It can be understood that in actual applications, the master device and the slave device can be selected independently.
[0216] Step 502: After receiving the response from the second device, the first device sends a plurality of continuous wave signals of different frequencies to the second device.
[0217] Step 503: After receiving the multiple continuous wave signals of different frequencies from the first device, the second device sends the multiple continuous wave signals of different frequencies to the first device.
[0218] Step 504: The first device receives a plurality of continuous wave signals of different frequencies from the second device.
[0219] Step 505: The first device samples a plurality of continuous wave signals with different frequencies from the second device to obtain a plurality of first sampling data sets, and sends the first sampling data sets to the second device.
[0220] Step 506: The second device samples a plurality of continuous wave signals of different frequencies from the first device to obtain a plurality of second sampled data sets, and sends the second sampled data sets to the first device.
[0221] For the first device, after obtaining the first sampling data set and the second sampling data set, the following steps are further performed:
[0222] Step 507: Calculate a plurality of first phase sets based on the plurality of first sampling data sets, and calculate a plurality of second phase sets based on the plurality of second sampling data sets, wherein the plurality of first phase sets correspond one-to-one to the plurality of first sampling data sets, and a group of data in any one of the first sampling data sets corresponds to a first phase; and the plurality of second phase sets correspond one-to-one to the plurality of second sampling data sets, and a group of data in any one of the second sampling data sets corresponds to a first phase.
[0223] Step 508: Determine at least one first phase set among the multiple first phase sets that satisfies the condition for calculating the distance between the first device and the second device based on the first reference phase corresponding to any one first phase set among the multiple first phase sets and the first phase set, and determine at least one second phase set among the multiple second phase sets that satisfies the condition for calculating the distance between the first device and the second device based on the second reference phase corresponding to any one second phase set among the multiple second phase sets and the second phase set.
[0224] The first reference phase is obtained by fitting multiple first phases in the first phase set; and the second reference phase is obtained by fitting multiple second phases in the second phase set.
[0225] For the second device, after obtaining the first sampling data set and the second sampling data set, the following steps are further performed:
[0226] Step 509: Calculate a plurality of first phase sets based on the plurality of first sampling data sets, and calculate a plurality of second phase sets based on the plurality of second sampling data sets, wherein the plurality of first phase sets correspond one-to-one to the plurality of first sampling data sets, and a group of data in any one of the first sampling data sets corresponds to a first phase; and the plurality of second phase sets correspond one-to-one to the plurality of second sampling data sets, and a group of data in any one of the second sampling data sets corresponds to a first phase.
[0227] Step 510: Determine at least one first phase set among the multiple first phase sets that satisfies the condition for calculating the distance between the first device and the second device based on a first reference phase corresponding to any one first phase set among the multiple first phase sets and the first phase set, and determine at least one second phase set among the multiple second phase sets that satisfies the condition for calculating the distance between the first device and the second device based on a second reference phase corresponding to any one second phase set among the multiple second phase sets and the second phase set.
[0228] The first reference phase is obtained by fitting multiple first phases in the first phase set; and the second reference phase is obtained by fitting multiple second phases in the second phase set.
[0229] The above steps 507 to 508 are steps for the first device to process the first sampling data set, and the above steps 509 to 510 are steps for the second device to process the second sampling data set. The specific process of data processing can be referred to the embodiment of the above data processing method, which will not be repeated here.
[0230] Step 511: The first device calculates the distance between the first device and the second device according to at least one phase set and at least one second phase set.
[0231] Step 512: The second device calculates the distance between the first device and the second device according to at least one phase set and at least one second phase set.
[0232] In a possible implementation, in the above distance measurement method, the first device and the second device communicate based on a Bluetooth connection.
[0233] Figure 8 It is a schematic structural block diagram of an electronic device 600 provided in an embodiment of the present application. The electronic device 600 includes: a processor 610, a memory 620, a communication interface 630, and a bus 640.
[0234] The processor 610 may be connected to a memory 620. The memory 620 may be used to store the program code and data. Therefore, the memory 620 may be a storage unit inside the processor 610, or an external storage unit independent of the processor 610, or a component including a storage unit inside the processor 610 and an external storage unit independent of the processor 610.
[0235] Optionally, the electronic device 600 may further include a bus 640. The memory 620 and the communication interface 630 may be connected to the processor 610 via the bus 640. The bus 640 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus 640 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 The fact that only one line is used in the diagram does not mean that there is only one bus or only one type of bus.
[0236] It should be understood that in the embodiment of the present application, the processor 610 may adopt a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. Alternatively, the processor 610 may adopt one or more integrated circuits to execute relevant programs to implement the technical solutions provided in the embodiment of the present application.
[0237] The memory 620 may include a read-only memory and a random access memory, and provides instructions and data to the processor 610. A portion of the processor 610 may also include a nonvolatile random access memory. For example, the processor 610 may also store information on the device type.
[0238] When the electronic device 600 is running, the processor 610 executes the computer execution instructions in the memory 620 to use the hardware resources in the electronic device 600 to perform the operation steps of the above-mentioned data processing method or ranging method.
[0239] The present application also provides a computer-readable storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed, the data processing method or ranging method provided in the embodiments of the present application is implemented.
[0240] The present application also provides a computer program product, which includes: a computer program code, when the computer program code is run on a computer, the computer executes the data processing method or the ranging method provided in the embodiments of the present application.
[0241] The above embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. 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 site, computer, server or data center to another website site, 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.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium. The semiconductor medium can be a solid state drive (SSD).
[0242] 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 the embodiments of the present application.
[0243] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0244] In the several embodiments provided in the embodiments of the present application, it should be understood that the disclosed systems, 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.
[0245] 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, and 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.
[0246] 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.
[0247] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a memory (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.
[0248] The above is only a specific implementation of the embodiment of the present application, but the protection scope of the embodiment of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in the embodiment of the present application, which should be included in the protection scope of the embodiment of the present application. Therefore, the protection scope of the embodiment of the present application should be based on the protection scope of the claims.
Claims
1. A data processing method, characterized in that: Applied to a first device, the data processing method is applied to a scenario where the first device and the second device measure the distance, and the method includes: Acquire multiple sampling data sets, each of the sampling data sets includes multiple groups of data corresponding to multiple sampling points, each sampling point corresponds to a group of data, and each group of data includes an in-phase data and an orthogonal data; The multiple sampling data sets are obtained by sampling multiple continuous wave signals of different frequencies from the second device, or the second device samples multiple continuous wave signals of different frequencies from the first device and sends them to the first device, and the continuous wave signals of the same frequency correspond to one sampling data set; A plurality of phase sets are obtained by calculation according to the plurality of sampling data sets, wherein the plurality of phase sets correspond to the plurality of sampling data sets one by one, and a group of data in any of the sampling data sets corresponds to one phase; Based on any one phase set in the multiple phase sets and a reference phase corresponding to the phase set, determine at least one phase set in the multiple phase sets that meets the condition for calculating the distance between the first device and the second device, wherein the reference phase is obtained after fitting multiple phases in the phase set.
2. The data processing method according to claim 1, characterized in that: The step of fitting a plurality of phases in the phase set comprises: Performing phase unwrapping processing on the multiple phases according to a sampling order of multiple sampling points corresponding to the multiple phases in the phase set; The reference phase is obtained by performing linear fitting on the multiple phases after the phase unwrapping process.
3. The data processing method according to claim 2, characterized in that: The performing phase unwrapping processing on the multiple phases according to the sampling order of the multiple sampling points corresponding to the multiple phases in the phase set includes: According to the sampling order of multiple sampling points corresponding to the multiple phases in the phase set, the multiple phases are increased or decreased one by one by an integer multiple of 2π, and the absolute value of the difference between the phases after the phase unwrapping processing corresponding to any two adjacent sampling points in the multiple sampling points is not greater than π.
4. The data processing method according to any one of claims 1 to 3, characterized in that: The determining, according to any one phase set in the multiple phase sets and a reference phase corresponding to the phase set, at least one phase set in the multiple phase sets that satisfies a condition for calculating the distance between the first device and the second device comprises: Calculating a root mean square error between a plurality of phases of any one phase set among the plurality of phase sets and a reference phase corresponding one to the plurality of phases; At least one phase set among the multiple phase sets that meets a condition for calculating the distance is determined according to the root mean square error and a preset threshold.
5. The data processing method according to claim 4, characterized in that: The preset threshold is calculated based on multiple root mean square errors corresponding to the multiple phase sets, and one phase set corresponds to one root mean square error.
6. The data processing method according to claim 5, characterized in that: Calculating the preset threshold according to multiple root mean square errors corresponding to the multiple phase sets includes: Determine means and standard deviations of multiple root mean square errors corresponding to the multiple phase sets; The preset threshold is determined according to the mean and the standard deviation.
7. The data processing method according to any one of claims 1 to 6, characterized in that: The method further comprises: In a case where the multiple sampling data sets are obtained by sampling multiple continuous wave signals of different frequencies from the second device, determining a frequency offset corresponding to the continuous wave signal of any one frequency according to the baseband signal frequency of the first device and the signal frequency actually obtained by sampling the continuous wave signal of any one frequency among the multiple continuous wave signals of different frequencies; According to the frequency offset corresponding to the continuous wave signal of the same frequency, adjusting the phase set among the multiple phase sets that meets the condition for calculating the distance and corresponds to the continuous wave signal of the same frequency; or, In a case where the plurality of sampling data sets are sent to the first device after the second device samples a plurality of continuous wave signals with different frequencies from the first device, determining a frequency offset corresponding to the continuous wave signal of any one frequency according to a baseband signal frequency of the second device and a signal frequency actually sampled from a continuous wave signal of any one frequency among the plurality of continuous wave signals with different frequencies; According to the frequency offset corresponding to the continuous wave signal of the same frequency, the phase set among the multiple phase sets that meets the condition for calculating the distance and corresponds to the continuous wave signal of the same frequency is adjusted.
8. The data processing method according to claim 7, characterized in that: The signal frequency f obtained by actually sampling a continuous wave signal of any frequency among a plurality of continuous wave signals of different frequencies is real,i Calculated by the following formula: Among them, k i is the slope of the fitting line obtained by linear fitting after multiple phase unwrapping processing corresponding to the continuous wave signal of the i-th frequency, f s is the sampling frequency of the continuous wave signal.
9. The data processing method according to claim 2 or 3, characterized in that: The method further comprises: At least one fitting result corresponding to the same horizontal coordinate point on the fitting straight line corresponding to at least one phase set among the multiple phase sets that meets the condition for calculating the distance is determined as at least one final phase that meets the condition for calculating the distance.
10. The data processing method according to claim 9, characterized in that: After determining at least one fitting result corresponding to the same horizontal coordinate point on the fitting straight line corresponding to at least one phase set among the multiple phase sets that meets the condition for calculating the distance as at least one final phase that meets the condition for calculating the distance, the method further includes: According to at least one final phase that satisfies the condition for calculating the distance, a final phase corresponding to a set of phases that do not satisfy the condition for calculating the distance is determined.
11. The data processing method according to claim 10, characterized in that: The frequency of the continuous wave signal corresponding to the phase set that does not meet the condition for calculating the distance is the i-th frequency, and the final phase corresponding to the continuous wave signal of the i-th frequency is Calculated by the following formula: in, is the final phase corresponding to the continuous wave signal of the i+nth frequency, is the final phase corresponding to the continuous wave signal of the imth frequency, f i is the reference frequency value of the continuous wave signal of the i-th frequency, f i+n is the reference frequency value of the continuous wave signal of the i+nth frequency, f i-m is the reference frequency value of the continuous wave signal of the imth frequency. The larger the i value, the higher the f i The larger the value, the final phase corresponding to the continuous wave signal of the i+nth frequency and the final phase corresponding to the continuous wave signal of the imth frequency both meet the condition for calculating the distance.
12. The data processing method according to any one of claims 1 to 11, characterized in that: The first device and the second device communicate with each other based on a Bluetooth connection.
13. A distance measurement method, characterized in that: Applied to a first device, comprising: Sending a ranging request to the second device; After receiving a response from the second device, sending a plurality of first continuous wave signals of different frequencies to the second device, and receiving a plurality of second continuous wave signals of different frequencies from the second device; Sampling the plurality of continuous wave signals with different frequencies from the second device to obtain a plurality of second sampling data sets, wherein a continuous wave signal with the same frequency corresponds to one second sampling data set, each of the second sampling data sets includes a plurality of groups of data corresponding to a plurality of sampling points, each sampling point corresponds to a group of data, and each group of data includes one in-phase data and one orthogonal data; Calculate a plurality of second phase sets according to the plurality of second sampling data sets, wherein the plurality of second phase sets correspond one-to-one to the plurality of second sampling data sets, and a group of data in any of the second sampling data sets corresponds to one first phase; Determine, according to any one of the multiple second phase sets and a second reference phase corresponding to the second phase set, at least one second phase set in the multiple second phase sets that satisfies a condition for calculating the distance between the first device and the second device, wherein the reference phase is obtained after fitting multiple phases in the phase set; sending at least one second phase set among the multiple phase sets that satisfies the condition for calculating the distance to the second device, and receiving at least one first phase set that satisfies the condition for calculating the distance from the second device; A distance between the first device and the second device is calculated based on the at least one first phase set and the at least one second phase set.
14. A distance measurement method, characterized in that: Applied to a first device, comprising: Sending a ranging request to the second device; After receiving a response from the second device, sending a plurality of first continuous wave signals of different frequencies to the second device, and receiving a plurality of second continuous wave signals of different frequencies from the second device; Sampling a plurality of second continuous wave signals of different frequencies from the second device to obtain a plurality of second sampling data sets, and receiving a plurality of first sampling data sets from the second device, wherein a plurality of first continuous wave signals of the same frequency correspond to a first sampling data set, a plurality of second continuous wave signals of the same frequency correspond to a second sampling data set, each of the first sampling data sets includes a plurality of groups of data corresponding to a plurality of sampling points, each of the second sampling data sets includes a plurality of groups of data corresponding to a plurality of sampling points, each sampling point corresponds to a group of data, and each group of data includes an in-phase data and an orthogonal data; A plurality of first phase sets are calculated based on the plurality of first sampling data sets, and a plurality of second phase sets are calculated based on the plurality of second sampling data sets, wherein the plurality of first phase sets correspond to the plurality of first sampling data sets one-to-one, and a group of data in any of the first sampling data sets corresponds to one first phase; and the plurality of second phase sets correspond to the plurality of second sampling data sets one-to-one, and a group of data in any of the second sampling data sets corresponds to one first phase; Determine at least one first phase set in the multiple first phase sets that satisfies a condition for calculating the distance between the first device and the second device based on a first reference phase corresponding to any one first phase set in the multiple first phase sets and the first phase set, and determine at least one second phase set in the multiple second phase sets that satisfies a condition for calculating the distance between the first device and the second device based on a second reference phase corresponding to any one second phase set in the multiple second phase sets and the second phase set, The first reference phase is obtained by fitting multiple first phases in the first phase set; the second reference phase is obtained by fitting multiple second phases in the second phase set; The distance between the first device and the second device is calculated according to at least one first phase set satisfying a condition for calculating the distance and at least one second phase set satisfying a condition for calculating the distance.
15. The distance measurement method according to claim 13 or 14, characterized in that: The first device and the second device communicate with each other based on a Bluetooth connection.
16. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory is used to store instructions, and when the instructions are executed by the processor, the electronic device executes the data processing method as described in any one of claims 1 to 12, or executes the ranging method as described in any one of claims 13 to 15.
17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which includes program instructions. When the program instructions are executed, the data processing method according to any one of claims 1 to 12 is implemented, or the ranging method according to any one of claims 13 to 15 is implemented.
18. A computer program product, characterized in that The computer program product comprises: a computer program code, and when the computer program code is executed on a computer, the computer is enabled to execute the data processing method according to any one of claims 1 to 12, or to execute the distance measurement method according to any one of claims 13 to 15.