Distance acquisition method, device, system, storage medium and electronic device
Through time synchronization and target transmission time negotiation with external devices, the problem of low distance measurement efficiency in the existing technology is solved, efficient distance measurement between devices is achieved, and the process of sending and receiving ranging signals is simplified.
Patent Information
- Application Number
- CN202210255507.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-15
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2042-03-15
AI Technical Summary
In the existing technology, devices need to exchange ranging signal sending and receiving times multiple times, resulting in low distance measurement efficiency.
By performing time synchronization with the external device, the time difference is obtained, and the ranging signal is sent at the target sending time. The external device calculates the spatial distance based on the receiving time and time difference, reducing the number of data transmissions and improving the ranging efficiency.
The efficiency of distance measurement between devices is improved. There is no need to send the ranging signal reception time. The external device directly calculates the spatial distance, ensuring the smooth transmission and reception of ranging signals, and providing a basis for accurate measurement.
Smart Images

Figure CN114646952B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and specifically to a distance acquisition method, device, system, storage medium and electronic device. Background Art
[0002] With the rapid development of computer technology, the distance measurement between objects no longer relies on manual field measurement, but is realized by the time of signal sending and receiving. However, in the related technology, the time of sending and receiving the ranging signal needs to be exchanged between devices multiple times to realize the ranging, which is inefficient. Summary of the invention
[0003] The present application provides a distance acquisition method, device, system, storage medium and electronic device, which can improve the efficiency of distance measurement.
[0004] In a first aspect, the present application provides a distance acquisition method, which is applied to an electronic device, comprising:
[0005] Performing time synchronization with an external device to obtain a time difference between the electronic device and the external device;
[0006] Transmitting the target sending time of the ranging signal and the time difference to the external device;
[0007] Sending the ranging signal to the external device when the target sending time is reached;
[0008] Receive the spatial distance between the external device and the electronic device returned by the external device, where the spatial distance is calculated by the external device based on the ranging signal, the target sending time, the time difference, and the actual receiving time when the external device receives the ranging signal.
[0009] In a second aspect, the present application provides a distance acquisition device, applied to an electronic device, comprising:
[0010] An acquisition module, used to perform time synchronization with an external device to obtain a time difference between the electronic device and the external device;
[0011] A time information transmission module, used for transmitting the target sending time of the ranging signal and the time difference to the external device;
[0012] A ranging signal sending module, used for sending the ranging signal to the external device when the target sending time is reached;
[0013] A spatial distance receiving module is used to receive the spatial distance between the external device and the electronic device returned by the external device, wherein the spatial distance is calculated by the external device based on the ranging signal, the target sending time, the time difference and the actual receiving time when the external device receives the ranging signal.
[0014] In a third aspect, the present application provides a distance acquisition method, which is applied to an electronic device, including:
[0015] Performing time synchronization with an external device to obtain a time difference between the electronic device and the external device;
[0016] Receiving a target sending time of a ranging signal transmitted by the external device;
[0017] receiving the ranging signal sent by the external device;
[0018] The spatial distance between the electronic device and the external device is calculated according to the target sending time, the time difference, the ranging signal and the actual receiving time of the ranging signal, and the spatial distance is sent to the external device.
[0019] In a fourth aspect, the present application provides a distance acquisition device, applied to an electronic device, including:
[0020] A synchronization module, used to perform time synchronization with an external device to obtain a time difference between the electronic device and the external device;
[0021] A time information receiving module, used to receive the target sending time of the external device transmitting the ranging signal;
[0022] A ranging signal receiving module, used for receiving the ranging signal sent by the external device;
[0023] The spatial distance sending module is used to calculate the spatial distance between the electronic device and the external device according to the target sending time, the time difference, the ranging signal and the actual receiving time of receiving the ranging signal, and send the spatial distance to the external device.
[0024] In a fifth aspect, the present application provides a distance acquisition system, comprising an electronic device and an external device, wherein the electronic device is used to perform time synchronization with the external device, obtain a time difference between the electronic device and the external device, and transmit a target sending time of a ranging signal and the time difference to the external device, send the ranging signal to the external device when the target sending time is reached, and receive a spatial distance between the external device and the electronic device returned by the external device;
[0025] The external device is used to receive the ranging signal and the time difference sent by the electronic device, calculate the spatial distance between the external device and the electronic device according to the target sending time, the time difference, the ranging signal and the actual receiving time of the ranging signal, and send the spatial distance to the electronic device.
[0026] In a sixth aspect, the present application provides a storage medium having a computer program stored thereon, which, when loaded by a processor of an electronic device, executes the steps in any distance acquisition method provided in the present application.
[0027] In a seventh aspect, the present application further provides an electronic device, comprising a processor and a memory, wherein the memory stores a computer program, and the processor executes the steps of any distance acquisition method provided in the present application by loading the computer program stored in the memory.
[0028] In the present application, the time difference between the electronic device and the external device is obtained by time synchronization between the electronic device and the external device, and the time difference is further used to realize the ranging between the electronic device and the external device by sending and receiving a ranging signal. Compared with the related art, the present application does not need to send the ranging signal receiving time. The external device directly calculates the spatial distance with the electronic device according to the target sending time, the actual receiving time and the time difference, reduces the number of data transmissions, and can improve the efficiency of distance measurement between devices. Among them, by sending the target sending time of the ranging signal to the external device, it is convenient for the external device to prepare for the reception of the ranging signal according to the target sending time, ensure the smooth sending and receiving of the ranging signal, and the smooth sending and receiving of the ranging signal provides a basis for the accurate measurement of the distance between devices. Among them, by returning the calculated spatial distance to the sender of the ranging signal, the sender of the ranging signal can obtain the spatial distance between the external device after sending the ranging signal, which is convenient for the subsequent application of the spatial distance. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions in the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0030] Figure 1 is a flow chart of a distance acquisition method provided in an embodiment of the present application;
[0031] Figure 2 is a schematic diagram of interaction between an electronic device and an external device in a distance acquisition method provided in an embodiment of the present application;
[0032] Figure 3 is another flow chart of the distance acquisition method provided in an embodiment of the present application;
[0033] Figure 4 It is a schematic diagram of a specific process of time synchronization between devices and distance measurement between devices in the distance acquisition method provided in an embodiment of the present application;
[0034] Figure 5 is a schematic diagram of the data transmission process in the distance acquisition process provided by an embodiment of the present application;
[0035] Figure 6 is a schematic diagram of the structure of a distance acquisition system provided in an embodiment of the present application;
[0036] Figure 7 is a schematic diagram of the structure of a distance acquisition device provided in an embodiment of the present application;
[0037] Figure 8 is another structural schematic diagram of the distance acquisition device provided in an embodiment of the present application;
[0038] Fig. 9 It is a structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0039] It should be noted that the terms "first", "second" and "third" in this application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or modules is not limited to the listed steps or modules, but some embodiments also include steps or modules that are not listed, or some embodiments also include other steps or modules inherent to these processes, methods, products or devices.
[0040] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0041] The embodiments of the present application provide a distance acquisition method, a distance acquisition device, a distance acquisition system, a storage medium, and an electronic device, wherein the execution subject of the distance acquisition method may be the distance acquisition device provided in the embodiments of the present application, or an electronic device integrating the distance acquisition device, wherein the distance acquisition device may be implemented in hardware or software. The electronic device may be a device such as a smart phone, a tablet computer, a PDA, a laptop computer, etc. that is equipped with a processor and has data processing capabilities.
[0042] Please refer to Figure 1 , Figure 1 A flow chart of a distance acquisition method provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the distance acquisition method is applied to an electronic device, and the process of the distance acquisition method provided in the embodiment of the present application can be as follows:
[0043] 101. Perform time synchronization with an external device to obtain a time difference between the electronic device and the external device.
[0044] Among them, in the embodiment of the present application, the external device is a peer device that performs spatial distance measurement with the electronic device. By measuring the distance between the electronic device and the external device, spatial measurement of the location of the electronic device and the location of the external device can be achieved.
[0045] Among them, due to the different timing rates and operating environments of the local clocks of different devices, the timing times of different devices are different, and the embodiment of the present application can obtain the time difference between the electronic device and the external device through the time synchronization of the electronic device and the external device. Among them, the acquisition of the time difference can facilitate the subsequent acquisition of the actual propagation time of the ranging signal according to the time difference, thereby realizing the effective measurement of the spatial distance between the electronic device and the external device.
[0046] In the embodiments of the present application, the time synchronization between the electronic device and the external device can be achieved through a data transmission link. For example, by establishing a data transmission link between the electronic device and the external device, the electronic device and the external device can exchange time information with each other through the data transmission link to achieve time synchronization between the electronic device and the external device. That is, optionally, in some embodiments of the present application, the step of "synchronizing time with the external device" includes:
[0047] Establishing a data transmission link between the communication chip of the electronic device and the communication chip of the external device;
[0048] Time synchronization is performed with the external device via the data transmission link.
[0049] In the embodiment of the present application, communication chips can be provided inside the electronic device and the external device, for example, see Figure 2 , Figure 2 It is a schematic diagram of the interaction between the electronic device and the external device provided in an embodiment of the present application, wherein a data transmission link between the electronic device and the external device is established through a communication chip. For example, the communication chips can exchange address information with each other, and a data transmission link between the electronic device and the external device is established based on the address information.
[0050] Among them, after the electronic device and the external device exchange time information with each other through the data transmission link, they can each obtain the other's time information, realize time synchronization between the electronic device and the external device, and then obtain the time difference between the electronic device and the external device.
[0051] 102. Transmit the target sending time of the ranging signal and the time difference to the external device.
[0052] Among them, the ranging signal is a signal that can be sent and received. Through the sending and receiving of the ranging signal by two objects respectively, the propagation time of the ranging signal between the two objects can be obtained, and the propagation time of the ranging signal between the two objects can be used to calculate the distance between the two objects. For example, the propagation time and propagation rate of the ranging signal between the two objects can be used to calculate the moving distance of the ranging signal within the propagation time, wherein the moving distance of the ranging signal is the spatial distance between the two objects.
[0053] Among them, in the embodiment of the present application, the target sending time is the time when the ranging signal is sent. By transmitting the target sending time to the external device, after the external device receives the sending time when the electronic device sends the ranging signal, it can make preparations for receiving the ranging signal according to the sending time, so that the external device can smoothly receive the ranging signal. The smooth sending and receiving of the ranging signal can realize the accurate acquisition of the propagation time of the ranging signal, which is convenient for the subsequent measurement of the spatial distance between the electronic device and the external device.
[0054] In the embodiment of the present application, the target sending time can be determined by negotiation between the two parties. For example, the electronic device and the external device can first exchange time information, mutually determine their respective idle time, and determine the target sending time from the idle time. In the embodiment of the present application, the target sending time is after the node time during time synchronization, that is, the ranging signal is sent after the time synchronization between the electronic device and the external device, to ensure the effective acquisition of the ranging signal propagation time.
[0055] Among them, in the embodiment of the present application, by sending the time difference to the external device, after receiving the ranging signal, the external device can determine the actual time when the ranging signal is transmitted between the electronic device and the external device according to the target sending time, the actual receiving time and the time difference, thereby realizing the rapid acquisition of the actual transmission time of the ranging signal.
[0056] 103. Send the ranging signal to the external device when the target sending time is reached.
[0057] Among them, since the ranging signal is sent by the electronic device, the target sending time is based on the time of the local clock of the electronic device, that is, when the local clock of the electronic device reaches the target sending time, the electronic device sends the ranging signal and sends the ranging signal to the external device.
[0058] In the embodiment of the present application, a ranging signal may be sent or received by a ranging chip, that is, optionally, in some embodiments of the present application, the step of "sending the ranging signal to the external device when the target sending time is reached" includes:
[0059] When the target sending time is reached, the ranging signal is sent to the ranging chip of the external device through the ranging chip of the electronic device.
[0060] The ranging chip in the electronic device can send a ranging signal to an external device, and the ranging chip in the external device can receive the ranging signal sent by the ranging chip in the electronic device.
[0061] In the embodiments of the present application, the communication chip may be different from the ranging chip. For example, in some embodiments of the present application, the communication chip and the ranging chip send and receive different types of signals.
[0062] Among them, the different types of signals sent and received can clearly distinguish between time synchronization tasks and distance measurement tasks. For example, one type of signal is used to establish a data transmission link for time synchronization, while another type of signal is used for distance calculation to avoid signal confusion interfering with the distance measurement results.
[0063] For example, in an embodiment of the present application, the communication chip includes at least one of a Bluetooth chip, a ZigBee protocol chip, a wireless fidelity network chip, an ultra-wideband chip, or a near-field communication chip; the ranging chip includes at least one of an ultrasonic ranging chip, an electromagnetic wave ranging chip, or an audio chip. For example, a data transmission link is established between an electronic device and an external device through Bluetooth, and then time synchronization is performed between the electronic device and the external device based on the data transmission link, and the calculation of the spatial distance between the electronic device and the external device is realized by sending and receiving ultrasonic waves. Among them, in order to calculate the spatial distance between the electronic device and the external device by sending and receiving ultrasonic signals, ultrasonic ranging chips can be set on the electronic device and the external device to send and receive ultrasonic signals.
[0064] Among them, in the embodiments of the present application, the audio chip is an audio device component that comes with the electronic device and the external device. When the audio device component can send and receive corresponding signals (such as ultrasonic signals), the sending and receiving of corresponding signals can be realized directly through the audio device components on the electronic device and the external device without the need to additionally configure the corresponding ranging chip.
[0065] Among them, in the embodiment of the present application, the ranging chip corresponds to the audio module. For example, in the embodiment of the present application, a ranging signal (such as an ultrasonic signal) is sent to an external device through the audio module of the electronic device, and the external device receives the ranging signal (such as the ultrasonic signal sent by the corresponding electronic device) sent by the audio module in the electronic device through the audio module of the external device.
[0066] Among them, since different modules are used for sending and receiving time synchronization and ranging signals between devices, and the timing of each module is affected by factors such as the timing rate of its local clock and the operating environment, the timing of each module is different, such as Figure 2 As shown, for electronic devices, the local time of the communication chip in the electronic device also has a timing difference with the audio time of the ranging chip in the electronic device; for external devices, the local time of the communication chip in the external device also has a timing difference with the audio time of the ranging chip in the external device.
[0067] However, in order to obtain the propagation time of the ranging signal, it is necessary to clarify the sending time of the audio module that sends the ranging signal in the electronic device and the receiving time of the ranging signal in the external device. However, since there is a time difference in the timing of the audio modules of the two devices, it is necessary to remove the influence of the time difference to obtain the accurate propagation time of the ranging signal.
[0068] For example, see Figure 2Since the sending and receiving of the ranging signal is completed by the audio module (corresponding ranging chip), the time difference between the electronic device and the external device is the time difference for the timing of the audio module. Since the communication chip is used for time synchronization in the embodiment of the present application, it is necessary to determine the time difference for the timing of the audio module between the electronic device and the external device according to the time difference between the timing of the two communication chips and the time difference between the communication chip and the audio module in each device. That is, optionally, in some embodiments of the present application, the step of "obtaining the time difference between the electronic device and the external device" includes:
[0069] Obtaining a local time difference according to the local time of the communication chip of the electronic device and the local time of the communication chip of the external device;
[0070] Obtaining a first communication audio time difference according to the local time of the communication chip of the electronic device and the audio time of the ranging chip of the electronic device;
[0071] Obtaining a second communication audio time difference according to the local time of the communication chip of the external device and the audio time of the ranging chip of the external device;
[0072] The time difference between the electronic device and the external device is obtained according to the local time difference, the first communication audio time difference and the second communication audio time difference.
[0073] Among them, in the embodiment of the present application, the local time is the timing time of the communication chip, and the audio time is the timing time of the ranging chip.
[0074] Among them, the time difference between the two devices in the audio module timing can be obtained through the local time difference between the two communication chips and the timing time difference between the communication chip and the ranging chip in each device. For example, when the timing time difference between the local time of the electronic device and the local time of the external device is 100ms, the timing time difference between the local time and the audio time in the electronic device is 100ms, and the timing time difference between the local time and the audio time in the external device is 200ms, then the timing time difference between the audio time of the electronic device and the external device is 400ms (i.e. 100ms+100ms+200ms).
[0075] 104. Receive a spatial distance between the external device and the electronic device returned by the external device, where the spatial distance is calculated by the external device according to the ranging signal, the target sending time, the time difference, and the actual receiving time when the external device receives the ranging signal.
[0076] Among them, since the external device has obtained the sending time, receiving time, time difference and type of the ranging signal after receiving the ranging signal, the external device can directly calculate the spatial distance between the external device and the electronic device based on the sending time, receiving time, time difference and ranging signal of the ranging signal, thereby speeding up the calculation of the spatial distance between the electronic device and the external device.
[0077] Among them, the electronic device realizes the acquisition of the spatial distance by the party sending the ranging signal by receiving the spatial distance between the external device and the electronic device returned by the external device, which is convenient for the application of the spatial distance by the party sending the ranging signal. For example, in actual applications, the user can send a ranging signal to the external device through the electronic device, and directly receive the spatial distance returned by the external device, so that the user can directly obtain the distance between the user and the external device through the electronic device, realize remote measurement of the distance between objects, and do not need manual field measurement, thereby improving the ranging efficiency.
[0078] Among them, the embodiment of the present application synchronizes the time between the electronic device and the external device to obtain the time difference between the electronic device and the external device, and further utilizes the time difference to realize the ranging between the electronic device and the external device by sending and receiving a ranging signal. Compared with the related art, the present application does not need to send the ranging signal receiving time. The external device directly calculates the spatial distance with the electronic device according to the target sending time, the actual receiving time and the time difference, reduces the number of data transmissions, and can improve the efficiency of the distance measurement between devices. Among them, by sending the target sending time of the ranging signal to the external device, it is convenient for the external device to prepare for the reception of the ranging signal according to the target sending time, ensure the smooth sending and receiving of the ranging signal, and the smooth sending and receiving of the ranging signal provides a basis for the accurate measurement of the distance between the devices. Among them, by returning the calculated spatial distance to the sender of the ranging signal, the sender of the ranging signal can obtain the spatial distance between the external device after sending the ranging signal, which is convenient for the subsequent application of the spatial distance.
[0079] Please refer to Figure 3 , Figure 3 is another flow chart of the distance acquisition method provided in an embodiment of the present application. The distance acquisition method is applied to an electronic device. The flow chart of the distance acquisition method provided in an embodiment of the present application may be as follows:
[0080] 201. Perform time synchronization with an external device to obtain a time difference between the electronic device and the external device.
[0081] Among them, in the embodiment of the present application, the external device is a peer device that performs spatial distance measurement with the electronic device. By measuring the distance between the electronic device and the external device, spatial measurement of the location of the electronic device and the location of the external device can be achieved.
[0082] Among them, due to the different timing rates and operating environments of the local clocks of different devices, the timing times of different devices are different, and the embodiment of the present application can obtain the time difference between the electronic device and the external device through the time synchronization of the electronic device and the external device. Among them, the acquisition of the time difference can facilitate the subsequent acquisition of the actual propagation time of the ranging signal according to the time difference, thereby realizing the effective measurement of the spatial distance between the electronic device and the external device.
[0083] 202. Receive a target sending time of a ranging signal transmitted by the external device.
[0084] Among them, the ranging signal is a signal that can be sent and received. Through the sending and receiving of the ranging signal by two objects respectively, the propagation time of the ranging signal between the two objects can be obtained, and the propagation time of the ranging signal between the two objects can be used to calculate the distance between the two objects. For example, the propagation time and propagation rate of the ranging signal between the two objects can be used to calculate the moving distance of the ranging signal within the propagation time, wherein the moving distance of the ranging signal is the spatial distance between the two objects.
[0085] Among them, in the embodiment of the present application, the target sending time is the time when the ranging signal is sent. By receiving the target sending time sent by the external device before sending the ranging signal, preparation for receiving the ranging signal can be made according to the target sending time, so as to smoothly receive the ranging signal sent by the external device. The smooth reception of the ranging signal can realize the acquisition of the ranging signal reception time, and further realize the calculation of the ranging signal propagation time, so as to facilitate the subsequent measurement of the spatial distance between the electronic device and the external device.
[0086] In the embodiment of the present application, the target sending time can be determined by negotiation between the two parties. For example, the electronic device and the external device can first exchange time information, mutually determine their respective idle time, and determine the target sending time from the idle time. In the embodiment of the present application, the target sending time is after the node time during time synchronization, that is, the ranging signal is sent after the time synchronization between the electronic device and the external device, to ensure the smooth reception of the ranging signal.
[0087] 203. Receive the ranging signal sent by the external device.
[0088] By receiving the ranging signal sent by the external device, the time when the ranging signal is received can be used as the actual receiving time, wherein the acquisition of the actual receiving time facilitates the calculation of the subsequent ranging signal propagation time.
[0089] Since the ranging signal is received by the electronic device, the actual receiving time is based on the clock timing of the electronic device. Considering the time difference between the electronic device and the external device, the propagation time of the ranging signal needs to be calculated based on the target sending time of the ranging signal, the actual receiving time and the time difference.
[0090] 204. Calculate the spatial distance between the electronic device and the external device according to the target sending time, the time difference, the ranging signal, and the actual receiving time of the ranging signal, and send the spatial distance to the external device.
[0091] Among them, since the electronic device has obtained the sending time, receiving time, time difference and type of the ranging signal after receiving the ranging signal, the electronic device can directly calculate the spatial distance between the electronic device and the external device based on the sending time, receiving time, time difference and ranging signal of the ranging signal, thereby speeding up the calculation of the spatial distance between the electronic device and the external device.
[0092] Among them, the electronic device returns the spatial distance between itself and the external device to the external device, so that the external device can directly obtain the spatial distance between itself and the electronic device after sending the ranging signal, which facilitates the sender of the ranging signal to obtain and apply the spatial distance.
[0093] Among them, in the embodiment of the present application, since the ranging signal will be affected by the external environment during the propagation process, therefore, when calculating the spatial distance between the electronic device and the external device according to the propagation time and the ranging signal, the spatial distance can also be calculated according to the attenuation coefficient of the ranging signal during the propagation process, so as to improve the accuracy of the spatial distance measurement, that is, optionally, in some embodiments of the present application, the step of "calculating the spatial distance between the electronic device and the external device according to the target sending time, the time difference, the ranging signal and the actual receiving time of receiving the ranging signal" includes:
[0094] determining a propagation attenuation coefficient of the ranging signal;
[0095] The spatial distance between the electronic device and the external device is calculated according to the target sending time, the time difference, the propagation attenuation coefficient and the actual receiving time of the ranging signal.
[0096] In the embodiment of the present application, the propagation attenuation coefficient can be obtained through multiple experiments. Based on different external environments, the propagation attenuation coefficient is different. In the embodiment of the present application, the specific value and acquisition method of the propagation attenuation coefficient are not limited.
[0097] Among them, in the embodiments of the present application, when calculating the spatial distance between the electronic device and the external device, the accuracy of the spatial distance measurement between the devices can also be improved by verification, that is, optionally, in some embodiments of the present application, the step of "calculating the spatial distance between the electronic device and the external device according to the target sending time, the time difference, the ranging signal, and the actual receiving time of receiving the ranging signal" includes:
[0098] Demodulating the ranging signal to obtain device identification information;
[0099] If the device identification information is preset device identification information, the spatial distance between the electronic device and the external device is calculated according to the target sending time, the time difference, the ranging signal and the actual receiving time when the ranging signal is received.
[0100] Among them, by verifying the device identification information in the ranging signal, it can be determined whether the sender of the ranging signal is a pre-set device. For example, in an embodiment of the present application, the preset device identification information is the identification information of a device that has pre-established authorization with the electronic device. The authorization operation can ensure the reliability, security and effectiveness of the source of the ranging signal.
[0101] Among them, in the embodiment of the present application, the other device that establishes the data communication link can be set as an authorized device. By setting the sender of the ranging signal and the other party of the data communication link to be consistent, the validity of information such as the ranging signal sending time and time difference can be ensured, which is conducive to the effective measurement of the propagation time and spatial distance.
[0102] In the embodiment of the present application, the electronic device and the external device are synchronized to determine the time difference between the electronic device and the external device, so as to calculate the effective time for the ranging signal to propagate between the electronic device and the external device according to the time difference, and to calculate the spatial distance between the electronic device and the external device according to the effective propagation time. In the embodiment of the present application, the calculated spatial distance is returned to the external device, so that the external device sending the ranging signal can directly obtain the spatial distance between the electronic device and the external device after sending the ranging signal, which is convenient for obtaining and applying the spatial distance.
[0103] See also Figure 4 , Figure 4 1 is a schematic diagram of a specific process of time synchronization between devices and distance measurement between devices provided in an embodiment of the present application, wherein the specific process of time synchronization between devices and distance measurement between devices is as follows:
[0104] 301. The electronic device and the external device first establish a connection via Bluetooth; wherein the Bluetooth connection mode may include classic Bluetooth (classic BT) or low-power Bluetooth (BLE);
[0105] 302. Aligning the Bluetooth local clocks (RTC) of the electronic device and the external device through the time synchronization mechanism of the Bluetooth link layer to obtain the time difference between the Bluetooth local time of the electronic device and the Bluetooth local time of the external device;
[0106] 303. For the electronic device, synchronize the Bluetooth local time and the audio local time in the electronic device at the microsecond (us) level through a soft bus or a hard bus, and obtain the time difference between the Bluetooth local time and the audio local time in the electronic device; similarly, obtain the time difference between the Bluetooth local time and the audio local time in the external device;
[0107] 304. Obtain the time difference between the other party's Bluetooth local time and the audio local time through Bluetooth, and obtain the audio time difference between the electronic device and the external device according to the time difference between the Bluetooth local time of the electronic device and the external device, the time difference between the Bluetooth local time and the audio time in the electronic device, and the time difference between the Bluetooth local time and the audio local time in the external device. The audio time difference is the time difference (synchronization time parameter) Tsys between the electronic device and the external device.
[0108] 305. The electronic device issues a command to send a data packet to the external device via Bluetooth, wherein the data packet includes the command information and the ultrasonic emission time information TS1;
[0109] 306. When receiving the data packet, the external device parses the data packet to obtain the instruction information and the ultrasonic emission time information TS1, and triggers the ultrasonic receiving instruction according to the ultrasonic emission time TS1 to start receiving the ultrasonic signal;
[0110] 307. When the ultrasonic emission time TS1 is reached, the electronic device sends an ultrasonic signal to the external device, and modulates the Bluetooth address information or device identification information of the electronic device through the ultrasonic wave;
[0111] 308. When the external device receives the ultrasonic signal, it records the receiving time TS2 of the ultrasonic signal, and demodulates the ultrasonic signal to obtain the Bluetooth address information or device identification information of the electronic device;
[0112] 309. When the Bluetooth address information or device identification information obtained by demodulating the ultrasonic signal by the external device is consistent with the Bluetooth address information or device identification information of the electronic device (the electronic device establishing the Bluetooth connection), the spatial distance between the electronic device and the external device is calculated according to the transmission time TS1 of the ultrasonic signal, the reception time TS2 of the ultrasonic signal, and the time difference Tsys;
[0113] 310. The external device sends the spatial distance to the electronic device to the electronic device.
[0114] In the embodiment of the present application, the spatial distance L between the electronic device and the external device can be calculated by the following formula, which specifically includes:
[0115] L=340*K*(TS2-TS1+Tsys)
[0116] Among them, K is the factor affecting the speed of sound propagation caused by external factors, that is, the propagation attenuation coefficient of ultrasonic waves when propagating between electronic equipment and external equipment; Tsys is the synchronization time parameter of the audio time of the electronic equipment and the external equipment.
[0117] Among them, by establishing a Bluetooth link between the electronic device and the external device, the exchange of Bluetooth local time and audio local time can be realized according to the Bluetooth link, and the time synchronization between the electronic device and the external device can be further realized. Through the time-synchronized electronic device and external device, the propagation time of the ranging signal between the electronic device and the external device can be effectively obtained. The acquisition of the propagation time of the ranging signal can realize the measurement of the spatial distance between the electronic device and the external device.
[0118] See also Figure 5 , Figure 5 : is a schematic diagram of a data transmission process during a distance acquisition process provided by an embodiment of the present application, wherein the data transmission process during the distance acquisition process includes the following:
[0119] 401. The electronic device sends a Bluetooth connection request to an external device;
[0120] 402. The external device establishes a Bluetooth connection link with the electronic device based on the Bluetooth connection request;
[0121] 403. The electronic device sends the local Bluetooth time of the electronic device to the external device via the Bluetooth connection link;
[0122] 404. After receiving the local Bluetooth time of the electronic device sent by the electronic device, the external device sends the local Bluetooth time of the external device to the electronic device;
[0123] 405. The electronic device sends the local audio time of the electronic device to the external device via the Bluetooth connection link;
[0124] 406. After receiving the local audio time of the electronic device sent by the electronic device, the external device sends the local audio time of the external device to the electronic device; and calculates the audio time difference (i.e., time difference Tsys) between the external device and the electronic device according to the Bluetooth local time and the audio local time of the electronic device and the Bluetooth local time and the audio local time of the external device;
[0125] 407. The electronic device sends a target sending time TS1 of a ranging signal to the external device; the external device prepares to receive an ultrasonic signal after receiving the target sending time; the electronic device prepares to transmit an ultrasonic signal;
[0126] 408. After a period of time has passed and the target transmission time TS1 is reached, the electronic device transmits an ultrasonic signal to the external device;
[0127] 409. The external device receives the ultrasonic signal and analyzes the ultrasonic signal to obtain device identification information;
[0128] 410. When the device identification information is consistent with the device identification of the electronic device, the spatial distance between the external device and the electronic device is calculated according to the target sending time TS1, the ultrasonic receiving time TS2, and the time difference Tsys;
[0129] 411. The external device sends the spatial distance between the external device and the electronic device to the electronic device.
[0130] Among them, by establishing a Bluetooth connection link between the electronic device and the external device, it is convenient to send or exchange Bluetooth local time and audio local time between the electronic device and the external device, and by exchanging Bluetooth local time and audio local time between the electronic device and the external device, the time difference between the electronic device and the external device can be calculated, which is convenient for the accurate calculation of the propagation time of the ranging signal. Among them, after receiving the ranging signal, the external device directly calculates the spatial distance with the electronic device according to the sending time, receiving time and time difference of the ranging signal, so as to realize the rapid calculation of the spatial distance, wherein the calculation of the spatial distance by the external device can avoid the calculation of the spatial distance by the electronic device side, and accordingly, the sending of the ranging signal to the electronic device at the receiving time can be avoided, the number of information sending can be reduced, and the efficiency of the spatial distance calculation can be improved. Among them, by returning the spatial distance to the electronic device, the sender of the ranging signal can directly obtain the spatial distance after sending the ranging signal, which is convenient for the application of the spatial distance. At the same time, this method of remotely calculating the spatial distance between objects also avoids manual field measurement, and improves the efficiency of distance measurement.
[0131] In order to better implement the distance acquisition method of the present application, the present application also provides a distance acquisition system based on the above distance acquisition method. The meaning of the terms in the distance acquisition device is the same as that in the above distance acquisition method, and the specific implementation details can refer to the description in the method embodiment.
[0132] See also Figure 6 , Figure 6 : is a schematic diagram of the structure of the distance acquisition system provided by the present application, wherein the distance acquisition system may include:
[0133] The electronic device 501 is used to perform time synchronization with the external device, obtain the time difference between the electronic device and the external device, transmit the target sending time of the ranging signal and the time difference to the external device, send the ranging signal to the external device when the target sending time is reached, and receive the spatial distance between the external device and the electronic device returned by the external device;
[0134] The external device 502 is used to receive the ranging signal and the time difference sent by the electronic device, calculate the spatial distance between the external device and the electronic device according to the target sending time, the time difference, the ranging signal and the actual receiving time of the ranging signal, and send the spatial distance to the electronic device.
[0135] In order to better implement the distance acquisition method of the present application, the present application also provides a distance acquisition device based on the above distance acquisition method. The meanings of the terms in the distance acquisition device are the same as those in the above distance acquisition method, and the specific implementation details can refer to the description in the method embodiment.
[0136] See also Figure 7 , Figure 7 A schematic diagram of the structure of a distance acquisition device provided in an embodiment of the present application, wherein the distance acquisition device is applied to an electronic device, and the distance acquisition device may include:
[0137] An acquisition module 601 is used to perform time synchronization with an external device to obtain a time difference between the electronic device and the external device;
[0138] A time information transmission module 602, configured to transmit the target sending time of the ranging signal and the time difference to the external device;
[0139] The ranging signal sending module 603 is used to send the ranging signal to the external device when the target sending time is reached;
[0140] The spatial distance receiving module 604 is used to receive the spatial distance between the external device and the electronic device returned by the external device, where the spatial distance is calculated by the external device based on the ranging signal, the target sending time, the time difference, and the actual receiving time when the external device receives the ranging signal.
[0141] Optionally, in an embodiment of the present application, the acquisition module 601 includes:
[0142] A link unit, used to establish a data transmission link with a communication chip of the external device through the communication chip of the electronic device;
[0143] A synchronization unit is used to perform time synchronization with the external device through the data transmission link.
[0144] Optionally, in an embodiment of the present application, the ranging signal sending module 603 includes:
[0145] The ranging signal sending unit is used to send the ranging signal to the ranging chip of the external device through the ranging chip of the electronic device when the target sending time is reached; wherein the signal types sent and received by the communication chip and the ranging chip are different.
[0146] Optionally, in some embodiments of the present application, the communication chip includes at least one of a Bluetooth chip, a ZigBee protocol chip, a wireless fidelity network chip, an ultra-wideband chip or a near-field communication chip, and the ranging chip includes at least one of an ultrasonic ranging chip, an electromagnetic wave ranging chip or an audio chip.
[0147] Optionally, in some embodiments of the present application, the acquisition module 601 includes:
[0148] A first acquisition unit, configured to obtain a local time difference according to a local time of a communication chip of the electronic device and a local time of a communication chip of the external device;
[0149] A second acquiring unit, configured to obtain a first communication audio time difference according to a local time of a communication chip of the electronic device and an audio time of a ranging chip of the electronic device;
[0150] a third acquiring unit, configured to obtain a second communication audio time difference according to the local time of the communication chip of the external device and the audio time of the ranging chip of the external device;
[0151] The fourth acquisition unit is used to obtain the time difference between the electronic device and the external device according to the local time difference, the first communication audio time difference and the second communication audio time difference.
[0152] See also Figure 8 , Figure 8 is another structural schematic diagram of a distance acquisition device provided in an embodiment of the present application, wherein the distance acquisition device is applied to an electronic device, and the distance acquisition device may include:
[0153] A synchronization module 701 is used to perform time synchronization with an external device to obtain a time difference between the electronic device and the external device;
[0154] The time information receiving module 702 is used to receive the target sending time of the external device transmitting the ranging signal;
[0155] The ranging signal receiving module 703 is used to receive the ranging signal sent by the external device;
[0156] The spatial distance sending module 704 is used to calculate the spatial distance between the electronic device and the external device according to the target sending time, the time difference, the ranging signal and the actual receiving time of receiving the ranging signal, and send the spatial distance to the external device.
[0157] Optionally, in some embodiments of the present application, the spatial distance sending module 704 includes:
[0158] A determination unit, configured to determine a propagation attenuation coefficient of the ranging signal;
[0159] The first calculation unit is used to calculate the spatial distance between the electronic device and the external device according to the target sending time, the time difference, the propagation attenuation coefficient and the actual receiving time of the ranging signal.
[0160] Optionally, in some embodiments of the present application, the spatial distance sending module 704 further includes:
[0161] A demodulation unit, used to demodulate the ranging signal to obtain device identification information;
[0162] The second calculation unit is used to calculate the spatial distance between the electronic device and the external device according to the target sending time, the time difference, the ranging signal and the actual receiving time of the ranging signal if the device identification information is preset device identification information.
[0163] It should be noted that the distance acquisition device provided in the embodiment of the present application and the distance acquisition method in the above embodiment belong to the same concept, and its specific implementation process is detailed in the above related embodiments and will not be repeated here.
[0164] The present application embodiment provides a storage medium on which a computer program is stored. When the computer program stored therein is executed on a processor of an electronic device provided in the present application embodiment, the processor of the electronic device executes any of the steps in the above distance acquisition method suitable for the electronic device. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0165] The present application also provides an electronic device. Fig. 9 , the electronic device 800 includes a processor 810 and a memory 820 .
[0166] The processor 810 in the embodiment of the present application may be a general-purpose processor, such as an ARM architecture processor.
[0167] The memory 820 stores a computer program, which may be a high-speed random access memory or a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 820 may also include a memory controller to provide the processor 810 with access to the memory 820. The processor 810 executes any of the above distance acquisition methods by executing the computer program in the memory 820, such as:
[0168] Performing time synchronization with an external device to obtain a time difference between the electronic device and the external device;
[0169] Transmitting the target sending time of the ranging signal and the time difference to the external device;
[0170] Sending the ranging signal to the external device when the target sending time is reached;
[0171] Receive the spatial distance between the external device and the electronic device returned by the external device, where the spatial distance is calculated by the external device based on the ranging signal, the target sending time, the time difference, and the actual receiving time when the external device receives the ranging signal.
[0172] The above is a detailed introduction to a distance acquisition method, device, system, storage medium and electronic device provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A distance acquisition method, applied to electronic equipment, characterized in that: include: Perform time synchronization with an external device to obtain a time difference between the electronic device and the external device, and obtain a local time difference according to the local time of the communication chip of the electronic device and the local time of the communication chip of the external device; obtain a first communication audio time difference according to the local time of the communication chip of the electronic device and the audio time of the ranging chip of the electronic device; obtain a second communication audio time difference according to the local time of the communication chip of the external device and the audio time of the ranging chip of the external device; obtain the time difference between the electronic device and the external device according to the local time difference, the first communication audio time difference and the second communication audio time difference; the communication chip of the electronic device and the communication chip of the external device both include at least one of a Bluetooth chip, a ZigBee protocol chip, a wireless fidelity network chip, an ultra-wideband chip or a near-field communication chip, and the ranging chip of the electronic device and the ranging chip of the external device both include at least one of an ultrasonic ranging chip, an electromagnetic wave ranging chip or an audio chip; Transmitting the target sending time of the ranging signal and the time difference to the external device; When the target sending time is reached, the ranging signal is sent to the external device. When the target sending time is reached, the ranging signal is sent to the ranging chip of the external device through the ranging chip of the electronic device; Receive the spatial distance between the external device and the electronic device returned by the external device, where the spatial distance is calculated by the external device based on the ranging signal, the target sending time, the time difference, and the actual receiving time when the external device receives the ranging signal.
2. The distance acquisition method according to claim 1, characterized in that: The time synchronization with the external device includes: Establishing a data transmission link between the communication chip of the electronic device and the communication chip of the external device; Performing time synchronization with the external device via the data transmission link; The communication chip of the electronic device and the ranging chip of the electronic device send and receive different types of signals, and the communication chip of the external device and the ranging chip of the external device send and receive different types of signals.
3. A distance acquisition method, applied to an electronic device, characterized in that: include: Perform time synchronization with an external device to obtain a time difference between the electronic device and the external device, and obtain a local time difference according to the local time of the communication chip of the electronic device and the local time of the communication chip of the external device; obtain a first communication audio time difference according to the local time of the communication chip of the electronic device and the audio time of the ranging chip of the electronic device; obtain a second communication audio time difference according to the local time of the communication chip of the external device and the audio time of the ranging chip of the external device; obtain the time difference between the electronic device and the external device according to the local time difference, the first communication audio time difference and the second communication audio time difference; the communication chip of the electronic device and the communication chip of the external device both include at least one of a Bluetooth chip, a ZigBee protocol chip, a wireless fidelity network chip, an ultra-wideband chip or a near-field communication chip, and the ranging chip of the electronic device and the ranging chip of the external device both include at least one of an ultrasonic ranging chip, an electromagnetic wave ranging chip or an audio chip; Receiving a target sending time of a ranging signal transmitted by the external device; receiving the ranging signal sent by the external device, and sending the ranging signal to the ranging chip of the electronic device through the ranging chip of the external device when the target sending time is reached; The spatial distance between the electronic device and the external device is calculated according to the target sending time, the time difference, the ranging signal and the actual receiving time of the ranging signal, and the spatial distance is sent to the external device.
4. The distance acquisition method according to claim 3, characterized in that: The calculating the spatial distance between the electronic device and the external device according to the target sending time, the time difference, the ranging signal, and the actual receiving time of the ranging signal includes: determining a propagation attenuation coefficient of the ranging signal; The spatial distance between the electronic device and the external device is calculated according to the target sending time, the time difference, the propagation attenuation coefficient and the actual receiving time of the ranging signal.
5. The distance acquisition method according to claim 3, characterized in that: The calculating the spatial distance between the electronic device and the external device according to the target sending time, the time difference, the ranging signal, and the actual receiving time of the ranging signal includes: Demodulating the ranging signal to obtain device identification information; If the device identification information is preset device identification information, the spatial distance between the electronic device and the external device is calculated according to the target sending time, the time difference, the ranging signal and the actual receiving time when the ranging signal is received.
6. A distance acquisition system, comprising an electronic device and an external device, characterized in that: The electronic device is used to perform time synchronization with the external device to obtain a time difference between the electronic device and the external device, wherein a local time difference is obtained according to a local time of a communication chip of the electronic device and a local time of a communication chip of the external device; a first communication audio time difference is obtained according to the local time of the communication chip of the electronic device and an audio time of a ranging chip of the electronic device; a second communication audio time difference is obtained according to the local time of the communication chip of the external device and an audio time of the ranging chip of the external device; and a time difference between the electronic device and the external device is obtained according to the local time difference, the first communication audio time difference and the second communication audio time difference. the time difference between the electronic device and the external device, the communication chip of the electronic device and the communication chip of the external device both include at least one of a Bluetooth chip, a ZigBee protocol chip, a Wi-Fi network chip, an ultra-wideband chip or a near-field communication chip, and the ranging chip of the electronic device and the ranging chip of the external device both include at least one of an ultrasonic ranging chip, an electromagnetic wave ranging chip or an audio chip; and transmit the target sending time and the time difference of the ranging signal to the external device, and when the target sending time is reached, send the ranging signal to the ranging chip of the external device through the ranging chip of the electronic device, and receive the spatial distance between the external device and the electronic device returned by the external device; The external device is used to receive the ranging signal and the time difference sent by the electronic device, calculate the spatial distance between the external device and the electronic device according to the target sending time, the time difference, the ranging signal and the actual receiving time of the ranging signal, and send the spatial distance to the electronic device.
7. A distance acquisition device, applied to electronic equipment, characterized in that: include: An acquisition module, used for performing time synchronization with an external device to obtain a time difference between the electronic device and the external device, wherein a local time difference is obtained according to a local time of a communication chip of the electronic device and a local time of a communication chip of the external device; a first communication audio time difference is obtained according to the local time of the communication chip of the electronic device and an audio time of a ranging chip of the electronic device; a second communication audio time difference is obtained according to the local time of the communication chip of the external device and an audio time of the ranging chip of the external device; a time difference between the electronic device and the external device is obtained according to the local time difference, the first communication audio time difference and the second communication audio time difference; the communication chip of the electronic device and the communication chip of the external device both include at least one of a Bluetooth chip, a ZigBee protocol chip, a wireless fidelity network chip, an ultra-wideband chip or a near-field communication chip, and the ranging chip of the electronic device and the ranging chip of the external device both include at least one of an ultrasonic ranging chip, an electromagnetic wave ranging chip or an audio chip; A time information transmission module, used for transmitting the target sending time of the ranging signal and the time difference to the external device; a ranging signal sending module, configured to send the ranging signal to the external device when the target sending time is reached, and to send the ranging signal to the ranging chip of the external device through the ranging chip of the electronic device when the target sending time is reached; A spatial distance receiving module is used to receive the spatial distance between the external device and the electronic device returned by the external device, where the spatial distance is calculated by the external device based on the ranging signal, the target sending time, the time difference, and the actual receiving time when the external device receives the ranging signal.
8. A distance acquisition device, applied to electronic equipment, characterized in that: include: A synchronization module, used for performing time synchronization with an external device, obtaining a time difference between the electronic device and the external device, obtaining a local time difference according to a local time of a communication chip of the electronic device and a local time of a communication chip of the external device; obtaining a first communication audio time difference according to the local time of the communication chip of the electronic device and an audio time of a ranging chip of the electronic device; obtaining a second communication audio time difference according to the local time of the communication chip of the external device and an audio time of the ranging chip of the external device; obtaining a time difference between the electronic device and the external device according to the local time difference, the first communication audio time difference and the second communication audio time difference; the communication chip of the electronic device and the communication chip of the external device both include at least one of a Bluetooth chip, a ZigBee protocol chip, a wireless fidelity network chip, an ultra-wideband chip or a near-field communication chip, and the ranging chip of the electronic device and the ranging chip of the external device both include at least one of an ultrasonic ranging chip, an electromagnetic wave ranging chip or an audio chip; A time information receiving module, used to receive the target sending time of the external device transmitting the ranging signal; a ranging signal receiving module, configured to receive the ranging signal sent by the external device, and when the target sending time is reached, send the ranging signal to the ranging chip of the electronic device through the ranging chip of the external device; The spatial distance sending module is used to calculate the spatial distance between the electronic device and the external device according to the target sending time, the time difference, the ranging signal and the actual receiving time of receiving the ranging signal, and send the spatial distance to the external device.
9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is loaded by a processor of an electronic device, the steps of the distance acquisition method according to any one of claims 1 to 5 are executed.
10. An electronic device, comprising a processor and a memory, wherein the memory stores a computer program, wherein: The processor executes the steps in the distance acquisition method according to any one of claims 1 to 5 by loading the computer program.
