Distance acquisition method, device, equipment, system, storage medium and product
By collaboratively broadcasting ranging signals carrying clock synchronization errors between electronic devices and using the clock synchronization errors to calculate spatial distances, the problem of insufficient ranging accuracy in the existing technology is solved and high-precision distance acquisition is achieved.
Patent Information
- Application Number
- CN202410333985.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-21
- Publication Date
- 2025-09-23
AI Technical Summary
Existing distance measurement methods based on signal interaction between electronic devices have insufficient accuracy, especially when using the difference in Wi-Fi signal strength to determine distance, the error is large.
By broadcasting a first ranging signal carrying a clock synchronization error at a first timestamp of the first electronic device and broadcasting a second ranging signal at a second timestamp, the clock synchronization error is used to coordinate the broadcast signals, and the second electronic device calculates the spatial distance based on the received timestamp and synchronization error.
The accuracy of distance measurement is improved, high-precision distance acquisition is achieved, and distance measurement errors are reduced.
Smart Images

Figure CN120692519A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a distance acquisition method, device, equipment, system, storage medium and product. Background Art
[0002] At present, there are more and more scenarios where distance measurement is required between two electronic devices. With the development of communication technology, distance measurement has been transformed from manual field measurement to distance measurement based on signal interaction between two electronic devices.
[0003] In the related art, a scheme for implementing ranging based on information interaction between two electronic devices is as follows: a first electronic device sends a Wireless Fidelity (WiFi) signal, a second electronic device receives the WiFi signal, and determines the received signal strength indication (RSSI) of the received WiFi signal. The difference between the RSSI of the received WiFi signal and the transmission power of the WiFi signal sent by the first electronic device is determined, and the distance between the first electronic device and the second electronic device is determined based on the difference. Summary of the Invention
[0004] The embodiments of the present application provide a distance acquisition method, apparatus, device, system, storage medium, and product that can improve the accuracy of spatial distance acquisition. The technical solution is as follows:
[0005] In one aspect, a distance acquisition method is provided. The method is performed by a first electronic device, the first electronic device including a first communication module and a second communication module. The method includes:
[0006] broadcasting a first ranging signal at a first timestamp by the first communication module, where the first ranging signal carries a clock synchronization error, where the clock synchronization error is a time difference between a clock of the first communication module and a clock of the second communication module;
[0007] When a second timestamp is reached, broadcasting a second ranging signal through the second broadcast system, where the second timestamp is a timestamp after the first timestamp has passed the clock synchronization error;
[0008] Receive the spatial distance between the first electronic device and the second electronic device returned by the second electronic device, where the spatial distance is determined by the second electronic device based on a third timestamp, a fourth timestamp, and the clock synchronization error, the third timestamp being a timestamp at which the second electronic device receives the first ranging signal, and the fourth timestamp being a timestamp at which the second electronic device receives the second ranging signal.
[0009] In another aspect, a distance acquisition method is provided. The method is performed by a second electronic device, where the second electronic device includes a third communication module and a fourth communication module. The third communication module is of the same type as the first communication module of the first electronic device, and the fourth communication module is of the same type as the second communication module of the first electronic device. The method includes:
[0010] When the first ranging signal broadcast by the first communication module is received through the third communication module, determining a third timestamp of receipt of the first ranging signal through the clock of the third communication module, and obtaining a clock synchronization error carried by the first ranging signal, where the clock synchronization error is a time difference between the clock of the first communication module and the clock of the second communication module;
[0011] When a second ranging signal broadcast by the second communication module is received through the fourth communication module, determining a fourth timestamp of receiving the second ranging signal through a clock of the fourth communication module;
[0012] Based on the third timestamp, the fourth timestamp, and the clock synchronization error, a spatial distance between the first electronic device and the second electronic device is determined, and the spatial distance is sent to the first electronic device.
[0013] In another aspect, a distance acquisition device is provided. The device is applied to a first electronic device, the first electronic device including a first communication module and a second communication module, and the device includes:
[0014] A first broadcast module, configured to broadcast a first ranging signal at a first timestamp, where the first ranging signal carries a clock synchronization error, where the clock synchronization error is a time difference between a clock of the first communication module and a clock of the second communication module;
[0015] a second broadcast module, configured to broadcast a second ranging signal through the second broadcast system when a second timestamp is reached, where the second timestamp is a timestamp after the first timestamp exceeds the clock synchronization error;
[0016] a receiving module, configured to receive a spatial distance between the first electronic device and the second electronic device returned by the second electronic device, where the spatial distance is determined by the second electronic device based on a third timestamp, a fourth timestamp, and the clock synchronization error, the third timestamp being a timestamp at which the second electronic device receives the first ranging signal, and the fourth timestamp being a timestamp at which the second electronic device receives the second ranging signal.
[0017] In another aspect, a distance acquisition device is provided. The device is applied to a second electronic device, wherein the second electronic device includes a third communication module and a fourth communication module, wherein the third communication module is of the same type as the first communication module of the first electronic device, and the fourth communication module is of the same type as the second communication module of the first electronic device. The device includes:
[0018] a third determining module, configured to, when the first ranging signal broadcast by the first communication module is received through the third communication module, determine, using the clock of the third communication module, a third timestamp of when the first ranging signal is received, and obtain a clock synchronization error carried by the first ranging signal, where the clock synchronization error is a time difference between the clock of the first communication module and the clock of the second communication module;
[0019] a fourth determining module, configured to, when receiving the second ranging signal broadcast by the second communication module through the fourth communication module, determine a fourth timestamp of receiving the second ranging signal by using a clock of the fourth communication module;
[0020] a fifth determining module, configured to determine a spatial distance between the first electronic device and the second electronic device based on the third timestamp, the fourth timestamp, and the clock synchronization error;
[0021] A sending module is configured to send the spatial distance to the first electronic device.
[0022] On the other hand, a first electronic device is provided, comprising one or more processors and one or more memories, wherein at least one program code is stored in the one or more memories, and the at least one program code is loaded and executed by the one or more processors to implement the distance acquisition method described in any of the above implementations.
[0023] On the other hand, a second electronic device is provided, comprising one or more processors and one or more memories, wherein at least one program code is stored in the one or more memories, and the at least one program code is loaded and executed by the one or more processors to implement the distance acquisition method described in any of the above implementations.
[0024] In another aspect, a distance acquisition system is provided. The system includes a first electronic device and a second electronic device.
[0025] On the other hand, a computer-readable storage medium is provided, in which at least one program code is stored. The at least one program code is loaded and executed by a processor to implement the distance acquisition method described in any of the above implementations.
[0026] On the other hand, a computer program product is provided. The computer program product stores at least one program code, and the at least one program code is used to be executed by a processor to implement the distance acquisition method as described in any of the above implementations.
[0027] In an embodiment of the present application, the first communication module of the first electronic device broadcasts the first ranging signal at the first timestamp, and the second communication module of the first electronic device broadcasts the second ranging signal at the second timestamp, and the difference between the second timestamp and the first timestamp is the clock synchronization error of the two communication modules; therefore, the present application is equivalent to broadcasting the first ranging signal and the second ranging signal at the same time in the same clock, so that the second electronic device can accurately determine the propagation time of the second ranging signal based on the third timestamp of the first ranging signal received and the fourth timestamp of the second ranging signal received and the clock synchronization error, and then accurately determine the spatial distance between the two electronic devices based on the propagation time of the second ranging signal. That is, the present application can utilize the clock synchronization capability of the first communication module and the second communication module to achieve high-precision ranging through the coordinated broadcast signals of the first communication module and the second communication module, thereby improving the accuracy of distance acquisition. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 A schematic diagram showing an implementation environment of a distance acquisition method according to an exemplary embodiment of the present application is shown;
[0029] Figure 2 An architectural diagram of a first electronic device according to an exemplary embodiment of the present application is shown;
[0030] Figure 3 A flow chart of a distance acquisition method according to an exemplary embodiment of the present application is shown;
[0031] Figure 4 A flow chart of a distance acquisition method according to an exemplary embodiment of the present application is shown;
[0032] Figure 5 A flow chart of a distance acquisition method according to an exemplary embodiment of the present application is shown;
[0033] Figure 6 A schematic diagram of a distance acquisition method according to an exemplary embodiment of the present application is shown;
[0034] Figure 7 A flow chart of a distance acquisition method according to an exemplary embodiment of the present application is shown;
[0035] Figure 8 A schematic diagram of a distance acquisition method according to an exemplary embodiment of the present application is shown;
[0036] Figure 9 A block diagram of a distance acquisition device according to an exemplary embodiment of the present application is shown;
[0037] Figure 10 A block diagram of a distance acquisition device according to an exemplary embodiment of the present application is shown;
[0038] Figure 11 A block diagram of an electronic device according to an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0039] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0040] In this document, "plurality" refers to two or more. "And / or" describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, or B exists alone. The character " / " generally indicates an "or" relationship between the associated objects.
[0041] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the first ranging signal, second ranging signal, and time synchronization parameters involved in this application are all obtained with full authorization.
[0042] Please refer to Figure 1 , which shows a schematic diagram of an implementation environment of a distance acquisition method shown in an exemplary embodiment of the present application. Figure 1 The implementation environment includes: a first electronic device 101 and a second electronic device 102, the first electronic device 101 is a discovered device, and the second electronic device 102 is a discovering device, that is, the first electronic device 101 is discovered by the second electronic device 102, and then the spatial distance between the first electronic device 101 and the second electronic device 102 is determined, and the spatial distance is returned to the first electronic device 101.
[0043] Introduction of the first electronic device 101:
[0044] Please refer to Figure 2The first electronic device 101 includes a first communication module, a second communication module and a first ranging module; the first ranging module is used to control the first communication module and the second communication module, and the first communication module and the second communication module are respectively used to broadcast ranging signals, so that the second electronic device 102 determines the spatial distance between the first electronic device 101 and the second electronic device 102 according to the timestamp of the received ranging signal.
[0045] The first ranging module is deployed on the main processor of the first electronic device 101. For example, the main processor can be a kernel processor. Alternatively, the first ranging module can be deployed on a low-power processor of the first electronic device 101, thereby saving power. The first communication module and the second communication module are respectively deployed on their corresponding processors. In some embodiments, if the first communication module is a short-range communication module, the first communication module is deployed on the short-range processor. For example, if the short-range communication module is a Bluetooth module or a WiFi module, the Bluetooth module is deployed on the Bluetooth processor, and the WiFi module is deployed on the router. The training communication module can also be other communication modules capable of detecting radio signals. Furthermore, the first communication module can be the control unit that runs the communication components, or it can include both the main unit that runs the main components and the control unit that runs the communication components. If the second communication module is an audio communication module, the second communication module is deployed on the audio processor. The second communication module can have playback and recording functions and run audio algorithms.
[0046] In some embodiments, there is a third data synchronization interface between the first communication module and the first ranging module, the third data synchronization interface includes a third data communication interface and a third clock synchronization interface, the third data communication interface is used for data communication between the first communication module and the first ranging module, and the third clock synchronization interface is used for clock synchronization between the first communication module and the first ranging module. The clock synchronization method can be hardware synchronization or software synchronization. In the embodiment of the present application, there is no specific limitation on the different clock methods of the first communication module and the first ranging module; and the clock synchronization error of the first communication module and the first ranging module is less than 1ms or less than 500us or smaller.
[0047] In other embodiments, there is a fourth data synchronization interface between the second communication module and the first ranging module, the fourth data synchronization interface includes a fourth data communication interface and a fourth clock synchronization interface, the fourth data synchronization interface is used for data communication between the second communication module and the first ranging module, and the fourth clock synchronization interface is used for clock synchronization between the second communication module and the first ranging module. The clock synchronization method can be hardware synchronization or software synchronization. In the embodiment of the present application, there is no specific limitation on the different clock methods of the second communication module and the first ranging module; and the clock synchronization error between the second communication module and the first ranging module is less than 1ms or less than 500us or smaller.
[0048] Introduction of the second electronic device 102:
[0049] The second electronic device 102 includes a third communication module, a fourth communication module and a second ranging module; the second ranging module is used to control the third communication module and the fourth communication module, and the third communication module and the fourth communication module are used to receive the ranging signals broadcast by the first communication module and the second communication module respectively, and determine the spatial distance between the first electronic device 101 and the second electronic device 102 based on the timestamp of the received ranging signal, and return the spatial distance to the first electronic device 101.
[0050] The third communication module is of the same type as the first communication module, and the fourth communication module is of the same type as the second communication module. In some embodiments, if the first communication module is a short-range communication module, the third communication module is also a short-range communication module. For example, if the first communication module is a Bluetooth module, the third communication module is also a Bluetooth module. For another example, if the first communication module is a WiFi module, the third communication module is also a WiFi module. In other embodiments, if the second communication module is an audio communication module, the fourth communication module is also an audio communication module.
[0051] The second ranging module is deployed on the main processor of the second electronic device 102. For example, the main processor can be a kernel processor; alternatively, the second ranging module can be deployed on a low-power processor of the second electronic device 102, thereby saving power consumption of the second electronic device 102. The third communication module and the fourth communication module are respectively deployed on their corresponding processors. In some embodiments, if the third communication module is a short-range communication module, the third communication module is deployed on the short-range processor. For example, if the short-range communication module is a Bluetooth module or a Wireless Fidelity (WiFi) module, the Bluetooth module is deployed on the Bluetooth processor, and the WiFi module is deployed on the router. Furthermore, the third communication module can be a control unit that runs the communication components, or it can include a main unit that runs the main components and a control unit that runs the communication components. If the fourth communication module is an audio communication module, the fourth communication module is deployed on the audio processor; and the fourth communication module has playback and recording functions, and runs audio algorithms, etc.
[0052] In some embodiments, there is a fifth data synchronization interface between the third communication module and the second ranging module, the fifth data synchronization interface includes a fifth data communication interface and a fifth clock synchronization interface, the fifth data communication interface is used for data communication between the third communication module and the second ranging module, and the fifth clock synchronization interface is used for clock synchronization between the third communication module and the second ranging module. The clock synchronization method can be hardware synchronization or software synchronization. In the embodiment of the present application, there is no specific limitation on the different clock methods of the third communication module and the second ranging module; and the clock synchronization error between the third communication module and the second ranging module is less than 1ms or less than 500us or smaller.
[0053] In other embodiments, there is a sixth data synchronization interface between the fourth communication module and the second ranging module, the sixth data synchronization interface includes a sixth data communication interface and a sixth clock synchronization interface, the sixth data synchronization interface is used for data communication between the fourth communication module and the second ranging module, and the sixth clock synchronization interface is used for clock synchronization between the fourth communication module and the second ranging module. The clock synchronization method can be hardware synchronization or software synchronization. In the embodiment of the present application, there is no specific limitation on the different clock methods of the fourth communication module and the second ranging module; and the clock synchronization error between the fourth communication module and the second ranging module is less than 1ms or less than 500us or smaller.
[0054] The first electronic device 101 may be, but is not limited to, a smartphone, a tablet computer, a smart wearable device, or an in-vehicle electronic device. The second electronic device 102 may be, but is not limited to, a smartphone, a tablet computer, a smart wearable device, or an in-vehicle electronic device.
[0055] Please refer to Figure 3 , which shows a flow chart of a distance acquisition method shown in an exemplary embodiment of the present application. The execution subject of the embodiment of the present application may be a first electronic device, which includes a first communication module and a second communication module.
[0056] refer to Figure 3 , the method comprising:
[0057] Step 301: broadcast a first ranging signal at a first timestamp through a first communication module, where the first ranging signal carries a clock synchronization error, which is the time difference between a clock of the first communication module and a clock of a second communication module.
[0058] The first timestamp is a timestamp determined by the clock of the first communication module, that is, the first timestamp is a timestamp measured by the clock of the first communication module. In an embodiment of the present application, the clock of the second communication module is later than the clock of the first communication module as an example for explanation, then the clock synchronization error is a positive value, that is, the clock of the first communication module reaches a certain timestamp first, and the clock of the second communication module needs to pass through the clock synchronization error before it can reach the timestamp. For example, the current timestamp of the clock of the first communication module is 10:00 am, and the current timestamp of the clock of the second communication module is 9:55 am, then the clock synchronization error is 5 seconds. The above example is only for the convenience of understanding, and the clock synchronization error between the clock of the first communication module and the clock of the second communication module is often less than 1 millisecond, or 500us or less.
[0059] In some embodiments, in addition to carrying the clock synchronization error, the first ranging signal may also carry a service identifier corresponding to the second communication module, which is used to instruct the second electronic device to continue receiving the second ranging signal after receiving the first ranging signal. For example, if the second communication module is an audio communication module, and the second ranging signal broadcast by the audio communication module is an ultrasonic signal, the service identifier corresponding to the second communication module may be an ultrasonic service identifier. Accordingly, before broadcasting the first ranging signal at the first timestamp through the first communication module, the method further includes:
[0060] Determine a service identifier and a clock synchronization error corresponding to the second communication module, where the service identifier is used to instruct the second electronic device to continue receiving the second ranging signal after receiving the first ranging signal; and configure broadcast content of the first ranging signal based on the service identifier and the clock synchronization error, where the first ranging signal carries the service identifier and the clock synchronization error.
[0061] Configuration of the broadcast content of the first ranging signal may be performed by the first ranging module or by the first communication module. When configuration of the broadcast content of the first ranging signal is performed by the first ranging module, the process may be as follows: the first ranging module determines the service identifier and clock synchronization error corresponding to the second communication module, configures the broadcast content of the first ranging signal based on the service identifier and the clock synchronization error, the first ranging signal carries the service identifier and the clock synchronization error, sends the first ranging signal to the first communication module, and the first communication module broadcasts the first ranging signal at the first timestamp.
[0062] When the first communication module configures the broadcast content of the first ranging signal, the process may include: the first ranging module determines a service identifier and a clock synchronization error corresponding to the second communication module, sends the service identifier and the clock synchronization error to the first communication module, and the first communication module configures the first ranging signal based on the service identifier and the clock synchronization error. Furthermore, the first ranging module notifies the first communication module of a first timestamp for broadcasting the first ranging signal, thereby instructing the first communication module to broadcast the first ranging signal at the first timestamp.
[0063] In an embodiment of the present application, the first ranging signal also carries a service identifier corresponding to the second communication module, so that after the second electronic device receives the first ranging signal, it determines based on the service identifier that the present application is to perform ranging using ranging signals broadcast by two communication modules. Therefore, it wakes up and notifies the fourth communication module included in the second electronic device to receive the second ranging signal sent by the first communication module included in the first electronic device. As a result, the second communication module can be in a dormant state when there is no ranging requirement; and is awakened only when there is a ranging requirement, thereby reducing the power consumption of the second communication module and thereby reducing the power consumption of the second electronic device.
[0064] In other embodiments, the first ranging signal may also carry a verification identifier, which is used by the second electronic device to verify whether the first ranging signal and the second ranging signal are ranging signals of the same broadcast period; the verification identifier includes a serial number of the broadcast period, and the verification identifier may also include a random identifier, which may be generated by the first communication module, or by the second communication module, or by the first ranging module. In the embodiment of the present application, the generating entity of the random identifier is not specifically limited. Accordingly, before broadcasting the first ranging signal at the first timestamp through the first communication module, the method further includes:
[0065] Determine a verification identifier, where the verification identifier is used by the second electronic device to verify whether the first ranging signal and the second ranging signal are ranging signals of the same broadcast period; based on the verification identifier, configure the broadcast content of the first ranging signal and the broadcast content of the second ranging signal, where both the first ranging signal and the second ranging signal carry the verification identifier.
[0066] Configuration of the broadcast content of the first ranging signal may be performed by the first ranging module or by the first communication module. When configuration of the broadcast content of the first ranging signal is performed by the first ranging module, the process may be as follows: the first ranging module determines a verification identifier and a clock synchronization error, configures the broadcast content of the first ranging signal based on the verification identifier and the clock synchronization error, the first ranging signal carries the verification identifier and the clock synchronization error, sends the first ranging signal to the first communication module, and the first communication module broadcasts the first ranging signal at the first timestamp.
[0067] When the first communication module configures the broadcast content of the first ranging signal, the process may include: the first ranging module determines a verification identifier and a clock synchronization error, sends the verification identifier and the clock synchronization error to the first communication module, and the first communication module configures the first ranging signal based on the verification identifier and the clock synchronization error. Furthermore, the first ranging module notifies the first communication module of a first timestamp for broadcasting the first ranging signal, thereby instructing the first communication module to broadcast the first ranging signal at the first timestamp.
[0068] In some embodiments, the timing for configuring the broadcast content of the first ranging signal and the broadcast content of the second ranging signal may be the same or different; for example, the broadcast content of the first ranging signal may be configured before the first ranging signal is broadcast; and the broadcast content of the second broadcast signal may be configured after the first ranging signal is broadcast and before the second ranging signal is broadcast.
[0069] In an embodiment of the present application, a verification identifier is added to the first ranging signal and the second ranging signal, so that after the second electronic device receives the first ranging signal and the second ranging signal, it determines whether the two ranging signals are broadcast in the same broadcast cycle based on the verification identifier included in the two ranging signals. If the two ranging signals are broadcast in the same broadcast cycle, the spatial distance between the first electronic device and the second electronic device is determined based on the timestamps of receiving the two ranging signals, thereby improving the accuracy of the determined spatial distance.
[0070] In some other embodiments, the first ranging signal also carries a service identifier and a verification identifier corresponding to the second communication module. Accordingly, before broadcasting the first ranging signal at the first timestamp via the first communication module, the method further includes:
[0071] Determine a service identifier and a verification identifier corresponding to the second communication module, where the service identifier is used to instruct the second electronic device to continue receiving the second ranging signal after receiving the first ranging signal, and the verification identifier is used by the second electronic device to verify whether the first ranging signal and the second ranging signal are ranging signals in the same broadcast period; configure the broadcast content of the first ranging signal based on the service identifier, the verification identifier, and the clock synchronization error, where the first ranging signal carries the service identifier, the verification identifier, and the clock synchronization error.
[0072] Step 302: When a second timestamp is reached, a second ranging signal is broadcasted through a second broadcasting system. The second timestamp is a timestamp after the first timestamp has passed a clock synchronization error.
[0073] The second timestamp is determined by the clock of the second communication module, that is, the second timestamp is measured using the clock of the second communication module. The first electronic device includes a first ranging module. In some embodiments, the first ranging module controls the timestamp of transmitting the second ranging signal. Accordingly, this step may include: when the second timestamp is reached, the first ranging module notifies the second communication module to broadcast the second ranging signal.
[0074] In the embodiment of the present application, the first ranging module notifies the second communication module of the time to send the second ranging signal, so there is no need to add a first data synchronization interface between the first communication module and the second communication module, saving hardware costs.
[0075] In other embodiments, a first data synchronization interface exists between the first communication module and the second communication module, and the first data synchronization interface is used to synchronize the clock synchronization error between the first communication module and the second communication module; accordingly, this step may be: after the first communication module broadcasts the first ranging signal, a second broadcast notification is sent to the second communication module through the first data synchronization interface, and the second broadcast notification is used to notify the second communication module to broadcast the second ranging signal at a second timestamp after the current time passes the clock synchronization error, and the second communication module is used to broadcast the second ranging signal when the second timestamp is reached.
[0076] In some embodiments, the second broadcast notification carries a clock synchronization error; or the first ranging module synchronizes the clock synchronization error to the second communication module. In this embodiment of the present application, a first data synchronization interface is provided between the first communication module and the second communication module. This allows the first communication module to notify the second communication module of the timestamp of sending the second ranging signal via the first data synchronization interface, which is relatively simple to operate.
[0077] In some embodiments, the second ranging signal carries a verification identifier. Prior to this step, a second ranging signal needs to be generated. This process may include encoding the verification identifier to obtain a broadcast coded signal; and performing digital-to-analog conversion on the broadcast coded signal to obtain the second ranging signal. The second ranging signal may be generated by either the first ranging module or the second communication module. In this embodiment of the present application, the entity generating the second ranging signal is not specifically limited.
[0078] Step 303: Receive the spatial distance between the first electronic device and the second electronic device returned by the second electronic device, where the spatial distance is determined by the second electronic device based on the third timestamp, the fourth timestamp and the clock synchronization error, where the third timestamp is the timestamp when the second electronic device receives the first ranging signal, and the fourth timestamp is the timestamp when the second electronic device receives the second ranging signal.
[0079] The third communication module of the second electronic device receives the first ranging signal, and therefore, the third timestamp is a timestamp determined by the clock of the third communication module, that is, the third timestamp is a timestamp timed by the clock of the third communication module; the fourth communication module of the second electronic device receives the second ranging signal, and therefore, the fourth timestamp is a timestamp determined by the clock of the fourth communication module, that is, the fourth timestamp is a timestamp timed by the clock of the fourth communication module.
[0080] In an embodiment of the present application, the first communication module of the first electronic device broadcasts the first ranging signal at the first timestamp, and the second communication module of the first electronic device broadcasts the second ranging signal at the second timestamp, and the difference between the second timestamp and the first timestamp is the clock synchronization error of the two communication modules; therefore, the present application is equivalent to broadcasting the first ranging signal and the second ranging signal at the same time in the same clock, so that the second electronic device can accurately determine the propagation time of the second ranging signal based on the third timestamp of the first ranging signal received and the fourth timestamp of the second ranging signal received and the clock synchronization error, and then accurately determine the spatial distance between the two electronic devices based on the propagation time of the second ranging signal. That is, the present application can utilize the clock synchronization capability of the first communication module and the second communication module to achieve high-precision ranging through the coordinated broadcast signals of the first communication module and the second communication module, thereby improving the accuracy of distance acquisition.
[0081] Please refer to Figure 4, which shows a flow chart of a distance acquisition method shown in an exemplary embodiment of the present application. The execution subject of the embodiment of the present application can be a second electronic device, which includes a third communication module and a fourth communication module. The type of the third communication module is the same as the type of the first communication module of the first electronic device, and the type of the fourth communication module is the same as the type of the second communication module of the first electronic device. Figure 4 , the method comprising:
[0082] Step 401: When a first ranging signal broadcast by a first communication module is received through a third communication module, a third timestamp of when the first ranging signal is received is determined through a clock of the third communication module, and a clock synchronization error carried by the first ranging signal is obtained, where the clock synchronization error is a time difference between the clock of the first communication module and the clock of the second communication module.
[0083] The third timestamp is a timestamp determined by the clock of the third communication module, that is, the third timestamp is a timestamp timed by the clock of the third communication module.
[0084] Step 402: When a second ranging signal broadcasted by the second communication module is received through the fourth communication module, a fourth timestamp of when the second ranging signal is received is determined through the clock of the fourth communication module.
[0085] The fourth timestamp is a timestamp determined by the clock of the fourth communication module, that is, the fourth timestamp is a timestamp timed by the clock of the fourth communication module.
[0086] Step 403: Based on the third timestamp, the fourth timestamp and the clock synchronization error, determine the spatial distance between the first electronic device and the second electronic device, and send the spatial distance to the first electronic device.
[0087] This step can be performed by the second ranging module or the fourth communication module; and this step can be implemented by the following steps (1) to (3), including:
[0088] (1) Determine a propagation factor of the second ranging signal. The propagation factor is used to represent the influence of external factors on the second ranging signal.
[0089] For example, if the second ranging signal is ultrasonic wave, the propagation factor is the propagation factor of ultrasonic wave affected by external factors, that is, the propagation factor is the propagation attenuation coefficient of ultrasonic wave when propagating between the first electronic device and the second electronic device.
[0090] (2) Based on the third timestamp and the clock synchronization error, a fifth timestamp is determined, where the fifth timestamp is used to indicate a sending timestamp of the second ranging signal in the clock of the fourth communication module, a propagation speed of the first ranging signal is greater than a preset multiple of the propagation speed of the second ranging signal, and the third timestamp is used to indicate a sending timestamp of the second ranging signal in the clock of the third communication module.
[0091] The first ranging signal is sent by the first communication module, and the first communication module is a short-range communication module, for example, a Bluetooth module. In this case, the first ranging signal is a Bluetooth signal. Since Bluetooth signals propagate very quickly and the distance between the first electronic device and the second electronic device is relatively close, the time required for the Bluetooth signal to propagate can be ignored. This is equivalent to the third timestamp being the timestamp of the second ranging signal. However, the third timestamp is determined by the clock of the third communication module, while the fourth timestamp is determined by the clock of the fourth communication module. There is a clock synchronization error between the clocks of the third communication module and the fourth communication module. Therefore, the third timestamp needs to be converted into a timestamp in the clock of the fourth communication system. Accordingly, the step of determining the fifth timestamp based on the third timestamp and the clock synchronization error can be as follows: the timestamp after the third timestamp has passed the clock synchronization error is determined as the fifth timestamp.
[0092] In some embodiments, the propagation duration of the first ranging signal may also be considered; accordingly, based on the third timestamp and the clock synchronization error, the step of determining the fifth timestamp may include: advancing the third timestamp by a preset time duration, and then determining the fifth timestamp as the timestamp after the clock synchronization error has passed, where the preset time duration is the estimated propagation duration of the first ranging signal. In this embodiment of the present application, considering the propagation duration of the first ranging signal can improve the accuracy of the determined fifth timestamp, thereby improving the accuracy of the spatial distance determined based on the fifth timestamp.
[0093] (3) Determine the spatial distance based on the fifth timestamp, the fourth timestamp, the propagation speed and the propagation factor of the second ranging signal.
[0094] The time difference between the fourth time stamp and the fifth time stamp is determined, and the product of the time difference and the propagation speed and the propagation factor of the second ranging signal is determined to obtain the spatial distance between the first electronic device and the second electronic device.
[0095] For example, based on the third timestamp, the fourth timestamp, and the clock synchronization error, the spatial distance between the first electronic device and the second electronic device is determined by the following formula 1:
[0096] Formula 1: L = (T3'-T2'-Toffset)*340*K
[0097] Wherein, L is the spatial distance between the first electronic device and the second electronic device; T3' is the fourth timestamp, T2' is the third timestamp, Toffset is the synchronization clock error, 340 is the propagation speed of the second ranging signal, and K is the propagation factor.
[0098] In some embodiments, since the propagation factor is taken into account, that is, the propagation attenuation of the ultrasonic wave when propagating between the first electronic device and the second electronic device is taken into account; therefore, determining the spatial distance based on the combined propagation factor can improve the accuracy of the determined spatial distance.
[0099] In an embodiment of the present application, the first communication module of the first electronic device broadcasts the first ranging signal at the first timestamp, and the second communication module of the first electronic device broadcasts the second ranging signal at the second timestamp, and the difference between the second timestamp and the first timestamp is the clock synchronization error of the two communication modules; therefore, the present application is equivalent to broadcasting the first ranging signal and the second ranging signal at the same time in the same clock, so that the second electronic device can accurately determine the propagation time of the second ranging signal based on the third timestamp of the first ranging signal received and the fourth timestamp of the second ranging signal received and the clock synchronization error, and then accurately determine the spatial distance between the two electronic devices based on the propagation time of the second ranging signal. That is, the present application can utilize the clock synchronization capability of the first communication module and the second communication module to achieve high-precision ranging through the coordinated broadcast signals of the first communication module and the second communication module, thereby improving the accuracy of distance acquisition.
[0100] Please refer to Figure 5 , which shows a flow chart of a distance acquisition method shown in an exemplary embodiment of the present application. Figure 5 , the method comprising:
[0101] Step 501: The first electronic device starts a first distance measurement module, a first communication module and a second communication module.
[0102] In some embodiments, when the first electronic device does not have a need for ranging, the first ranging module, the first communication module, and the second communication module are all in a dormant state. When the first electronic device has a need for ranging, the first electronic device wakes up the first ranging module (i.e., activates the first ranging module). After the first ranging module is awakened, the first communication module and the second communication module are awakened, thereby saving power consumption of the first electronic device. For example, the first electronic device wakes up the first ranging module when a sensor detects a wireless signal or the signal strength of the wireless signal exceeds a preset strength.
[0103] In other embodiments, the first ranging module, the first communication module and the second communication module are always in an awake state, so that when the first electronic device has a ranging requirement, ranging can be performed directly based on the first ranging module, the first communication module and the second communication module, thereby improving the distance acquisition efficiency.
[0104] Step 502: The first electronic device configures the broadcast content of the first ranging signal through the first ranging module, and notifies the first communication module to broadcast the first ranging signal at the first timestamp. The first ranging signal carries the clock synchronization error, the service identifier corresponding to the second communication module, and the verification identifier.
[0105] The clock synchronization error is the time difference between the clock of the first communication module and the clock of the second communication module; the service identifier corresponding to the second communication module is used to instruct the second electronic device to continue to receive the second ranging signal after receiving the first ranging signal; the verification identifier is used by the second electronic device to verify whether the first ranging signal and the second ranging signal are ranging signals of the same broadcast cycle; the verification identifier includes the serial number of the broadcast cycle, and the verification identifier may also include a random identifier, which may be generated by the first communication module, the second communication module, or the first ranging module. In the embodiment of the present application, the generating entity of the random identifier is not specifically limited.
[0106] In some embodiments, the first ranging module configures and notifies the first communication module to broadcast the first ranging signal at a first timestamp. Accordingly, this step may include: the first ranging module determines a clock synchronization error, a service identifier, and a verification identifier, and sends a third broadcast notification to the first communication module, the third broadcast notification including the clock synchronization error, the service identifier, and the verification identifier, and the third broadcast notification is used to notify the first communication module to broadcast the first ranging signal at a first sending timestamp. The first communication module receives the third broadcast notification, configures the first ranging signal based on the clock synchronization error, the service identifier, and the verification identifier included in the third broadcast notification, and then broadcasts the first ranging signal at the first timestamp.
[0107] In some embodiments, the first communication module is a Bluetooth module and the second communication module is an audio communication module. Figure 6 The first ranging module configures and notifies the Bluetooth module to broadcast a Bluetooth signal at T0. The broadcast content of the Bluetooth signal includes a clock synchronization error (Toffset), a verification identifier (including a serial number and a random identifier of the broadcast period), and an ultrasonic service identifier.
[0108] Step 503: The first electronic device configures the broadcast content of the second ranging signal through the first ranging module, and notifies the second communication module to broadcast the second ranging signal at the second timestamp.
[0109] The first electronic device sends a first broadcast notification to the second communication module through the first ranging module, where the first broadcast notification is used to notify the second communication module to broadcast the second ranging signal when the second timestamp is reached; the second communication module is used to broadcast the second ranging signal when the second timestamp is reached, where the second ranging signal carries a verification identifier.
[0110] For example, please refer to Figure 6 If the second ranging signal is an ultrasonic signal, the first ranging module calls the ultrasonic algorithm to generate an ultrasonic waveform file. The file content carries the verification identifier (serial number and random identifier of the broadcast period), and then notifies the audio communication module to send an ultrasonic broadcast at T1 (T0+Toffset).
[0111] In some embodiments, the steps of broadcasting a first ranging signal at a first timestamp via the first communication module, where the first ranging signal carries a clock synchronization error, where the clock synchronization error is the time difference between the clocks of the first communication module and the second communication module; and broadcasting a second ranging signal at a second timestamp via the second broadcast system, where the second timestamp is the timestamp after the first timestamp has passed the clock synchronization error, are performed once every preset period until a preset number of executions is reached. That is, steps 501-503 are performed every preset period, where the preset number of executions can be 2 to 5, for example.
[0112] Step 504: When the second electronic device receives the first ranging signal broadcast by the first communication module through the third communication module, it determines the third timestamp of receiving the first ranging signal through the clock of the third communication module, and obtains the clock synchronization error, service identifier and verification identifier carried by the first ranging signal.
[0113] When the third communication module receives the first ranging signal, it parses the broadcast content included in the first ranging signal to obtain a clock synchronization error, a service identifier, and a verification identifier.
[0114] Step 505: When the second electronic device determines that the first ranging signal carries the service identifier, the second electronic device wakes up the fourth communication module and notifies the fourth communication module to start receiving the second ranging signal.
[0115] The third communication module included in the second electronic device wakes up the fourth communication module; and the second ranging module is also in a dormant state; accordingly, this step can be: the third communication module wakes up the second ranging module, the second ranging module wakes up the fourth communication module, and notifies the fourth communication module to start receiving the second ranging signal.
[0116] Step 506: When the second ranging signal broadcasted by the second communication module is received through the fourth communication module, the second electronic device determines a fourth timestamp of receiving the second ranging signal through the clock of the fourth communication module.
[0117] The fourth timestamp is a timestamp determined by the clock of the fourth communication module, that is, the fourth timestamp is a timestamp timed by the clock of the fourth communication module.
[0118] Step 507: The second electronic device obtains the verification identifier carried by the first ranging signal and the verification identifier carried by the second ranging signal respectively.
[0119] After receiving the second ranging signal, the fourth communication module parses the second ranging signal to obtain broadcast content included in the second ranging signal; for example, the broadcast content includes a verification identifier; the fourth communication module determines whether the verification identifier carried by the first ranging signal and the verification identifier carried by the second ranging signal are the same; if the verification identifier carried by the first ranging signal and the verification identifier carried by the second ranging signal are the same, step 508 is executed; if the verification identifier carried by the first ranging signal and the verification identifier carried by the second ranging signal are different, the second ranging signal is discarded, and reception of the second ranging signal is performed again.
[0120] Step 508: When the verification identifier carried by the first ranging signal and the verification identifier carried by the second ranging signal are the same, the second electronic device determines the spatial distance between the first electronic device and the second electronic device based on the third timestamp, the fourth timestamp and the clock synchronization error, and sends the spatial distance to the first electronic device.
[0121] In some embodiments, this step is the same as step 403 and will not be repeated here.
[0122] Step 509: The first electronic device receives the spatial distance.
[0123] In an embodiment of the present application, the first communication module, the second communication module and the first ranging module achieve high-precision time synchronization. By utilizing the synchronization capability of these three modules, the first ranging signal and the second ranging signal are broadcasted in coordination by the first communication module and the second communication module, so that the first ranging signal and the second ranging signal are broadcasted simultaneously in the same clock. In this way, the second electronic device can accurately determine the propagation duration of the second ranging signal based on the third timestamp of the first ranging signal received and the fourth timestamp of the second ranging signal received and the clock synchronization error, and then accurately determine the spatial distance between the two electronic devices based on the propagation duration of the second ranging signal. That is, the present application can achieve high-precision ranging by utilizing the clock synchronization capability of the first communication module and the second communication module, and by coordinating the broadcast signals of the first communication module and the second communication module, thereby improving the accuracy of distance acquisition.
[0124] Moreover, since the first communication module broadcasts the first ranging signal and the second communication module broadcasts the second ranging signal without directionality, the problem of obtaining accurate spatial distance when no connection is established between the first electronic device and the second electronic device can be solved, thereby achieving precise location perception and connection.
[0125] Please refer to Figure 7 , which shows a flow chart of a distance acquisition method shown in an exemplary embodiment of the present application. In the embodiment of the present application, the first data synchronization interface exists between the first communication module and the second communication module, and the first data synchronization interface is used to synchronize the clock synchronization error between the first communication module and the second communication module; and the second data synchronization interface exists between the third communication module and the fourth communication module. Figure 7 , the method comprising:
[0126] Step 701: The first electronic device starts a first distance measurement module, a first communication module, and a second communication module.
[0127] In some embodiments, this step is the same as step 501 and will not be repeated here.
[0128] Step 702: The first electronic device configures the broadcast content of the first ranging signal through the first ranging module, and notifies the first communication module to broadcast the first ranging signal at the first timestamp. The first ranging signal carries the clock synchronization error, the service identifier corresponding to the second communication module, and the verification identifier.
[0129] In some embodiments, this step is the same as step 502 and will not be repeated here.
[0130] In some embodiments, the first communication module is a Bluetooth module and the second communication module is an audio communication module. Figure 8The first ranging module configures and notifies the Bluetooth module to broadcast a Bluetooth signal at T0. The broadcast content of the Bluetooth signal includes a clock synchronization error (Toffset), a verification identifier (including a serial number and a random identifier of the broadcast period), and an ultrasonic service identifier.
[0131] Step 703: The first electronic device sends a second broadcast notification to the second communication module through the first data synchronization interface, where the second broadcast notification is used to notify the second communication module to broadcast a second ranging signal at a second timestamp after the current time has passed the clock synchronization error; the second communication module is used to broadcast the second ranging signal when the second timestamp is reached.
[0132] In some embodiments, the second broadcast notification carries a clock synchronization error; or the first ranging module synchronizes the clock synchronization error to the second communication module. In this embodiment of the present application, a first data synchronization interface is provided between the first communication module and the second communication module. This allows the first communication module to notify the second communication module of the timestamp of sending the second ranging signal via the first data synchronization interface, which is relatively simple to operate.
[0133] For example, please refer to Figure 8 , the first ranging module sends the clock synchronization error to the audio communication module; the first ranging module calls the ultrasonic algorithm to generate a sound waveform file, the file content carries a verification identifier (the serial number and random identifier of the broadcast period); after the Bluetooth module broadcasts the Bluetooth signal, the Bluetooth module notifies the audio communication module through the first data synchronization interface to broadcast the ultrasonic wave after the clock synchronization error, that is, to send the ultrasonic wave broadcast at T1 (T0+Toffset).
[0134] Step 704: The first electronic device configures the broadcast content of the second ranging signal through the first ranging module, and sends the second ranging signal to the second communication module.
[0135] The second ranging signal carries a verification identifier; accordingly, this step may be: the first ranging module encodes the verification identifier to obtain a broadcast coded signal; performs digital-to-analog conversion on the broadcast coded signal to obtain a second ranging signal, and sends the second ranging signal to the second communication module.
[0136] Step 705: The first electronic device broadcasts a second ranging signal at a second timestamp through the second communication module.
[0137] The second communication module receives the second ranging signal and performs timing, and broadcasts the second ranging signal when a second timestamp after the first timestamp by a clock synchronization deviation is reached.
[0138] Step 706: When the second electronic device receives the first ranging signal broadcast by the first communication module through the third communication module, the second electronic device determines the third timestamp of receiving the first ranging signal through the clock of the third communication module, and obtains the clock synchronization error, service identifier and verification identifier carried by the first ranging signal.
[0139] When the first ranging signal is received for the first time by the third communication module, the first ranging signal is discarded; when the first ranging signal is received for the next time by the third communication module, a third timestamp of the next reception of the first ranging signal is determined by the clock of the third communication module.
[0140] Step 707: When the second electronic device determines that the first ranging signal carries the service identifier, the second electronic device wakes up the fourth communication module and notifies the fourth communication module to start receiving the second ranging signal.
[0141] When the third communication module receives the first ranging signal the next time, the fourth communication module is awakened and notified to begin receiving the second ranging signal. A second data synchronization interface exists between the third and fourth communication modules; accordingly, this step may include sending a wake-up reception notification to the fourth communication module via the second data synchronization interface. The wake-up reception notification is used to awaken the fourth communication module and notify the fourth communication module to begin receiving the second ranging signal.
[0142] Step 708: When the second ranging signal broadcasted by the second communication module is received through the fourth communication module, the second electronic device determines a fourth timestamp of receiving the second ranging signal through the clock of the fourth communication module.
[0143] The fourth timestamp is a timestamp determined by the clock of the fourth communication module, that is, the fourth timestamp is a timestamp timed by the clock of the fourth communication module.
[0144] Step 709: The second electronic device obtains the verification identifier carried by the first ranging signal and the verification identifier carried by the second ranging signal respectively.
[0145] After receiving the second ranging signal, the fourth communication module parses the second ranging signal to obtain broadcast content included in the second ranging signal; for example, the broadcast content includes a verification identifier; the fourth communication module determines whether the verification identifier carried by the first ranging signal and the verification identifier carried by the second ranging signal are the same; if the verification identifier carried by the first ranging signal and the verification identifier carried by the second ranging signal are the same, step 508 is executed; if the verification identifier carried by the first ranging signal and the verification identifier carried by the second ranging signal are different, the second ranging signal is discarded, and reception of the second ranging signal is performed again.
[0146] Step 710: When the verification identifier carried by the first ranging signal and the verification identifier carried by the second ranging signal are the same, the second electronic device determines the spatial distance between the first electronic device and the second electronic device based on the third timestamp, the fourth timestamp and the clock synchronization error, and sends the spatial distance to the first electronic device.
[0147] In some embodiments, this step is the same as step 403 and will not be repeated here.
[0148] Step 711: The first electronic device receives the spatial distance.
[0149] In an embodiment of the present application, there is a first data synchronization interface between the first communication module and the second communication module, and the time synchronization of the first ranging signal and the second ranging signal sent by the first communication module and the second communication module is achieved through the first data synchronization interface, so that the first ranging signal and the second ranging signal are broadcast simultaneously in the same clock. In this way, the second electronic device can accurately determine the propagation time of the second ranging signal based on the third timestamp of the first ranging signal received and the fourth timestamp of the second ranging signal received and the clock synchronization error, and then accurately determine the spatial distance between the two electronic devices based on the propagation time of the second ranging signal. That is, the present application can utilize the clock synchronization capability of the first communication module and the second communication module to achieve high-precision ranging through the coordinated broadcast signals of the first communication module and the second communication module, thereby improving the accuracy of distance acquisition.
[0150] Moreover, since the first communication module broadcasts the first ranging signal and the second communication module broadcasts the second ranging signal without directionality, the problem of obtaining accurate spatial distance when no connection is established between the first electronic device and the second electronic device can be solved, thereby achieving precise location perception and connection.
[0151] Please refer to Figure 9 , which shows a block diagram of a distance acquisition device shown in an exemplary embodiment of the present application. The device is applied in a first electronic device, the first electronic device includes a first communication module and a second communication module, and the device includes:
[0152] A first broadcast module 901 is configured to broadcast a first ranging signal at a first timestamp, where the first ranging signal carries a clock synchronization error, where the clock synchronization error is a time difference between a clock of the first communication module and a clock of the second communication module;
[0153] A second broadcast module 902 is configured to broadcast a second ranging signal through a second broadcast system when a second timestamp is reached, where the second timestamp is a timestamp after the first timestamp has passed a clock synchronization error;
[0154] A receiving module 903 is configured to receive a spatial distance between the first electronic device and the second electronic device returned by the second electronic device, where the spatial distance is determined by the second electronic device based on a third timestamp, a fourth timestamp, and a clock synchronization error, where the third timestamp is a timestamp at which the second electronic device receives the first ranging signal, and the fourth timestamp is a timestamp at which the second electronic device receives the second ranging signal.
[0155] In some embodiments, the apparatus further comprises:
[0156] a first determining module, configured to determine a service identifier and a clock synchronization error corresponding to the second communication module, wherein the service identifier is used to instruct the second electronic device to continue receiving the second ranging signal after receiving the first ranging signal;
[0157] The first configuration module is configured to configure broadcast content of a first ranging signal based on a service identifier and a clock synchronization error, where the first ranging signal carries the service identifier and the clock synchronization error.
[0158] In some embodiments, the apparatus further comprises:
[0159] A second determining module is configured to determine a verification identifier, where the verification identifier is used by the second electronic device to verify whether the first ranging signal and the second ranging signal are ranging signals of the same broadcast period;
[0160] The second configuration module is configured to configure the broadcast content of the first ranging signal and the broadcast content of the second ranging signal based on the verification identifier, where both the first ranging signal and the second ranging signal carry the verification identifier.
[0161] In some embodiments, the first electronic device further includes a first ranging module;
[0162] A second broadcast module 902 is configured to send a first broadcast notification to the second communication module through the first ranging module, where the first broadcast notification is used to notify the second communication module to broadcast a second ranging signal when a second timestamp is reached;
[0163] The second communication module is configured to broadcast a second ranging signal when a second timestamp is reached.
[0164] In some embodiments, the apparatus further comprises:
[0165] When the first electronic device does not have a ranging requirement, the first communication module and the second communication module are both in a dormant state;
[0166] The first wake-up module is configured to wake up the first communication module and the second communication module via the first ranging module when the first electronic device has a ranging requirement.
[0167] In some embodiments, a first data synchronization interface is provided between the first communication module and the second communication module, and the first data synchronization interface is used to synchronize clock synchronization errors between the first communication module and the second communication module;
[0168] A second broadcast module 902 is configured to send a second broadcast notification to the second communication module through the first data synchronization interface after the first communication module broadcasts the first ranging signal, wherein the second broadcast notification is used to notify the second communication module to broadcast the second ranging signal at a second timestamp after the current time exceeds the clock synchronization error;
[0169] The second communication module is configured to broadcast a second ranging signal when a second timestamp is reached.
[0170] In some embodiments, the first communication module is a short-range communication module, and the second communication module is an audio communication module.
[0171] In some embodiments, the apparatus further comprises:
[0172] The first broadcast module 901 is further configured to broadcast a first ranging signal at a first timestamp through the first communication module once every preset period, where the first ranging signal carries a clock synchronization error, where the clock synchronization error is a time difference between a clock of the first communication module and a clock of the second communication module;
[0173] The second broadcast module 902 is further configured to broadcast a second ranging signal through a second broadcast system once every preset period when a second timestamp is reached, where the second timestamp is the timestamp after the first timestamp has passed the clock synchronization error, until the number of executions reaches a preset number.
[0174] It should be noted that the distance acquisition device provided in the above embodiments, when performing the distance acquisition method, is only illustrated by the division of the above-mentioned functional modules. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the electronic device can be divided into different functional modules to complete all or part of the functions described above. In addition, the distance acquisition device provided in the above embodiments and the distance acquisition method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0175] In an embodiment of the present application, the first communication module of the first electronic device broadcasts the first ranging signal at the first timestamp, and the second communication module of the first electronic device broadcasts the second ranging signal at the second timestamp, and the difference between the second timestamp and the first timestamp is the clock synchronization error of the two communication modules; therefore, the present application is equivalent to broadcasting the first ranging signal and the second ranging signal at the same time in the same clock, so that the second electronic device can accurately determine the propagation time of the second ranging signal based on the third timestamp of the first ranging signal received and the fourth timestamp of the second ranging signal received and the clock synchronization error, and then accurately determine the spatial distance between the two electronic devices based on the propagation time of the second ranging signal. That is, the present application can utilize the clock synchronization capability of the first communication module and the second communication module to achieve high-precision ranging through the coordinated broadcast signals of the first communication module and the second communication module, thereby improving the accuracy of distance acquisition.
[0176] Please refer to Figure 10 , which shows a block diagram of a distance acquisition device shown in an exemplary embodiment of the present application. The device is applied to a second electronic device, and the second electronic device includes a third communication module and a fourth communication module. The type of the third communication module is the same as the type of the first communication module of the first electronic device, and the type of the fourth communication module is the same as the type of the second communication module of the first electronic device. The device includes:
[0177] a third determining module 1001, configured to, when receiving a first ranging signal broadcast by the first communication module through the third communication module, determine a third timestamp of receiving the first ranging signal using a clock of the third communication module, and obtain a clock synchronization error carried by the first ranging signal, where the clock synchronization error is a time difference between a clock of the first communication module and a clock of the second communication module;
[0178] a fourth determining module 1002, configured to, when receiving the second ranging signal broadcast by the second communication module through the fourth communication module, determine a fourth timestamp of receiving the second ranging signal using a clock of the fourth communication module;
[0179] a fifth determining module 1003, configured to determine a spatial distance between the first electronic device and the second electronic device based on the third timestamp, the fourth timestamp, and the clock synchronization error;
[0180] The sending module 1004 is configured to send the spatial distance to the first electronic device.
[0181] In some embodiments, the apparatus further comprises:
[0182] The second wake-up module is configured to wake up the fourth communication module when the first ranging signal carries the service identifier corresponding to the second communication module, and notify the fourth communication module to start receiving the second ranging signal.
[0183] In some embodiments, the second electronic device further includes a second ranging module;
[0184] The second wake-up module is used to wake up the second ranging module when the second ranging module is also in a dormant state. The second ranging module wakes up the fourth communication module and notifies the fourth communication module to start receiving the second ranging signal.
[0185] In some embodiments, a second data synchronization interface exists between the third communication module and the fourth communication module;
[0186] The second wake-up module is used to send a wake-up reception notification to the fourth communication module through the second data synchronization interface, where the wake-up reception notification is used to wake up the fourth communication module and notify the fourth communication module to start receiving the second ranging signal.
[0187] In some embodiments, the third determining module 1001 is configured to discard the first ranging signal when the first ranging signal is received for the first time through the third communication module;
[0188] When the first ranging signal is received next time through the third communication module, determining a third timestamp of the next reception of the first ranging signal through the clock of the third communication module;
[0189] The second wake-up module is configured to wake up the fourth communication module when the first ranging signal is received next time through the third communication module, and notify the fourth communication module to start receiving the second ranging signal.
[0190] In some embodiments, the apparatus further comprises:
[0191] an acquisition module, configured to respectively acquire a verification identifier carried by the first ranging signal and a verification identifier carried by the second ranging signal;
[0192] The fifth determination module 1003 is configured to determine the spatial distance between the first electronic device and the second electronic device based on the third timestamp, the fourth timestamp, and the clock synchronization error when the verification identifier carried by the first ranging signal and the verification identifier carried by the second ranging signal are the same.
[0193] In some embodiments, the fifth determination module 1003 is configured to determine a propagation factor of the second ranging signal, where the propagation factor is used to represent an impact of external factors on the second ranging signal; determine a fifth timestamp based on the third timestamp and the clock synchronization error, where the fifth timestamp is used to represent a sending timestamp of the second ranging signal in the clocks of the four communication modules; the propagation speed of the first ranging signal is greater than a preset multiple of the propagation speed of the second ranging signal, and the third timestamp is used to represent a sending timestamp of the second ranging signal in the clock of the third communication module; and determine the spatial distance based on the fifth timestamp, the fourth timestamp, the propagation speed of the second ranging signal, and the propagation factor.
[0194] It should be noted that the distance acquisition device provided in the above embodiments, when performing the distance acquisition method, is only illustrated by the division of the above-mentioned functional modules. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the electronic device can be divided into different functional modules to complete all or part of the functions described above. In addition, the distance acquisition device provided in the above embodiments and the distance acquisition method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0195] Please refer to Figure 11 , which shows a block diagram of an electronic device according to an exemplary embodiment of the present application. The electronic device in the present application may include one or more of the following components: a main processor 1101, a Bluetooth processor 1102, an audio processor 1103, a memory 1104, and a display screen 1105.
[0196] The main processor 1101 is used to run the ranging module. If the electronic device is a first electronic device, the main processor 1101 is used to run the first ranging module; if the electronic device is a second electronic device, the main processor 1101 is used to run the second ranging module. Furthermore, the main processor 1101 may include one or more processing cores. The main processor 1101 utilizes various interfaces and circuits to connect various components within the entire electronic device. It executes instructions, programs, code sets, or instruction sets stored in the memory 1104, and accesses data stored in the memory 1104 to perform various functions of the electronic device and process data. Optionally, the main processor 1101 may be implemented in hardware using at least one of a digital signal processing (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The main processor 1101 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a 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 display screen 1105; the NPU is used to implement 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 main processor 1101, but may be implemented separately through a chip.
[0197] The Bluetooth processor 1102 is used to run the first communication module or the third communication module; when the electronic device is the first electronic device, the Bluetooth processor 1102 is used to run the first communication module; when the electronic device is the second electronic device, the Bluetooth processor 1102 is used to run the third communication module.
[0198] The audio processor 1103 is used to run the second communication module or the fourth communication module; when the electronic device is the first electronic device, the audio processor 1103 is used to run the third communication module; when the electronic device is the second electronic device, the audio processor 1103 is used to run the fourth communication module.
[0199] The memory 1104 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 1104 includes a non-transitory computer-readable storage medium. The memory 1104 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 1104 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 created according to the use of the electronic device (such as audio data, a phone book), etc.
[0200] The display screen 1105 is a display component for displaying a user interface. Optionally, the display screen 1105 is a display screen with a touch function, through which the user can use any suitable object such as a finger, a touch pen, etc. to perform touch operations on the display screen 1105.
[0201] Display screen 1105 is typically provided on the front panel of an electronic device. Display screen 1105 can be designed as a full-screen, curved screen, special-shaped screen, double-sided screen, or foldable screen. Display screen 1105 can also be designed as a combination of a full-screen and a curved screen, a combination of a special-shaped screen and a curved screen, etc., which are not limited in this embodiment.
[0202] In addition, those skilled in the art will understand that the structures of the electronic devices shown in the above figures do not constitute limitations on the electronic devices. The electronic devices may include more or fewer components than shown, or may combine certain components, or arrange the components differently. For example, the electronic devices may also include audio acquisition devices, speakers, radio frequency circuits, input units, sensors, audio circuits, wireless fidelity (WiFi) modules, power supplies, Bluetooth modules, and other components, which will not be described in detail here.
[0203] An embodiment of the present application further provides a computer-readable medium, which stores at least one program code, and the at least one program code is loaded and executed by the processor to implement the distance acquisition method shown in the above embodiments.
[0204] An embodiment of the present application further provides a computer program product, which stores at least one program code, and the at least one program code is loaded and executed by the processor to implement the distance acquisition method shown in the above embodiments.
[0205] In some embodiments, the computer program product involved in the embodiments of the present application can be deployed and executed on an electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed at multiple locations and interconnected through a communication network. Multiple electronic devices distributed at multiple locations and interconnected through a communication network can constitute a blockchain system.
[0206] Those skilled in the art will appreciate that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented using 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 communication media include any media that facilitates the transmission of computer programs from one place to another. The storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0207] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A distance acquisition method, characterized in that: The method is performed by a first electronic device, the first electronic device including a first communication module and a second communication module, and the method includes: broadcasting a first ranging signal at a first timestamp by the first communication module, where the first ranging signal carries a clock synchronization error, where the clock synchronization error is a time difference between a clock of the first communication module and a clock of the second communication module; When a second timestamp is reached, broadcasting a second ranging signal through the second broadcast system, where the second timestamp is a timestamp after the first timestamp has passed the clock synchronization error; Receive the spatial distance between the first electronic device and the second electronic device returned by the second electronic device, where the spatial distance is determined by the second electronic device based on a third timestamp, a fourth timestamp, and the clock synchronization error, the third timestamp being a timestamp at which the second electronic device receives the first ranging signal, and the fourth timestamp being a timestamp at which the second electronic device receives the second ranging signal.
2. The method according to claim 1, characterized in that Before broadcasting the first ranging signal at the first timestamp by the first communication module, the method further includes: determining a service identifier corresponding to the second communication module and the clock synchronization error, wherein the service identifier is used to instruct the second electronic device to continue receiving the second ranging signal after receiving the first ranging signal; Based on the service identifier and the clock synchronization error, the broadcast content of the first ranging signal is configured, and the first ranging signal carries the service identifier and the clock synchronization error.
3. The method according to claim 1 or 2, characterized in that Before broadcasting the first ranging signal at the first timestamp by the first communication module, the method further includes: determining a verification identifier, where the verification identifier is used by the second electronic device to verify whether the first ranging signal and the second ranging signal are ranging signals of the same broadcast period; Based on the verification identifier, the broadcast content of the first ranging signal and the broadcast content of the second ranging signal are configured, and both the first ranging signal and the second ranging signal carry the verification identifier.
4. The method according to claim 1, wherein The first electronic device further includes a first ranging module; When the second timestamp is reached, broadcasting the second ranging signal through the second broadcast system includes: Sending a first broadcast notification to the second communication module through the first ranging module, where the first broadcast notification is used to notify the second communication module to broadcast the second ranging signal when the second timestamp is reached; The second communication module is configured to broadcast the second ranging signal when the second timestamp is reached.
5. The method according to claim 4, characterized in that The method further comprises: When the first electronic device does not have a ranging requirement, the first communication module and the second communication module are both in a dormant state; When the first electronic device has a distance measurement requirement, the first communication module and the second communication module are awakened through the first distance measurement module.
6. The method according to claim 1, wherein A first data synchronization interface is provided between the first communication module and the second communication module, and the first data synchronization interface is used to synchronize the clock synchronization error between the first communication module and the second communication module; When the second timestamp is reached, broadcasting the second ranging signal through the second broadcast system includes: After the first communication module broadcasts the first ranging signal, sending a second broadcast notification to the second communication module through the first data synchronization interface, where the second broadcast notification is used to notify the second communication module to broadcast the second ranging signal at the second timestamp after the current time passes the clock synchronization error; The second communication module is configured to broadcast the second ranging signal when the second timestamp is reached.
7. The method according to any one of claims 1 to 6, characterized in that The first communication module is a short-distance communication module, and the second communication module is an audio communication module.
8. The method according to claim 1, characterized in that The method further comprises: Every preset period, the steps of broadcasting a first ranging signal at a first timestamp through the first communication module, where the first ranging signal carries a clock synchronization error, where the clock synchronization error is the time difference between the clock of the first communication module and the clock of the second communication module; and broadcasting a second ranging signal at a second timestamp through the second broadcast system, where the second timestamp is the timestamp after the first timestamp exceeds the clock synchronization error, are performed once until the number of executions reaches a preset number.
9. A distance acquisition method, characterized in that: The method is performed by a second electronic device, the second electronic device including a third communication module and a fourth communication module, the third communication module being of the same type as the first communication module of the first electronic device, and the fourth communication module being of the same type as the second communication module of the first electronic device, the method including: When the first ranging signal broadcast by the first communication module is received through the third communication module, determining a third timestamp of receipt of the first ranging signal through the clock of the third communication module, and obtaining a clock synchronization error carried by the first ranging signal, where the clock synchronization error is a time difference between the clock of the first communication module and the clock of the second communication module; When a second ranging signal broadcast by the second communication module is received through the fourth communication module, determining a fourth timestamp of receiving the second ranging signal through a clock of the fourth communication module; Based on the third timestamp, the fourth timestamp, and the clock synchronization error, a spatial distance between the first electronic device and the second electronic device is determined, and the spatial distance is sent to the first electronic device.
10. The method according to claim 9, characterized in that When the second ranging signal broadcast by the second communication module is received through the fourth communication module, before determining, by the clock of the fourth communication module, a fourth timestamp of receiving the second ranging signal, the method further includes: In a case where the first ranging signal carries the service identifier corresponding to the second communication module, the fourth communication module is woken up, and the fourth communication module is notified to start receiving the second ranging signal.
11. The method according to claim 10, characterized in that The second electronic device further includes a second ranging module; The waking up the fourth communication module and notifying the fourth communication module to start receiving the second ranging signal includes: The second ranging module is also in a dormant state. The second ranging module is awakened, and the fourth communication module is awakened by the second ranging module, and the fourth communication module is notified to start receiving the second ranging signal.
12. The method according to claim 10, characterized in that There is a second data synchronization interface between the third communication module and the fourth communication module; The waking up the fourth communication module and notifying the fourth communication module to start receiving the second ranging signal includes: A wake-up reception notification is sent to the fourth communication module through the second data synchronization interface, where the wake-up reception notification is used to wake up the fourth communication module and notify the fourth communication module to start receiving the second ranging signal.
13. The method according to claim 10, characterized in that The method of determining, by a clock of the third communication module, when receiving the first ranging signal broadcast by the first communication module, a third timestamp of receiving the first ranging signal comprises: When the first ranging signal is received for the first time through the third communication module, discarding the first ranging signal; When the first ranging signal is received next time by the third communication module, determining a third timestamp of the next reception of the first ranging signal by the clock of the third communication module; The waking up the fourth communication module and notifying the fourth communication module to start receiving the second ranging signal includes: When the first ranging signal is received next time through the third communication module, the fourth communication module is awakened and notified to start receiving the second ranging signal.
14. The method according to claim 9, characterized in that Before determining the spatial distance between the first electronic device and the second electronic device based on the third timestamp, the fourth timestamp, and the clock synchronization error, the method further includes: respectively obtaining a verification identifier carried by the first ranging signal and a verification identifier carried by the second ranging signal; When the verification identifier carried by the first ranging signal and the verification identifier carried by the second ranging signal are the same, the step of determining the spatial distance between the first electronic device and the second electronic device based on the third timestamp, the fourth timestamp and the clock synchronization error is performed.
15. The method according to any one of claims 9 to 14, characterized in that: The determining, based on the third timestamp, the fourth timestamp, and the clock synchronization error, a spatial distance between the first electronic device and the second electronic device, includes: determining a propagation factor of the second ranging signal, where the propagation factor is used to represent an impact of an external factor on the second ranging signal; determining, based on the third timestamp and the clock synchronization error, a fifth timestamp, the fifth timestamp being used to indicate a timestamp of sending the second ranging signal in the clock of the fourth communication module, the propagation speed of the first ranging signal being greater than a preset multiple of the propagation speed of the second ranging signal, and the third timestamp being used to indicate a timestamp of sending the second ranging signal in the clock of the third communication module; The spatial distance is determined based on the fifth timestamp, the fourth timestamp, a propagation speed of the second ranging signal, and the propagation factor.
16. A distance acquisition device, characterized in that: The device is applied in a first electronic device, the first electronic device includes a first communication module and a second communication module, and the device includes: A first broadcast module, configured to broadcast a first ranging signal at a first timestamp, where the first ranging signal carries a clock synchronization error, where the clock synchronization error is a time difference between a clock of the first communication module and a clock of the second communication module; a second broadcast module, configured to broadcast a second ranging signal through the second broadcast system when a second timestamp is reached, where the second timestamp is a timestamp after the first timestamp exceeds the clock synchronization error; a receiving module, configured to receive a spatial distance between the first electronic device and the second electronic device returned by the second electronic device, where the spatial distance is determined by the second electronic device based on a third timestamp, a fourth timestamp, and the clock synchronization error, the third timestamp being a timestamp at which the second electronic device receives the first ranging signal, and the fourth timestamp being a timestamp at which the second electronic device receives the second ranging signal.
17. A distance acquisition device, characterized in that: The apparatus is applied to a second electronic device, the second electronic device including a third communication module and a fourth communication module, the third communication module being of the same type as the first communication module of the first electronic device, and the fourth communication module being of the same type as the second communication module of the first electronic device, and the apparatus including: a third determining module, configured to, when the first ranging signal broadcast by the first communication module is received through the third communication module, determine, using the clock of the third communication module, a third timestamp of when the first ranging signal is received, and obtain a clock synchronization error carried by the first ranging signal, where the clock synchronization error is a time difference between the clock of the first communication module and the clock of the second communication module; a fourth determining module, configured to, when receiving the second ranging signal broadcast by the second communication module through the fourth communication module, determine a fourth timestamp of receiving the second ranging signal by using a clock of the fourth communication module; a fifth determining module, configured to determine a spatial distance between the first electronic device and the second electronic device based on the third timestamp, the fourth timestamp, and the clock synchronization error; A sending module is configured to send the spatial distance to the first electronic device.
18. A first electronic device, characterized in that: The first electronic device includes one or more processors and one or more memories, wherein at least one program code is stored in the one or more memories, and the at least one program code is loaded and executed by the one or more processors to implement the distance acquisition method according to any one of claims 1 to 8.
19. A second electronic device, characterized in that: The second electronic device includes one or more processors and one or more memories, wherein at least one program code is stored in the one or more memories, and the at least one program code is loaded and executed by the one or more processors to implement the distance acquisition method according to any one of claims 9 to 15.
20. A distance acquisition system, characterized in that: The system includes the first electronic device of claim 18 and the second electronic device of claim 19.
21. A computer-readable storage medium, characterized in that The storage medium stores at least one program code, and the at least one program code is loaded and executed by the processor to implement the distance acquisition method according to any one of claims 1 to 15.
22. A computer program product, characterized in that The computer program product stores at least one program code, and the at least one program code is configured to be executed by a processor to implement the distance acquisition method according to any one of claims 1 to 15.