Device ranging method, device, equipment and storage medium
By using correction functions to correct the signal strength in the inter-device distance measurement, the problem of inaccurate measurement of equipment spacing is solved, and the accuracy and certainty of the measurement results are improved.
Patent Information
- Application Number
- CN202110190420.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-18
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2041-02-18
AI Technical Summary
In the prior art, when measuring distances between equipment, signal strength measurement is affected by environmental factors and equipment differences, resulting in inaccurate measurement results and large errors.
The correction function corrects the original signal strength, eliminates the influence of the difference between the receiving device and/or transmitting device on the signal strength measurement, thereby improving the accuracy of the signal strength and thus improving the accuracy of the equipment spacing.
Without adding additional device hardware, the accuracy of measurement results is improved through signal strength correction and the certainty of device spacing is enhanced.
Smart Images

Figure CN114966534B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of Internet of Things technology, and in particular to a device ranging method, apparatus, device and storage medium. Background Art
[0002] With the continuous development of Internet of Things (IoT) technology, more and more electronic devices can interact with each other wirelessly.
[0003] When implementing interaction between devices, distance measurement is usually required between the devices, so as to determine the interacting devices based on the measured distance. Taking the interaction between Bluetooth devices as an example, the Bluetooth device substitutes the received signal strength indication (RSSI) of the Bluetooth received signal into the distance calculation formula to determine the distance between the other Bluetooth devices. Summary of the invention
[0004] The present application provides a device ranging method, apparatus, device and storage medium. The technical solution is as follows:
[0005] On the one hand, an embodiment of the present application provides a device ranging method, the method is used for a first device, and the method includes:
[0006] Measuring the wireless signal sent by the second device to obtain the original signal strength;
[0007] Correcting the original signal strength by using a correction function to obtain a corrected signal strength, wherein the correction function is used to correct the influence of differences in receiving devices and / or transmitting devices on signal strength measurement;
[0008] A device separation distance between the first device and the second device is determined based on the corrected signal strength.
[0009] On the other hand, an embodiment of the present application provides a device ranging apparatus, the apparatus being used for a first device, the apparatus comprising:
[0010] A signal measuring module, used to measure the wireless signal sent by the second device to obtain the original signal strength;
[0011] A strength correction module, used to correct the original signal strength by using a correction function to obtain a corrected signal strength, wherein the correction function is used to correct the influence of differences in receiving devices and / or transmitting devices on signal strength measurement;
[0012] The distance determination module is used to determine the device distance between the first device and the second device based on the corrected signal strength.
[0013] On the other hand, an embodiment of the present application provides a computer device, which includes a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used to be executed by the processor to implement the device ranging method described in the above aspect.
[0014] On the other hand, an embodiment of the present application provides a computer-readable storage medium, wherein the storage medium stores at least one instruction, and the at least one instruction is used to be executed by a processor to implement the device ranging method as described in the above aspects.
[0015] On the other hand, an embodiment of the present application provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the device ranging method provided in various optional implementations of the above aspects.
[0016] In an embodiment of the present application, before the first device determines the device distance between itself and the second device based on the measured original signal strength, it first corrects the original signal strength using a correction function to eliminate the impact of differences in the receiving device and / or the transmitting device on the signal strength measurement, and then determines the device distance based on the corrected signal strength obtained by correction. Under the premise of using existing device hardware, the accuracy of the measured signal strength can be improved through signal strength correction, thereby improving the accuracy of the subsequently determined device distance. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A schematic diagram showing an implementation environment provided by an exemplary embodiment of the present application is shown;
[0018] Figure 2 A flow chart of a device ranging method provided by an exemplary embodiment of the present application is shown;
[0019] Figure 3 A flow chart of a device ranging method provided by another exemplary embodiment of the present application is shown;
[0020] Figure 4 is an interactive timing diagram of a device ranging process shown in an exemplary embodiment of the present application;
[0021] Figure 5 is a flow chart of a process of generating a standard comparison table shown in an exemplary embodiment of the present application;
[0022] Figure 6 is a flowchart of a first correction function determination process shown in an exemplary embodiment of the present application;
[0023] Figure 7 is a flow chart of a second correction function determination process shown in an exemplary embodiment of the present application;
[0024] Figure 8 is a flow chart of a process for determining a device spacing according to an exemplary embodiment of the present application;
[0025] Fig. 9 is a schematic diagram of an implementation of a device spacing determination process shown in an exemplary embodiment of the present application;
[0026] Fig.10 is a flow chart of a process for determining a device spacing according to another exemplary embodiment of the present application;
[0027] Fig.11 is a flow chart of a process for determining a device spacing according to another exemplary embodiment of the present application;
[0028] Fig.12 is a schematic diagram of an implementation of a device spacing determination process shown in another exemplary embodiment of the present application;
[0029] Fig.13 A structural block diagram of a device distance measuring device provided by an embodiment of the present application is shown;
[0030] Fig.14 A structural block diagram of a computer device provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0031] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0032] The term "multiple" as used herein refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.
[0033] In the related art, when performing distance measurement, the device first measures the signal strength of the wireless signal, and then inputs the measured signal strength as a parameter into the distance calculation formula to obtain the device distance. The distance calculation formula is as follows:
[0034]
[0035] Distance is the device distance, MeasuredPower is the signal strength measured when the device distance is 1 meter, RSSI is the signal strength actually measured by the device, and N is the signal attenuation rate (related to environmental factors, usually a constant of 2).
[0036] From the above formula, it can be seen that the accuracy of the device distance is strongly related to the accuracy of the signal strength actually measured. However, since the signal measurement is affected by environmental factors, its value fluctuates greatly. If only the signal strength obtained by a single measurement is used to calculate the device distance, the calculation result will have a large error. Therefore, the device usually measures the signal strength multiple times to improve the accuracy of the device distance.
[0037] In addition, due to the differences in the design of the transmitting and receiving antennas of different devices, the values of MeasuredPower and N in the above distance calculation formula vary greatly on different devices, resulting in a large error between the calculated device distance and the actual device distance when fixed constants MeasuredPower and N are used for distance calculation.
[0038] In the device ranging method provided in the embodiment of the present application, after the device measures the wireless signal to obtain the original signal strength, it does not directly use the original signal strength to determine the device distance, but first uses a correction function to correct the original signal strength to eliminate the influence of the difference between the receiving device and / or the transmitting device on the signal strength measurement, thereby improving the accuracy of the signal strength, and then determining the device distance based on the corrected signal strength. The scheme provided in the embodiment of the present application can improve the accuracy of the measured signal strength by introducing a signal strength correction mechanism without adding additional device hardware, thereby improving the accuracy of the device distance determined subsequently.
[0039] Please refer to Figure 1 , which shows a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application, wherein the implementation environment includes a first device 110 and a second device 120.
[0040] The first device 110 is an electronic device with a wireless signal transceiving function, which may be a smart phone, a tablet computer, a wearable device, a personal computer, etc., and the wireless signal transceiving function may be implemented by a signal transceiving component. When the first device 110 turns on the wireless signal transceiving function, the signal transceiving component can receive wireless signals sent by other devices within the signal receiving range, and can send wireless signals to other devices within the signal sending range. Among them, the signal transceiving component can be built into the first device 110, or it can be externally connected to the first device 110, which is not limited in this embodiment.
[0041] In some embodiments, when the signal transceiver component is a Bluetooth component, the wireless signal received and sent by the signal transceiver component is a Bluetooth signal; when the signal transceiver component is a Wireless Fidelity (WiFi) component, the wireless signal received and sent by the signal transceiver component is a WiFi signal; when the signal transceiver component is an Ultra Wide Band (UWB) component, the wireless signal received and sent by the signal transceiver component is a UWB signal (pulse signal). The embodiments of the present application do not limit the signal type of the wireless signal.
[0042] The second device 120 is an electronic device with a wireless signal transceiving function, which may be an IoT device, such as a smart speaker 121, a smart TV 122, a smart door lock 123, a Bluetooth headset 124, etc., and the wireless signal transceiving function may be implemented by a signal transceiving component. When the second device 120 turns on the wireless signal transceiving function, the signal transceiving component can receive wireless signals sent by other devices within the signal receiving range, and can send wireless signals to other devices within the signal sending range.
[0043] In a possible application scenario, when the signal transceiver functions of the first device 110 and the second device 120 are both turned on, the second device 120 sends a wireless signal through the signal transceiver component, and the first device 110 receives the wireless signal through the signal transceiver component, and measures the signal strength of the wireless signal to obtain the original signal strength. Further, the first device 110 corrects the original signal strength to eliminate the influence of the difference between the receiving device and the sending device on the signal strength measurement, and obtains the corrected signal strength, thereby determining the device distance between the first device 110 and the second device 120 based on the corrected signal strength. When the device distance is within the distance range, the first device 110 establishes a connection with the second device 120, and then controls the second device 120 through the connection.
[0044] Of course, when the second device 120 has a strong data processing capability, the second device 120 can also determine the device distance based on the wireless signal sent by the first device 110, and this embodiment does not limit this. For the convenience of description, the following embodiments are described by taking the device ranging method applied to the first device 110 as an example.
[0045] Please refer to Figure 2 , which shows a flow chart of a device ranging method provided by an exemplary embodiment of the present application. This embodiment uses the method for Figure 1 Taking the first device shown as an example, the method includes the following steps:
[0046] Step 201, measuring the wireless signal sent by the second device to obtain the original signal strength.
[0047] In a possible implementation, when a wireless signal transceiving function (such as a WiFi function, a Bluetooth function, or a UWB function, etc.) is turned on, the first device receives the wireless signal sent by the second device through a signal transceiving component, and measures the signal strength of the wireless signal to obtain the original signal strength.
[0048] When the first device receives a wireless signal and measures the signal strength, it does not need to establish a stable connection with the second device. For example, when the second device broadcasts a signal, the first device can receive the wireless signal and measure the signal strength of the wireless signal as long as it is within the signal broadcast range without establishing a connection with the second device.
[0049] In some embodiments, when the wireless signal is a Bluetooth signal, the original signal strength is the original Bluetooth signal strength; when the wireless signal is a WiFi signal, the original signal strength is the original WiFi signal strength; when the wireless signal is a UWB signal, the original signal strength is the original pulse signal strength. This embodiment is not limited to this.
[0050] In the embodiment of the present application, the signal strength is represented by RSSI (negative number, in dBm). The larger the RSSI, the smaller the loss of the wireless signal during the propagation process. Conversely, the smaller the RSSI, the greater the loss of the wireless signal during the propagation process.
[0051] Optionally, when the second device sends a wireless signal at a specific frequency, the first device measures each received wireless signal to obtain multiple consecutive original signal strengths. For example, when the second device sends a wireless signal at an interval of 100 ms, the first device can measure 10 original signal strengths within 1 second.
[0052] Step 202: Correct the original signal strength by using a correction function to obtain a corrected signal strength. The correction function is used to correct the influence of the difference between the receiving device and / or the transmitting device on the signal strength measurement.
[0053] Since the measurement results of signal strength will be affected by the receiving device (i.e., the first device) and the transmitting device (i.e., the second device) (i.e., at the same device spacing, different receiving devices have different signal strength measurement results for wireless signals sent by the same transmitting device; at the same device spacing, the same receiving device has different signal strength measurement results for wireless signals sent by different transmitting devices), in order to improve the accuracy of the signal measurement results, the first device needs to correct the original signal strength.
[0054] The signal strength correction process can be understood as the standardization of the measurement process, that is, the measurement process of the wireless signal sent by the first device to the second device at the actual device distance is converted into the measurement process of the wireless signal sent by the standard receiving device to the standard sending device at the actual device distance. It should be noted that if the first device and the second device are both standard devices, the first device does not need to perform signal strength correction.
[0055] In a possible implementation, a correction function for performing signal strength correction is provided in the first device. During the signal strength correction process, the first device uses the measured original signal strength as a function input, and determines the function output of the correction function as the corrected signal strength. Different receiving devices and / or transmitting devices correspond to different correction functions, and the correction function can be pre-set at the first device, or obtained and stored by the first device from a server.
[0056] Optionally, the correction function is used to correct the influence of the receiving device on the signal strength measurement, or the correction function is used to correct the influence of the transmitting device on the signal strength measurement, or the correction function is used to correct the influence of the receiving device and the transmitting device on the signal strength measurement.
[0057] Since the receiving device has a greater impact on the signal strength measurement, in a possible implementation, the correction function is used to correct the impact of the receiving device on the signal strength measurement, or the correction function is used to correct the impact of the receiving device and the transmitting device on the signal strength measurement (that is, at least the impact of the receiving device on the signal strength measurement needs to be corrected).
[0058] Optionally, when the second device sends a wireless signal at a specific frequency, the first device performs signal strength correction on multiple original signal strengths obtained through continuous measurements.
[0059] Step 203: Determine the device distance between the first device and the second device based on the corrected signal strength.
[0060] Further, the first device determines the device distance based on the corrected signal strength, wherein the device distance may be a specific distance (such as 30cm, 50cm, etc.) or a range indication (such as a range of 30cm to 50cm, or within 30cm or outside 30cm).
[0061] In a possible implementation, when the specific device distance needs to be obtained, the first device inputs the corrected signal strength as a parameter into a distance calculation formula to obtain the device distance. Since the distance calculation formula includes a square operation, the speed of calculating the device distance using the distance calculation formula is slow.
[0062] In another possible implementation, when only the approximate range of the device spacing is needed, the first device obtains a standard comparison table of standard device spacing and standard signal strength, and then searches for the device spacing from the standard comparison table based on the corrected signal strength, wherein the standard signal strength is obtained by measuring the wireless signal sent by the second standard device (standard transmitting device) at different standard device spacings by the first standard device (standard receiving device). Compared with calculating the device spacing using the distance calculation formula, determining the device spacing by searching the comparison table is faster (because no exponentiation operation is required).
[0063] In an illustrative example, a standard comparison table of standard device spacing and standard signal strength is shown in Table 1.
[0064] Table 1
[0065] Standard equipment spacing (cm) Standard signal strength (dbm) 10 -20 20 -25 30 -30 60 -40 100 -50
[0066] For example, when the corrected signal strength is -27dbm, the first device determines that the device distance between it and the second device is in the range of 20cm to 30cm, or determines that the device distance is within the range of 30cm; when the corrected signal strength is -35dbm, the first device determines that the device distance between it and the second device is in the range of 30cm to 60cm, or determines that the device distance is outside the range of 30cm.
[0067] Optionally, the first device determines whether to establish a connection with the second device based on the determined device distance, and interacts with the second device after establishing the connection with the second device.
[0068] Indicative, such as Figure 1 As shown, when the second device 120 is a smart speaker 121, if the first device 110 determines that the smart speaker 121 is within 50 cm based on the Bluetooth signal strength, a Bluetooth connection is established with the smart speaker 121, thereby controlling the smart speaker 121 to play music; when the second device 120 is a smart TV 122, if the first device 110 determines that the smart TV 122 is within 100 cm based on the Bluetooth signal strength, a connection is established with the smart TV 122 through a WiFi network, thereby controlling the smart TV 122 to perform device projection; when the second device 120 is a smart TV 122, if the first device 110 determines that the smart TV 122 is within 100 cm based on the Bluetooth signal strength, a connection is established with the smart TV 122 through a WiFi network, thereby controlling the smart TV 122 to perform device screen projection; When it is a smart door lock 123, if the first device 110 determines that the smart door lock 123 is within 20 cm based on the Bluetooth signal strength, it establishes a Bluetooth connection with the smart door lock 123 and receives the fingerprint entered by the user on the first device 110. When the fingerprint is verified, the smart door lock 123 is controlled to open; when the second device 120 is a Bluetooth headset 124, if the first device 110 determines that the Bluetooth headset 124 is within 30 cm based on the Bluetooth signal strength, it performs Bluetooth pairing with the Bluetooth headset 124, and plays music through the Bluetooth headset 124 after pairing.
[0069] To summarize, in an embodiment of the present application, before the first device determines the device distance between itself and the second device based on the measured original signal strength, it first uses a correction function to correct the original signal strength to eliminate the impact of differences in the receiving device and / or the transmitting device on the signal strength measurement, and then determines the device distance based on the corrected signal strength obtained by correction. Under the premise of using existing device hardware, the accuracy of the measured signal strength can be improved through signal strength correction, thereby improving the accuracy of the subsequently determined device distance.
[0070] In a possible implementation, for different receiving devices and transmitting devices, corresponding correction functions are pre-set in the server, and when performing signal strength correction, the first device obtains the correction function corresponding to the first device and / or the second device, and then uses the obtained correction function to perform signal strength correction. An exemplary embodiment is used for illustration below.
[0071] Please refer to Figure 3 , which shows a flow chart of a device distance measurement method provided by another exemplary embodiment of the present application. This embodiment uses the method for Figure 1 Taking the first device shown as an example, the method includes the following steps:
[0072] Step 301: Based on the first device identifier of the first device, a first correction function is obtained from a local or server. The first correction function is used to correct the influence of the first device on signal strength measurement. The server stores a mapping relationship between different receiving device identifiers and correction functions.
[0073] In one possible implementation, when the first device turns on the wireless signal receiving and sending function, the first device first searches whether a first correction function corresponding to the first device identifier is stored locally based on its own first device identifier; if found, the first correction function is obtained; if not found, the first correction function is obtained from the server based on the first device identifier request, and the first device identifier is associated with the obtained first correction function and stored locally for subsequent use.
[0074] The first device identifier may be a device model of the first device, such as a mobile phone model. Accordingly, the server stores a mapping relationship between receiving device identifiers (device models) of different receiving devices and correction functions.
[0075] It should be noted that the first device may obtain the first correction function in advance, or may obtain the first correction function when receiving a wireless signal. This embodiment does not limit the timing of obtaining the first correction function.
[0076] In an illustrative example, Figure 4As shown, in the preparation stage, the first device requests the server to obtain the first correction function, and the server searches for and returns the corresponding first correction function based on the first device identifier included in the request.
[0077] In a possible implementation, the process of determining the first correction function may include the following steps:
[0078] 1. Generate a standard comparison table.
[0079] Optionally, the standard comparison table is generated by the developer in advance through measurement, which includes the correspondence between the standard device spacing and the standard signal strength. The standard signal strength is the signal strength measurement result of the wireless signal sent by the first standard device to the second standard device under the standard device spacing. Among them, the first standard device is a device with stable receiving power, and the second standard device is a device with stable transmitting power. Schematically, the generated standard comparison table is shown in Table 1 above.
[0080] In a possible implementation, the process of generating the standard comparison table is as follows: Figure 5 shown.
[0081] Step 501: Set the second standard device to a signal sending state.
[0082] In the signal transmission state, the second standard device transmits the wireless signal with a stable signal transmission power and signal transmission interval.
[0083] Step 502: Set the first standard device to a signal receiving state.
[0084] In the signal receiving state, the first standard device receives and records the signal strength of the wireless signal.
[0085] Step 503: Adjust the device distance between the first standard device and the second standard device.
[0086] Step 504: Under the current device spacing, based on multiple measurement results, obtain the signal strength corresponding to the device spacing.
[0087] Optionally, in order to improve the accuracy of the measured signal strength, the first standard device calculates an average value of the signal strengths obtained by multiple measurements, and determines the average signal strength as the signal strength corresponding to the current device distance.
[0088] Step 505: store the device distance and signal strength into a standard comparison table.
[0089] Step 506, check whether all device spacings have completed the test. If all have completed the test, then end; if not, then execute step 503.
[0090] 2. Generate a first comparison table corresponding to the first device.
[0091] Unlike when generating a standard comparison table, the first standard device is used to receive the wireless signal sent by the second standard device. When generating the first comparison table, it is necessary to use the first device to receive the wireless signal sent by the second standard device, so that the signal strength measured by the first device is used as the signal strength corresponding to the device distance in the first comparison table.
[0092] Optionally, when generating the first comparison table, the signal strength at all device spacings may be measured, or, based on the actual device spacing detection requirements of the first device, only the signal strength at some key device spacings may be measured, and the signal strength at other device spacings may be obtained through function fitting.
[0093] In an illustrative example, the corresponding relationship between the device distance and the signal strength in the first comparison table is shown in Table 2. (Only the signal strength at the two key device distances of 30 cm and 60 cm is measured)
[0094] Table 2
[0095] Equipment distance (cm) Signal strength (dbm) 10 Not measured 20 Not measured 30 -35 60 Not measured 100 -60
[0096] 3. Determine a first correction function based on the standard comparison table and the first comparison table.
[0097] In a possible implementation, based on the signal strengths in the standard comparison table and the first comparison table at the same device spacing, the computer device obtains a first correction function corresponding to the first device by polynomial fitting, wherein the first correction function can be expressed as y=ax+b, wherein x is the signal strength actually measured by the first device, a and b are fitting parameters, and y is the corrected signal strength.
[0098] Combining the data shown in Table 1 and Table 2, when the second device is the second standard device, after the first device inputs the measured signal strength of -35dbm into the first correction function, the corrected signal strength output by the first correction function is -30dbm; after the first device inputs the measured signal strength of -60bm into the first correction function, the corrected signal strength output by the first correction function is -50dbm; and when the signal strength input to the first correction function is between -60 and -35dbm, the corrected signal strength output by the first correction function is between -50 and -30dbm.
[0099] In a possible implementation, the process of determining the first correction function is as follows: Figure 6 shown.
[0100] Step 601: Set the second standard device to a signal sending state.
[0101] In the signal transmission state, the second standard device transmits the wireless signal with a stable signal transmission power and signal transmission interval.
[0102] Step 602: Set the first device to a signal receiving state.
[0103] In the signal receiving state, the first device receives and records the signal strength of the wireless signal.
[0104] Step 603: Adjust the device distance between the first device and the second standard device.
[0105] Step 604: Under the current device spacing, based on multiple measurement results, obtain the signal strength corresponding to the device spacing.
[0106] Optionally, in order to improve the accuracy of the measured signal strength, the first device calculates an average value of the signal strengths obtained from multiple measurements, and determines the average signal strength as the signal strength corresponding to the current device distance.
[0107] Step 605: store the device distance and signal strength into a first comparison table.
[0108] Step 606, check whether all device spacings have been tested. If all have been tested, execute step 607, if not, execute step 603.
[0109] Step 607: determine a first correction function based on the standard comparison table and the first comparison table.
[0110] Step 608: Record the corresponding relationship between the first device and the first correction function.
[0111] For different receiving devices, the developer repeats the above steps to obtain the correction functions corresponding to the different receiving devices and stores them in the server.
[0112] Step 302: measure the wireless signal sent by the second device to obtain the original signal strength.
[0113] The implementation of this step may refer to the above step 201, and this embodiment will not be described in detail here.
[0114] Step 303, based on the second device identifier contained in the wireless signal, obtain a second correction function from the local or server, the second correction function is used to correct the impact of the second device difference on the signal strength measurement, and the server stores the mapping relationship between different sending device identifiers and the correction function.
[0115] In one possible implementation, the wireless signal sent by the second device includes a second device identifier. After receiving the wireless signal, the first device first searches the local area based on the second device identifier to see whether a second correction function corresponding to the second device identifier is stored there; if found, the second correction function is obtained; if not found, the corresponding second correction function is obtained from the server based on the second device identifier request, and the second device identifier is associated with the obtained second correction function and stored locally for subsequent use.
[0116] Among them, the second device identifier can be the device model of the second device, such as a headphone model, a speaker model, a door lock model, etc. Correspondingly, the server stores the mapping relationship between the transmitting device identifiers (device models) of different transmitting devices and the correction functions.
[0117] In a possible implementation, the process of determining the second correction function may include the following steps:
[0118] 1. Generate a standard comparison table. (Refer to the process of generating the standard comparison table in the process of determining the first correction function)
[0119] 2. Generate a second comparison table corresponding to the second device.
[0120] Unlike when generating the standard comparison table, the first standard device is used to receive the wireless signal sent by the second standard device. When generating the second comparison table, the first standard device needs to be used to receive the wireless signal sent by the second device, so that the signal strength measured by the first standard device is used as the signal strength corresponding to the device distance in the second comparison table.
[0121] Optionally, when generating the second comparison table, the signal strength at all device spacings may be measured, or, based on the actual device spacing detection requirements of the second device, only the signal strength at some key device spacings may be measured, and the signal strength at other device spacings may be obtained through function fitting.
[0122] 3. Determine a second correction function based on the standard comparison table and the second comparison table.
[0123] In a possible implementation, based on the signal strengths in the standard comparison table and the second comparison table at the same device spacing, the computer device obtains a second correction function corresponding to the second device by polynomial fitting, wherein the second correction function can be expressed as y=a'x+b', wherein x is the signal strength actually measured by the second device, a' and b' are fitting parameters, and y is the corrected signal strength.
[0124] In a possible implementation, the process of determining the first correction function is as follows: Figure 7 shown.
[0125] Step 701: Set the second device to a signal sending state.
[0126] In the signal transmission state, the second device transmits a wireless signal with a stable signal transmission power and signal transmission interval.
[0127] Step 702: Set the first standard device to a signal receiving state.
[0128] In the signal receiving state, the first standard device receives and records the signal strength of the wireless signal.
[0129] Step 703: adjust the device distance between the first standard device and the second device.
[0130] Step 704: Under the current device spacing, based on multiple measurement results, obtain the signal strength corresponding to the device spacing.
[0131] Optionally, in order to improve the accuracy of the measured signal strength, the first standard device calculates an average value of the signal strengths obtained by multiple measurements, and determines the average signal strength as the signal strength corresponding to the current device distance.
[0132] Step 705: store the device distance and signal strength into a second comparison table.
[0133] Step 706, check whether all device spacings have been tested. If all have been tested, execute step 707; if not, execute step 703.
[0134] Step 707: Determine a second correction function based on the standard comparison table and the second comparison table.
[0135] Step 708: Record the corresponding relationship between the second device and the second correction function.
[0136] For different transmitting devices, the developer repeats the above steps to obtain the correction functions corresponding to the different transmitting devices and stores them in the server.
[0137] Step 304: Correct the original signal strength using the first correction function and the second correction function to obtain a corrected signal strength.
[0138] In a possible implementation, the first device first corrects the original signal strength using a first correction function to obtain an intermediate signal strength, and then corrects the intermediate signal strength using a second correction function to obtain a corrected signal strength.
[0139] Indicative, such as Figure 4As shown, in the first correction stage, the first device receives the wireless signal sent by the second device, and corrects the measured signal strength through the first correction function; in the second correction stage, the first device requests the second correction function corresponding to the second device from the server, the server searches and returns the second correction function based on the second device identifier, and the first device further corrects the signal strength obtained by correcting the first correction function through the second correction function.
[0140] Step 305: Determine the device distance between the first device and the second device based on the corrected signal strength.
[0141] The implementation of this step may refer to the above step 203, and this embodiment will not be described in detail here.
[0142] Indicative, such as Figure 4 As shown, the first device determines the device distance between itself and the second device based on the twice corrected signal strengths.
[0143] It should be noted that, in another possible implementation, the first device may also only obtain the first correction function corresponding to the first device, and correct the original signal strength by using the first correction function to obtain the corrected signal strength, which is not elaborated in this embodiment.
[0144] In this embodiment, by setting corresponding correction functions for different receiving devices and transmitting devices, and after the signal strength is actually measured, the signal strength is corrected using the correction functions corresponding to the receiving device and the transmitting device respectively, thereby improving the accuracy of device distance measurement in different device ranging scenarios (scenarios where ranging is performed between different devices).
[0145] Since the signal strength of wireless signals of different frequencies decays at different rates with distance (the higher the frequency, the faster the decay), and devices may transmit wireless signals through signals of different frequencies (for example, Bluetooth signals may be sent on any of the three Bluetooth broadcast channels, or WiFi signals may be sent on 14 2.4GHz WiFi channels), in order to further improve the accuracy of the determined device distance, in one possible implementation, before using the correction function to correct the signal strength, the first device performs channel processing on the original signal strength based on the target channel corresponding to the wireless signal, wherein the channel processing is used to correct the influence of channel differences on the signal strength decay rate.
[0146] Optionally, the first device may determine a signal strength scaling constant corresponding to the target channel, and then multiply the original signal strength by the signal strength scaling constant to correct the effect of channel differences on the signal strength attenuation rate. The corresponding relationship between the channel and the signal strength scaling constant may be pre-set at the first device.
[0147] In other possible implementations, developers may also perform data testing and collection according to different channels in advance, so as to construct different correction functions, which is not limited in this embodiment.
[0148] In IoT application scenarios, when devices sense each other, it is not necessary to be based on the specific distance between devices, but only on the distance range. For example, when a smartphone is pairing with a Bluetooth headset, as long as the Bluetooth headset is identified as being within a specific distance range (such as 30cm), the smartphone can complete the Bluetooth pairing with the Bluetooth headset; as long as the Bluetooth headset is identified as being outside the specific distance range (such as 30cm), the smartphone can cancel the Bluetooth pairing with the Bluetooth headset.
[0149] For the above application scenarios where the distance range needs to be obtained, such as Figure 8 As shown, the first device may determine the device distance in the following manner.
[0150] Step 801: determine the target impact score corresponding to the corrected signal strength.
[0151] In this embodiment, for each corrected signal strength obtained by correction, the first device determines a target impact score corresponding to the corrected signal strength, wherein the target impact score may be a positive value or a negative value, and the absolute value of the target impact score is used to characterize the degree of influence of the corrected signal strength on the device spacing determination result (the degree of influence is positively correlated with the absolute value), and a positive target impact score characterizes that the corrected signal strength has a positive impact on the device spacing determination result (the device spacing is within the target device spacing), and a negative target impact score characterizes that the corrected signal strength has a negative impact on the device spacing determination result (the device spacing is outside the target device spacing).
[0152] In a possible implementation, the first device grades the corrected signal strength, thereby determining the target impact score based on the grade of the corrected signal strength. This step may include the following steps.
[0153] 1. Obtain a mapping relationship between the m-level signal strength threshold and the impact score from a local device or a server, wherein the impact score is positively correlated with the signal strength threshold, and m is an integer greater than or equal to 2.
[0154] In a possible implementation, for the application scenario of determining whether the device spacing is within the target device spacing (or outside the target device spacing), the server is pre-set with at least two levels of mapping relationships between signal strength thresholds and impact scores, wherein the larger the signal strength threshold, the larger the corresponding impact score.
[0155] Optionally, when the mapping relationship is not stored locally, the first device requests the mapping relationship from the server (which can be obtained together with the correction function). In addition, the server can store signal strength thresholds and impact scores corresponding to different device distances, and the first device obtains the signal strength threshold and impact score corresponding to the target device distance from the server according to the target device distance.
[0156] Regarding the method for determining the signal strength threshold and the impact score, in one possible implementation, when the corrected signal strength is obtained by correcting the first correction function and the second correction function, the m-level signal strength threshold is determined based on the signal strength measurement result of the wireless signal sent by the first standard device to the second standard device at different device distances (i.e., determined based on the standard comparison table).
[0157] In some embodiments, for the application scenario of determining whether the device spacing is within the target device spacing, combined with the data shown in Table 1, as shown in Table 3, when the target device spacing is 30 cm (i.e., determining whether the device spacing is within 30 cm), the signal strength threshold "-30" corresponding to the device spacing "30 cm" is determined as the basic signal strength threshold (i.e., the second-level signal strength threshold), and the impact score for the second-level signal strength threshold is set to 100 points; the signal strength threshold "-25" corresponding to the device spacing "20 cm" is determined as the first-level signal strength threshold, and the first-level signal strength threshold is set to an impact score of 150 points that is greater than the second-level signal strength threshold; the signal strength threshold "-40" corresponding to the device spacing "40 cm" is determined as the third-level signal strength threshold, and the third-level signal strength threshold is set to an impact score of 50 points that is less than the second-level signal strength threshold.
[0158] Table 3
[0159] level Signal strength threshold (dbm) Impact score 1 -25 150 2 -30 100 3 -40 50
[0160] Of course, in addition to setting three levels of signal strength thresholds, more levels of signal strength thresholds may be set, and the lower the level of the signal strength threshold, the smaller the impact score (which may be a negative value) is set. This embodiment does not limit this.
[0161] In a possible implementation, the above-mentioned signal strength threshold and impact score are finally obtained by developers through continuous fine-tuning based on the recall rate (the probability of accurately identifying the device spacing) and the false recognition rate (the probability of incorrectly identifying the device spacing), and after applying the fine-tuned signal strength threshold and impact score, the judgment of the device spacing can meet the recall rate and false recognition rate requirements (the recall rate is higher than the first threshold, and the false recognition rate is lower than the threshold).
[0162] In a possible implementation, when the corrected signal strength is obtained by correction through the first correction function, the m-level signal strength threshold is determined based on the signal strength measurement result of the wireless signal sent by the first standard device to the second device at different device distances (i.e., determined based on the second comparison table). The signal strength threshold and the determination method of the impact score can refer to the above embodiment, and this embodiment will not be repeated here.
[0163] Optionally, the server stores signal strength thresholds and impact scores corresponding to different transmitting devices, and the first device obtains the signal strength threshold and impact score corresponding to the second device from the server according to the second device identifier.
[0164] 2. Based on the relationship between the corrected signal strength and the signal strength thresholds at each level, determine the target impact score corresponding to the corrected signal strength.
[0165] Furthermore, the first device determines the target impact score corresponding to the corrected signal strength by comparing the magnitude relationship between the corrected signal strength and the signal strength thresholds at each level. The greater the corrected signal strength, the higher the target impact score, and the greater the positive impact on the device spacing determination result; the smaller the corrected signal strength, the lower the target impact score, and the greater the negative impact on the device spacing determination result.
[0166] In one possible implementation, in response to the corrected signal strength being less than the nth level signal strength threshold and greater than the n+1th level signal strength threshold, the first device determines the impact score corresponding to the n+1th level signal strength threshold as the target impact score, where n is a positive integer less than m.
[0167] In response to the corrected signal strength being less than the mth level signal strength threshold, the target impact score corresponding to the corrected signal strength is determined to be a preset score, and the preset score is a negative score. The preset score is usually obtained by developers through testing and fine-tuning.
[0168] Combined with the data shown in Table 3, in an illustrative example, when the corrected signal strength is -20dbm, since -20dbm>the first-level signal strength threshold, the first device determines the target impact score to be 150 points; when the corrected signal strength is -28dbm, since the first-level signal strength threshold <-28dbm <the second-level signal strength threshold, the first device determines the target impact score to be 100 points.
[0169] When the corrected signal strength is -50 dBm, since -50 dBm < the third-level signal strength threshold, the first device determines that the target impact score is -200 points.
[0170] Step 802: updating the cumulative score based on the target impact score, where the cumulative score is accumulated from at least one target impact score.
[0171] In this embodiment, the first device uses the cumulative score obtained by accumulating at least one target impact score as the basis for determining the device distance determination result. Accordingly, the first device accumulates the target impact score on the basis of the current cumulative score.
[0172] In an illustrative example, if the current cumulative score is 100 points and the target impact score is 50 points, the updated cumulative score is 150 points; if the current cumulative score is 100 points and the target impact score is -200 points, the updated cumulative score is -200 points.
[0173] Step 803: determining a device distance determination result based on the accumulated scores, wherein the device distance determination result includes at least one of the device distance being within the target device distance and the device distance being outside the target device distance.
[0174] Each time the cumulative score is updated, the first device performs a device distance determination based on the updated cumulative score to obtain a device distance determination result, which is used to indicate whether the device distance is within the target device distance or outside the target device distance.
[0175] In a possible implementation, the first device obtains at least two levels of score thresholds from a local device or a server (which can be obtained together with a signal strength threshold and an impact score), and obtains a device distance determination result by comparing the size relationship between the cumulative score and each level of score thresholds.
[0176] In some embodiments, in response to the cumulative score being greater than a first score threshold, the first device determines that the device distance is within a target device distance;
[0177] In response to the cumulative score being less than the first score threshold and greater than the second score threshold, the first device determines the last device distance determination result as the current device distance determination result;
[0178] In response to the cumulative score being less than a second score threshold, it is determined that the device distance is outside the target device distance.
[0179] Optionally, the score threshold is fine-tuned by the developer through testing.
[0180] In an illustrative example, when the first score threshold is 200 points and the second score threshold is 50 points, if the cumulative score is 250 points, the first device determines that the device distance between the first device and the second device is within 30 cm; if the cumulative score is -150 points, the first device determines that the device distance between the first device and the second device is beyond 30 cm.
[0181] In this embodiment, a multi-level signal strength threshold is designed, and a corresponding impact score is set for each level of the signal strength threshold. Based on the size relationship between the corrected signal strength and the signal strength thresholds at each level, the target impact score corresponding to the corrected signal strength is determined, and the score is accumulated. Then, the device distance is determined based on the accumulated score. There is no need to use a complex distance calculation formula to calculate the specific distance, which not only ensures the accuracy of the judgment result, but also improves the speed of determining the device distance (the speed of accumulation and size judgment is much faster than the exponentiation operation).
[0182] In an exemplary embodiment, the complete process of determining the device distance based on the corrected signal strength is as follows: Fig. 9 shown.
[0183] Step 901, when a wireless signal is received, the accumulated score is initialized.
[0184] Step 902, obtaining the corrected signal strength.
[0185] Step 903, detect whether the corrected signal strength is greater than the first level signal strength threshold. If so, execute step 904; if not, execute step 905.
[0186] Step 904: determine the target impact score to be a first score.
[0187] Step 905, detect whether the corrected signal strength is greater than the second level signal strength threshold. If so, execute step 906; if not, execute step 907.
[0188] Step 906: Determine the target impact score as a second score.
[0189] Step 907, detect whether the corrected signal strength is greater than the third level signal strength threshold. If so, execute step 908, if not, execute step 909.
[0190] Step 908: Determine the target impact score as a third score.
[0191] Step 909: determine the target impact score as the fourth score.
[0192] Step 910, updating the cumulative score.
[0193] Step 911, check whether the accumulated score is greater than the first score threshold. If so, execute step 912, if not, execute step 913.
[0194] Step 912: Determine that the second device is within the distance between the target device and the second device.
[0195] Step 913, check whether the accumulated score is less than the second score threshold, if so, execute step 914, if so, execute step 915.
[0196] Step 914: determine that the second device is outside the target device range.
[0197] Step 915, maintaining the last device distance determination result.
[0198] When the above method is used to determine the device spacing, developers need to constantly fine-tune the threshold and score, which takes a long time to debug the threshold and score. In order to improve the efficiency of preliminary preparation, in another possible implementation, Fig.10 As shown, the first device may determine the device distance in the following manner.
[0199] Step 1001: Add the corrected signal strength to a signal strength pool, where the signal strength pool is used to store k corrected signal strengths that are most recently measured and corrected, where k is a positive integer greater than 1.
[0200] In this embodiment, in order to smooth the fluctuation of signal strength, the first device sets a signal strength pool, and the capacity of the signal strength pool is k, that is, it can store at most the most recent k corrected signal strengths. When there are k corrected signal strengths in the signal strength pool, the first device adopts the first-in-first-out principle to remove the corrected signal strength that first enters the signal strength pool from the signal strength pool.
[0201] Although the larger the capacity of the signal strength pool, the better the smoothing effect of the signal strength, an excessively large capacity will cause a lag in determining the device distance, so the signal strength pool is designed to store at most the corrected signal strength within the last i seconds. In an illustrative example, when the second device sends a wireless signal at an interval of 100 ms, the capacity of the signal strength pool is 30, that is, it can store the corrected signal strength within the last 3 seconds.
[0202] Step 1002 , determining an average signal strength of candidate signal strengths in a signal strength pool, where the candidate signal strengths are corrected signal strengths located in a preset position interval after being sorted based on signal strengths.
[0203] In order to smooth the fluctuation of the signal strength, in this embodiment, the first device calculates the average value and determines the average signal strength based on the corrected signal strength in the signal strength pool.
[0204] In this implementation, the first device does not average all the corrected signal strengths in the signal strength pool, but averages some of the candidate signal strengths. In one possible implementation, the first device sorts the corrected signal strengths in the signal strength pool in order of signal strength from small to large, and selects the corrected signal strengths in a preset position interval after sorting as candidate signal strengths.
[0205] Optionally, the number of candidate signal strengths is greater than or equal to one half of the number of current corrected signal strengths in the signal strength pool.
[0206] In an illustrative example, after sorting the sizes, the first device determines the first 30% to 85% of the corrected signal strengths as candidate signal strengths.
[0207] In one possible implementation, the first device may directly calculate the average value of the candidate signal strengths, thereby determining the average value as the average signal strength; or, the first device may calculate the weighted average value of the candidate signal strengths, thereby determining the weighted average value as the average signal strength, wherein the weights of different candidate signal strengths may be determined based on the signal strength measurement time (the closer the measurement time, the greater the weight), or the weights of the candidate signal strengths may be determined based on the distribution of the signal strengths (the wider the distribution, the greater the weight), which is not limited in this embodiment.
[0208] Step 1003: determining a device distance determination result based on the average signal strength, wherein the device distance determination result includes at least one of the device distance being within the target device distance and the device distance being outside the target device distance.
[0209] Each time the average signal strength is updated, the first device will perform a device distance determination based on the updated average signal strength to obtain a device distance determination result, which is used to indicate whether the device distance is within the target device distance or outside the target device distance.
[0210] In a possible implementation, the first device obtains at least two signal strength thresholds locally or from a server, and obtains a device distance determination result by comparing a magnitude relationship between an average signal strength and each signal strength threshold.
[0211] In some embodiments, in response to the average signal strength being greater than a second signal strength threshold, the first device determines that the device spacing is within a target device spacing;
[0212] In response to the average signal strength being less than the second signal strength threshold and greater than the third signal strength threshold, the first device determines the last device distance determination result as the current device distance determination result;
[0213] In response to the average signal strength being less than a third signal strength threshold, the first device determines that the device distance is outside a target device distance.
[0214] Regarding the manner of determining the second signal strength threshold and the third signal strength threshold, in a possible implementation manner, the signal strength threshold is determined based on the distribution of signal strengths at different device distances.
[0215] Among them, when the corrected signal strength is obtained by correcting with the first correction function, the distribution is determined based on the signal strength measurement result of the wireless signal sent by the first standard device to the second device at different device distances, that is, it is determined based on the distribution of signal strength at each device distance in the second comparison table.
[0216] Optionally, when generating the second comparison table corresponding to the second device, the first standard device, in addition to statistically calculating the average signal strength (as the signal strength in the second comparison table), will also record the signal strength obtained from each measurement, and analyze the distribution of signal strength at different device distances. Furthermore, the signal strength (range) with the highest distribution probability is the second signal strength threshold corresponding to the device spacing, and the signal strength (range) with the lowest distribution probability is the third signal strength threshold corresponding to the device spacing.
[0217] In an illustrative example, when generating the second comparison table, it is analyzed that when the device distance is 20cm, the probability that the signal strength is greater than -25dbm is 85%, the probability that the signal strength is greater than -30dbm and less than -25dbm is 10%, and the probability that the signal strength is less than -30dbm is 5%. Therefore, the second signal strength threshold corresponding to the device distance of 20cm is set to -25dbm (that is, when the average signal strength is greater than -25dbm, it is determined that the device distance is within 20cm); the third signal strength threshold corresponding to the device distance of 20cm is set to -30dbm (that is, when the average signal strength is less than -30dbm, it is determined that the device distance is beyond 20cm).
[0218] In another possible implementation, when the corrected signal strength is obtained by correcting the first correction function and the second correction function, the distribution is determined based on the signal strength measurement results of the wireless signal sent by the first standard device to the second standard device at different device distances, that is, it is determined based on the distribution of signal strength at each device distance in the standard comparison table. This embodiment will not be repeated here.
[0219] In the above embodiment, since the average signal strength of the signal strengths in the signal strength pool needs to be calculated when determining the device distance, there is a delay in determining the device distance (it is necessary to wait for a certain amount of data to be stored in the signal strength pool). Fig.11 As shown, the first device may determine the device distance in the following manner.
[0220] Step 1101: Add the corrected signal strength to a signal strength pool, where the signal strength pool is used to store k corrected signal strengths that are most recently measured and corrected, where k is a positive integer greater than 1.
[0221] The implementation of this step may refer to step 1001, and this embodiment will not be described in detail here.
[0222] Step 1102: In response to a most recently corrected signal strength in the signal strength pool being greater than a first signal strength threshold, determining that the device distance is within a target device distance.
[0223] The first signal strength threshold is greater than the second signal strength threshold, and is determined based on the distribution of signal strengths at different device spacings (tending to reduce the possibility of being outside the range). In a possible implementation, when at the first device spacing, the probability that the signal strength is greater than the target signal strength threshold is greater than the probability threshold, and at the second device spacing, the probability that the signal strength is greater than the target signal strength threshold is less than the probability threshold, the first signal strength threshold corresponding to the second device spacing is set to the target signal strength threshold.
[0224] In an illustrative example, when the analysis shows that the device distance is 20cm, the probability that the signal strength is greater than -30dbm is 95%; when the device distance is 30cm, the probability that the signal strength is greater than -30dbm is 40%; when the device distance is 50cm, the probability that the signal strength is greater than -30dbm is 5%. The first signal strength threshold corresponding to the device distance "30cm" can be set to -30dbm, that is, when the most recent corrected signal strength is greater than -30dbm, the first device determines that the device distance is within 30cm.
[0225] Step 1103: In response to the most recent corrected signal strength in the signal strength pool being less than the first signal strength threshold and the number of corrected signal strengths in the signal strength pool being greater than the number threshold, determine the average signal strength of the candidate signal strengths in the signal strength pool.
[0226] In one possible implementation, due to the large fluctuation in signal strength, when the number of corrected signal strengths in the signal strength pool is small, the stability of the determination result based on the average value is poor. Therefore, in order to obtain a stable determination result, the first device will calculate the average signal strength only when the number of corrected signal strengths in the signal strength pool is greater than a quantity threshold.
[0227] In an illustrative example, the quantity threshold is 3, that is, the first device will perform average signal strength calculation only when there are at least three corrected signal strengths in the signal strength pool.
[0228] Step 1104: determine a device distance determination result based on the average signal strength, where the device distance determination result includes at least one of the device distance being within the target device distance and the device distance being outside the target device distance.
[0229] The implementation of this step may refer to step 1003, and this embodiment will not be described in detail here.
[0230] Step 1105 , in response to the most recent corrected signal strength in the signal strength pool being less than the first signal strength threshold and the number of corrected signal strengths in the signal strength pool being less than the number threshold, determining the last device distance determination result as the current device distance determination result.
[0231] When the number of corrected signal strengths in the signal strength pool is less than the number threshold, the first device continues to use the last device distance determination result. When the last device distance determination result is empty, the device distance determination result is not output.
[0232] In this embodiment, by setting the first signal strength threshold and determining the magnitude relationship between the corrected signal strength and the first signal strength threshold, the device distance is quickly determined based on a single signal measurement result, thereby improving the speed of determining the device distance.
[0233] In an exemplary embodiment, the complete process of determining the device distance based on the corrected signal strength is as follows: Fig.12 shown.
[0234] Step 1201, when a wireless signal is received, initialize the signal strength pool.
[0235] Step 1202, obtaining corrected signal strength.
[0236] Step 1203: Add the corrected signal strength to the signal strength pool.
[0237] Step 1204, detect whether the most recently corrected signal strength is greater than the first signal strength threshold. If so, execute step 1205, if not, execute step 1206.
[0238] Step 1205: Determine that the second device is within the distance between the target device and the second device.
[0239] Step 1206, detect whether the number of corrected signal strengths in the signal strength pool is less than the number threshold. If so, execute step 1207, and if so, execute step 1208.
[0240] Step 1207, maintaining the last device distance determination result.
[0241] Step 1208: Calculate the average signal strength of the candidate signal strengths in the signal strength pool.
[0242] Step 1209, detect whether the average signal strength is greater than a second signal strength threshold. If so, execute step 1210; if not, execute step 1211.
[0243] Step 1210: Determine that the second device is within the target device distance.
[0244] Step 1211, detect whether the average signal strength is less than a third signal strength threshold. If so, execute step 1212; if so, execute step 1213.
[0245] Step 1212: Determine that the second device is outside the target device range.
[0246] Step 1213, maintaining the last device distance determination result.
[0247] Please refer to Fig.13 , which shows a structural block diagram of a device distance measurement device provided by an embodiment of the present application. The device can be implemented as all or part of the first device through software, hardware or a combination of both. The device includes:
[0248] The signal measuring module 1301 is used to measure the wireless signal sent by the second device to obtain the original signal strength;
[0249] A strength correction module 1302, configured to correct the original signal strength by using a correction function to obtain a corrected signal strength, wherein the correction function is used to correct the influence of differences in receiving devices and / or transmitting devices on signal strength measurement;
[0250] The distance determination module 1303 is configured to determine the device distance between the first device and the second device based on the corrected signal strength.
[0251] Optionally, the strength correction module 1302 includes:
[0252] A first strength correction unit, configured to correct the original signal strength by using a first correction function to obtain the corrected signal strength, wherein the first correction function is used to correct the influence of the first device on the signal strength measurement;
[0253] or,
[0254] The second strength correction unit is used to correct the original signal strength through a first correction function and a second correction function to obtain the corrected signal strength, wherein the first correction function is used to correct the influence of receiving the first device on the signal strength measurement, and the second correction function is used to correct the influence of the second device on the signal strength measurement.
[0255] Optionally, the first correction function is determined based on a signal strength measurement result of a wireless signal sent by a first standard device to a second standard device, and a signal strength measurement result of a wireless signal sent by the first device to the second standard device;
[0256] The second correction function is determined based on a signal strength measurement result of the first standard device on the wireless signal sent by the second standard device and a signal strength measurement result of the first standard device on the wireless signal sent by the second device.
[0257] Optionally, the device comprises:
[0258] A first acquisition module, configured to acquire the first correction function from a local device or a server based on a first device identifier of the first device, wherein the server stores a mapping relationship between different receiving device identifiers and correction functions;
[0259] The second acquisition module is used to acquire the second correction function from a local or server based on the second device identifier included in the wireless signal, and the server stores a mapping relationship between different sending device identifiers and correction functions.
[0260] Optionally, the distance determination module 1303 includes:
[0261] A score determination unit, used to determine a target impact score corresponding to the corrected signal strength;
[0262] A score updating unit, configured to update a cumulative score based on the target impact score, wherein the cumulative score is accumulated by accumulating at least one target impact score;
[0263] The first distance determination unit is configured to determine a device distance determination result based on the accumulated score, wherein the device distance determination result includes at least one of the following: the device distance is within a target device distance and the device distance is outside the target device distance.
[0264] Optionally, the score determination unit is used to:
[0265] Acquire a mapping relationship between an m-level signal strength threshold and an impact score from a local device or a server, wherein the impact score is positively correlated with the signal strength threshold, and m is an integer greater than or equal to 2;
[0266] The target impact score corresponding to the corrected signal strength is determined based on the magnitude relationship between the corrected signal strength and the signal strength thresholds at each level.
[0267] Optionally, the score determination unit is specifically used to:
[0268] In response to the corrected signal strength being less than the nth level signal strength threshold and greater than the n+1th level signal strength threshold, determining the impact score corresponding to the n+1th level signal strength threshold as the target impact score, where n is a positive integer less than m;
[0269] In response to the corrected signal strength being less than the mth level signal strength threshold, the target impact score corresponding to the corrected signal strength is determined to be a preset score, and the preset score is a negative score.
[0270] Optionally, the first distance determining unit is configured to:
[0271] In response to the cumulative score being greater than a first score threshold, determining that the device distance is within a target device distance;
[0272] In response to the cumulative score being less than the first score threshold and greater than the second score threshold, determining the last device distance determination result as the current device distance determination result;
[0273] In response to the cumulative score being less than the second score threshold, it is determined that the device distance is outside a target device distance.
[0274] Optionally, when the corrected signal strength is obtained by correction through the first correction function, the signal strength threshold of level m is determined based on a signal strength measurement result of a wireless signal sent by a first standard device to the second device at different device distances;
[0275] When the corrected signal strength is obtained by correcting the first correction function and the second correction function, the signal strength threshold of level m is determined based on a signal strength measurement result of a wireless signal sent by the first standard device to the second standard device at different device distances.
[0276] Optionally, the distance determination module 1303 includes:
[0277] An adding unit, used for adding the corrected signal strength to a signal strength pool, wherein the signal strength pool is used for storing k corrected signal strengths obtained by the most recent measurement and correction, where k is a positive integer greater than 1;
[0278] A determination unit, configured to determine an average signal strength of candidate signal strengths in the signal strength pool, wherein the candidate signal strengths are the corrected signal strengths located in a preset position interval after being sorted based on signal strengths;
[0279] The second distance determination unit is configured to determine a device distance determination result based on the average signal strength, wherein the device distance determination result includes at least one of the device distance being within a target device distance and the device distance being outside a target device distance.
[0280] Optionally, the determining unit is used to:
[0281] In response to the most recent corrected signal strength in the signal strength pool being less than a first signal strength threshold and the number of corrected signal strengths in the signal strength pool being greater than a number threshold, determining the average signal strength of the candidate signal strengths in the signal strength pool.
[0282] The device also includes:
[0283] A first determination module, configured to determine that the device distance is within a target device distance in response to the most recent corrected signal strength in the signal strength pool being greater than the first signal strength threshold;
[0284] The second determination module is used to determine the previous device distance determination result as the current device distance determination result in response to the most recent corrected signal strength in the signal strength pool being less than the first signal strength threshold and the number of corrected signal strengths in the signal strength pool being less than the number threshold.
[0285] Optionally, the second distance determining unit is configured to:
[0286] In response to the average signal strength being greater than a second signal strength threshold, determining that the device distance is within a target device distance, the second signal strength threshold being less than the first signal strength threshold;
[0287] In response to the average signal strength being less than the second signal strength threshold and greater than the third signal strength threshold, determining the last device distance determination result as the current device distance determination result;
[0288] In response to the average signal strength being less than the third signal strength threshold, it is determined that the device distance is outside a target device distance.
[0289] Optionally, the first signal strength threshold, the second signal strength threshold, and the third signal strength threshold are obtained locally or from a server, and are determined based on distribution of signal strengths at different device distances;
[0290] Wherein, when the corrected signal strength is obtained by correction through the first correction function, the distribution is determined based on a signal strength measurement result of a wireless signal sent by a first standard device to the second device at different device distances;
[0291] When the corrected signal strength is obtained by correcting the first correction function and the second correction function, the distribution is determined based on a signal strength measurement result of a wireless signal sent by the first standard device to the second standard device at different device distances.
[0292] Optionally, the corrected signal strength is obtained based on the first correction function and the second correction function;
[0293] The distance determination module 1303 further includes:
[0294] An acquisition unit, used to acquire a standard comparison table of standard device distances and standard signal strengths, wherein the standard signal strengths are obtained by measuring, by a first standard device, a wireless signal sent by a second standard device at different standard device distances;
[0295] The third distance determination unit is used to search the device distance from the comparison table based on the corrected signal strength.
[0296] Optionally, the device further comprises:
[0297] A processing module is used to perform channel processing on the original signal strength based on the target channel corresponding to the wireless signal, wherein the channel processing is used to correct the influence of channel differences on the signal strength attenuation speed.
[0298] To summarize, in an embodiment of the present application, before the first device determines the device distance between itself and the second device based on the measured original signal strength, it first uses a correction function to correct the original signal strength to eliminate the impact of differences in the receiving device and / or the transmitting device on the signal strength measurement, and then determines the device distance based on the corrected signal strength obtained by correction. Under the premise of using existing device hardware, the accuracy of the measured signal strength can be improved through signal strength correction, thereby improving the accuracy of the subsequently determined device distance.
[0299] In the above-mentioned device embodiment, the functional implementation process of each module or unit can refer to the above-mentioned method embodiment, and this embodiment will not be repeated here.
[0300] Please refer to Fig.14 , which shows a block diagram of a computer device provided by an exemplary embodiment of the present application. The computer device 1400 may be a smart phone, a tablet computer, a wearable device, etc. The computer device 1400 in the present application may include one or more of the following components: a processor 1410, a memory 1420, and a wireless communication component 1430.
[0301] The processor 1410 may include one or more processing cores. The processor 1410 uses various interfaces and lines to connect the various parts of the entire computer device 1400, and executes various functions and processes data of the computer device 1400 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1420, and calling data stored in the memory 1420. Optionally, the processor 1410 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 1410 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processor (Graphics Processing Unit, GPU), a neural network processor (Neural-network Processing Unit, NPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the touch display; the NPU is used to implement artificial intelligence (Artificial Intelligence, AI) functions; and the modem is used to process wireless communications. It is understandable that the above-mentioned modem may not be integrated into the processor 1410, but may be implemented by a separate chip.
[0302] The memory 1420 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 1420 includes a non-transitory computer-readable storage medium. The memory 1420 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 1420 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc.; the data storage area may store data (such as audio data, a phone book), etc., created according to the use of the computer device 1400.
[0303] The wireless communication component 1430 is a component for receiving and sending wireless signals, and is composed of a receiver and a transmitter. The wireless communication component 1430 can be a Bluetooth communication component, a WiFi communication component, or a UWB communication component, etc., which is not limited in this embodiment.
[0304] In addition, those skilled in the art can understand that the structure of the computer device 1400 shown in the above figures does not constitute a limitation on the computer device, and the computer device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, the computer device 1400 also includes components such as a display screen, a sensor, an audio circuit, and a power supply, which will not be described in detail here.
[0305] An embodiment of the present application further provides a computer-readable medium, which stores at least one instruction, and the at least one instruction is loaded and executed by a processor to implement the device ranging method described in the above embodiments.
[0306] The embodiment of the present application provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the device ranging method provided in various optional implementations of the above aspects.
[0307] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.
[0308] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A device ranging method, characterized in that: The method is used for a first device, and the method includes: Measuring the wireless signal sent by the second device to obtain the original signal strength; The original signal strength is corrected by a first correction function and a second correction function to obtain a corrected signal strength, wherein the correction function is used to correct the influence of the difference between the receiving device and / or the transmitting device on the signal strength measurement, the first correction function is used to correct the influence of the first device on the signal strength measurement, and the second correction function is used to correct the influence of the second device on the signal strength measurement, the first correction function is determined based on a signal strength measurement result of a wireless signal sent by the first standard device to the second standard device, and a signal strength measurement result of a wireless signal sent by the second standard device to the first device, and the second correction function is determined based on a signal strength measurement result of a wireless signal sent by the first standard device to the second standard device, and a signal strength measurement result of a wireless signal sent by the second device to the first standard device; A device separation distance between the first device and the second device is determined based on the corrected signal strength.
2. The method according to claim 1, characterized in that Before the original signal strength is corrected by the first correction function and the second correction function to obtain the corrected signal strength, the method includes: Based on the first device identifier of the first device, obtaining the first correction function from a local device or a server, wherein the server stores a mapping relationship between different receiving device identifiers and correction functions; Based on the second device identifier included in the wireless signal, the second correction function is obtained locally or from a server, and the server stores a mapping relationship between different sending device identifiers and correction functions.
3. The method according to any one of claims 1 to 2, characterized in that: The determining the device distance between the first device and the second device based on the corrected signal strength includes: Determining a target impact score corresponding to the corrected signal strength; updating a cumulative score based on the target impact score, the cumulative score being accumulated by at least one of the target impact scores; A device distance determination result is determined based on the accumulated score, the device distance determination result comprising at least one of the device distance being within a target device distance and the device distance being outside the target device distance.
4. The method according to claim 3, characterized in that The determining the target impact score corresponding to the corrected signal strength includes: Acquire a mapping relationship between an m-level signal strength threshold and an impact score from a local device or a server, wherein the impact score is positively correlated with the signal strength threshold, and m is an integer greater than or equal to 2; The target impact score corresponding to the corrected signal strength is determined based on the magnitude relationship between the corrected signal strength and the signal strength thresholds at each level.
5. The method according to claim 4, characterized in that The determining the target impact score corresponding to the corrected signal strength based on the magnitude relationship between the corrected signal strength and the signal strength thresholds at each level includes: In response to the corrected signal strength being less than the nth level signal strength threshold and greater than the n+1th level signal strength threshold, determining the impact score corresponding to the n+1th level signal strength threshold as the target impact score, where n is a positive integer less than m; In response to the corrected signal strength being less than the mth level signal strength threshold, the target impact score corresponding to the corrected signal strength is determined to be a preset score, and the preset score is a negative score.
6. The method according to claim 3, characterized in that The determining of the device distance determination result based on the cumulative score includes: In response to the cumulative score being greater than a first score threshold, determining that the device distance is within the target device distance; In response to the cumulative score being less than the first score threshold and greater than the second score threshold, determining the last device distance determination result as the current device distance determination result; In response to the cumulative score being less than the second score threshold, it is determined that the device distance is outside the target device distance.
7. The method according to claim 4, characterized in that The signal strength threshold of level m is determined based on a signal strength measurement result of a wireless signal sent by the first standard device to the second standard device at different device distances.
8. The method according to any one of claims 1 to 2, characterized in that: The determining the device distance between the first device and the second device based on the corrected signal strength includes: Adding the corrected signal strength to a signal strength pool, the signal strength pool is used to store k corrected signal strengths that are recently measured and corrected, where k is a positive integer greater than 1; Determine an average signal strength of candidate signal strengths in the signal strength pool, wherein the candidate signal strengths are the corrected signal strengths located in a preset position interval after being sorted based on signal strengths; A device distance determination result is determined based on the average signal strength, the device distance determination result comprising at least one of the device distance being within a target device distance and the device distance being outside the target device distance.
9. The method according to claim 8, characterized in that The determining the average signal strength of candidate signal strengths in the signal strength pool includes: In response to the most recent corrected signal strength in the signal strength pool being less than a first signal strength threshold, and the number of corrected signal strengths in the signal strength pool being greater than a number threshold, determining the average signal strength of the candidate signal strengths in the signal strength pool; The method further comprises: In response to the most recent corrected signal strength in the signal strength pool being greater than the first signal strength threshold, determining that the device distance is within the target device distance; In response to the most recent corrected signal strength in the signal strength pool being less than the first signal strength threshold and the number of corrected signal strengths in the signal strength pool being less than the number threshold, a previous device distance determination result is determined as a current device distance determination result.
10. The method according to claim 9, characterized in that The determining of the device distance determination result based on the average signal strength includes: In response to the average signal strength being greater than a second signal strength threshold, determining that the device distance is within the target device distance, the second signal strength threshold being less than the first signal strength threshold; In response to the average signal strength being less than the second signal strength threshold and greater than a third signal strength threshold, determining the previous device distance determination result as the current device distance determination result; In response to the average signal strength being less than the third signal strength threshold, it is determined that the device distance is outside the target device distance.
11. The method according to claim 10, characterized in that The first signal strength threshold, the second signal strength threshold, and the third signal strength threshold are obtained locally or from a server, and are determined based on the distribution of signal strengths at different device distances; The distribution is determined based on a signal strength measurement result of a wireless signal sent by the first standard device to the second standard device at different device distances.
12. The method according to any one of claims 1 to 2, characterized in that: The corrected signal strength is obtained based on the first correction function and the second correction function; The determining the device distance between the first device and the second device based on the corrected signal strength further includes: Obtaining a standard comparison table of standard device distances and standard signal strengths, where the standard signal strengths are obtained by measuring by the first standard device the wireless signal sent by the second standard device at different standard device distances; Based on the corrected signal strength, the device distance is searched from the comparison table.
13. The method according to any one of claims 1 to 2, characterized in that: Before the original signal strength is corrected by the first correction function and the second correction function to obtain the corrected signal strength, the method further includes: Based on the target channel corresponding to the wireless signal, channel processing is performed on the original signal strength, wherein the channel processing is used to correct the influence of channel differences on the signal strength attenuation speed.
14. A device distance measuring device, characterized in that: The device is used for a first device, and the device includes: A signal measuring module, used to measure the wireless signal sent by the second device to obtain the original signal strength; a strength correction module, configured to correct the original signal strength by using a first correction function and a second correction function to obtain a corrected signal strength, wherein the correction function is used to correct the influence of the difference between the receiving device and / or the transmitting device on the signal strength measurement, the first correction function is used to correct the influence of the first device on the signal strength measurement, and the second correction function is used to correct the influence of the second device on the signal strength measurement, the first correction function is determined based on the signal strength measurement result of the first standard device on the wireless signal sent by the second standard device, and the signal strength measurement result of the second standard device on the wireless signal sent by the first device, and the second correction function is determined based on the signal strength measurement result of the first standard device on the wireless signal sent by the second standard device, and the signal strength measurement result of the second device on the wireless signal sent by the first standard device; The distance determination module is used to determine the device distance between the first device and the second device based on the corrected signal strength.
15. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is used to be executed by the processor to implement the device ranging method according to any one of claims 1 to 13.
16. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, and the at least one instruction is used to be executed by a processor to implement the device ranging method according to any one of claims 1 to 13.
Citation Information
Patent Citations
Wireless signal detection method and device
CN106685543A
Location beacon-based location method, location beacon-based location device, electronic device and computer program product
CN107655479A