CN114646952A - Distance acquisition method, device, system, storage medium and electronic equipment - Google Patents

Distance acquisition method, device, system, storage medium and electronic equipment Download PDF

Info

Publication number
CN114646952A
CN114646952A CN202210255507.6A CN202210255507A CN114646952A CN 114646952 A CN114646952 A CN 114646952A CN 202210255507 A CN202210255507 A CN 202210255507A CN 114646952 A CN114646952 A CN 114646952A
Authority
CN
China
Prior art keywords
time
ranging signal
external device
electronic device
distance
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210255507.6A
Other languages
Chinese (zh)
Other versions
CN114646952B (en
Inventor
李宗源
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202210255507.6A priority Critical patent/CN114646952B/en
Publication of CN114646952A publication Critical patent/CN114646952A/en
Application granted granted Critical
Publication of CN114646952B publication Critical patent/CN114646952B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01SRADIO DIRECTION-FINDING; RADIO NAVIGATION; DETERMINING DISTANCE OR VELOCITY BY USE OF RADIO WAVES; LOCATING OR PRESENCE-DETECTING BY USE OF THE REFLECTION OR RERADIATION OF RADIO WAVES; ANALOGOUS ARRANGEMENTS USING OTHER WAVES
    • G01S11/00Systems for determining distance or velocity not using reflection or reradiation
    • G01S11/02Systems for determining distance or velocity not using reflection or reradiation using radio waves
    • G01S11/08Systems for determining distance or velocity not using reflection or reradiation using radio waves using synchronised clocks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Radar, Positioning & Navigation (AREA)
  • Remote Sensing (AREA)
  • Electric Clocks (AREA)
  • Radar Systems Or Details Thereof (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

一种距离获取方法、装置、系统、存储介质及电子设备,其中,与外部设备进行时间同步,得到电子设备与外部设备之间的时间差,向外部设备传输测距信号的目标发送时刻以及时间差,在到达目标发送时刻时向外部设备发送测距信号,接收外部设备返回的外部设备与电子设备之间的空间距离,空间距离由外部设备根据测距信号、目标发送时刻、时间差以及外部设备接收到测距信号的实际接收时刻计算得到的。其中,通过电子设备与外部设备进行时间同步,得到电子设备与外部设备之间的时间差,并进一步利用该时间差,通过一次测距信号的发送和接收即可实现电子设备与外部设备之间的测距,提升设备间距离测算的效率。

Figure 202210255507

A distance acquisition method, device, system, storage medium and electronic device, wherein time synchronization is performed with an external device to obtain a time difference between the electronic device and the external device, and the target sending time and time difference for transmitting a ranging signal to the external device, When reaching the target sending time, a ranging signal is sent to the external device, and the spatial distance between the external device and the electronic device returned by the external device is received. The spatial distance is received by the external device according to the ranging signal, target sending time, time difference and the external device. Calculated from the actual receiving moment of the ranging signal. Among them, the time difference between the electronic device and the external device is obtained by synchronizing the time between the electronic device and the external device, and further using the time difference, the measurement between the electronic device and the external device can be realized by sending and receiving a ranging signal once. It can improve the efficiency of distance measurement between devices.

Figure 202210255507

Description

距离获取方法、装置、系统、存储介质及电子设备Distance acquisition method, device, system, storage medium and electronic device

技术领域technical field

本申请实施例涉及计算机技术领域,具体涉及一种距离获取方法、装置、系统、存储介质及电子设备。The embodiments of the present application relate to the field of computer technologies, and in particular, to a distance acquisition method, apparatus, system, storage medium, and electronic device.

背景技术Background technique

随着计算机技术的快速发展,物体之间距离的测量不再依赖于手工实地测量,而是通过信号发送和接收的时间实现对物体之间距离的测算。然而,相关技术中,设备之间需要多次交换测距信号发送和接收的时间来实现测距,效率较低。With the rapid development of computer technology, the measurement of the distance between objects no longer depends on manual field measurement, but the measurement of the distance between objects is realized through the time of signal transmission and reception. However, in the related art, the devices need to exchange the time for transmitting and receiving the ranging signal multiple times to realize the ranging, and the efficiency is low.

发明内容SUMMARY OF THE INVENTION

本申请提供了一种距离获取方法、装置、系统、存储介质及电子设备,可以提升距离测算的效率。The present application provides a distance acquisition method, device, system, storage medium and electronic device, which can improve the efficiency of distance measurement.

第一方面,本申请提供一种距离获取方法,应用于电子设备,包括:In a first aspect, the present application provides a method for obtaining a distance, which is applied to an electronic device, including:

与外部设备进行时间同步,得到所述电子设备与所述外部设备之间的时间差;Perform time synchronization with an external device to obtain the time difference between the electronic device and the external device;

向所述外部设备传输测距信号的目标发送时刻以及所述时间差;The target sending time and the time difference for transmitting the ranging signal to the external device;

在到达所述目标发送时刻时向所述外部设备发送所述测距信号;Send the ranging signal to the external device when the target sending time is reached;

接收所述外部设备返回的所述外部设备与所述电子设备之间的空间距离,所述空间距离由所述外部设备根据所述测距信号、所述目标发送时刻、所述时间差以及所述外部设备接收到所述测距信号的实际接收时刻计算得到的。receiving the spatial distance between the external device and the electronic device returned by the external device, the spatial distance is determined by the external device according to the ranging signal, the target sending time, the time difference and the It is calculated by the actual receiving moment when the external device receives the ranging signal.

第二方面,本申请提供一种距离获取装置,应用于电子设备,包括:In a second aspect, the present application provides a distance acquisition device, which is applied to electronic equipment, including:

获取模块,用于与外部设备进行时间同步,得到所述电子设备与所述外部设备之间的时间差;an acquisition module, configured to perform time synchronization with an external device to obtain the time difference between the electronic device and the external device;

时间信息传输模块,用于向所述外部设备传输测距信号的目标发送时刻以及所述时间差;a time information transmission module, configured to transmit the target sending time of the ranging signal and the time difference to the external device;

测距信号发送模块,用于在到达所述目标发送时刻时向所述外部设备发送所述测距信号;a ranging signal sending module, configured to send the ranging signal to the external device when the target sending time is reached;

空间距离接收模块,用于接收所述外部设备返回的所述外部设备与所述电子设备之间的空间距离,所述空间距离由所述外部设备根据所述测距信号、所述目标发送时刻、所述时间差以及所述外部设备接收到所述测距信号的实际接收时刻计算得到的。A spatial distance receiving module, configured to receive the spatial distance between the external device and the electronic device returned by the external device, and the spatial distance is determined by the external device according to the ranging signal and the target sending time , the time difference, and the actual receiving moment when the external device receives the ranging signal.

第三方面,本申请提供一种距离获取方法,应用于电子设备,包括:In a third aspect, the present application provides a method for obtaining a distance, which is applied to an electronic device, including:

与外部设备进行时间同步,得到所述电子设备与所述外部设备之间的时间差;Perform time synchronization with an external device to obtain the time difference between the electronic device and the external device;

接收所述外部设备传输测距信号的目标发送时刻;receiving the target sending time of the ranging signal transmitted by the external device;

接收所述外部设备发送的所述测距信号;receiving the ranging signal sent by the external device;

根据所述目标发送时刻、所述时间差、所述测距信号以及接收到所述测距信号的实际接收时刻,计算所述电子设备与所述外部设备之间的空间距离,并将所述空间距离发送给所述外部设备。Calculate the spatial distance between the electronic device and the external device according to the target sending time, the time difference, the ranging signal, and the actual receiving time when the ranging signal is received, and calculate the spatial distance between the electronic device and the external device. The distance is sent to the external device.

第四方面,本申请提供一种距离获取装置,应用于电子设备,包括:In a fourth aspect, the present application provides a distance acquisition device, which is applied to electronic equipment, including:

同步模块,用于与外部设备进行时间同步,得到所述电子设备与所述外部设备之间的时间差;a synchronization module, configured to perform time synchronization with an external device to obtain the time difference between the electronic device and the external device;

时间信息接收模块,用于接收所述外部设备传输测距信号的目标发送时刻;a time information receiving module, configured to receive the target sending time of the ranging signal transmitted by the external device;

测距信号接收模块,用于接收所述外部设备发送的所述测距信号;a ranging signal receiving module, configured to receive the ranging signal sent by the external device;

空间距离发送模块,用于根据所述目标发送时刻、所述时间差、所述测距信号以及接收到所述测距信号的实际接收时刻,计算所述电子设备与所述外部设备之间的空间距离,并将所述空间距离发送给所述外部设备。A space distance sending module, configured to calculate the space between the electronic device and the external device according to the target sending time, the time difference, the ranging signal and the actual receiving time when the ranging signal is received distance, and send the spatial distance to the external device.

第五方面,本申请提供一种距离获取系统,包括电子设备和外部设备,其中,所述电子设备用于与所述外部设备进行时间同步,得到所述电子设备与所述外部设备之间的时间差,并向所述外部设备传输测距信号的目标发送时刻以及所述时间差,在到达所述目标发送时刻时向所述外部设备发送所述测距信号,接收所述外部设备返回的所述外部设备与所述电子设备之间的空间距离;In a fifth aspect, the present application provides a distance acquisition system, including an electronic device and an external device, wherein the electronic device is configured to perform time synchronization with the external device to obtain a distance between the electronic device and the external device. time difference, and transmit the target sending time of the ranging signal and the time difference to the external device, when the target sending time is reached, send the ranging signal to the external device, and receive the the spatial distance between the external device and the electronic device;

所述外部设备用于接收所述电子设备发送的测距信号以及所述时间差,根据所述目标发送时刻、所述时间差、所述测距信号以及接收到所述测距信号的实际接收时刻,计算所述外部设备与所述电子设备之间的空间距离,并将所述空间距离发送给所述电子设备。The external device is configured to receive the ranging signal and the time difference sent by the electronic device, and according to the target sending time, the time difference, the ranging signal and the actual receiving time when the ranging signal is received, Calculate the spatial distance between the external device and the electronic device, and send the spatial distance to the electronic device.

第六方面,本申请提供了一种存储介质,其上存储有计算机程序,当该计算机程序被电子设备的处理器加载时执行如本申请提供的任一距离获取方法中的步骤。In a sixth aspect, the present application provides a storage medium on which a computer program is stored, and when the computer program is loaded by a processor of an electronic device, the steps in any of the distance acquisition methods provided by the present application are executed.

第七方面,本申请还提供了一种电子设备,该电子设备包括处理器和存储器,存储器储存有计算机程序,处理器通过加载存储器储存的计算机程序执行如本申请提供的任一距离获取方法中的步骤。In a seventh aspect, the present application also provides an electronic device, the electronic device includes a processor and a memory, the memory stores a computer program, and the processor executes any distance acquisition method as provided in the present application by loading the computer program stored in the memory. A step of.

本申请中,通过电子设备与外部设备进行时间同步,得到电子设备与外部设备之间的时间差,并进一步利用该时间差,通过一次测距信号的发送和接收即可实现电子设备与外部设备之间的测距,相较于相关技术,本申请无需测距信号接收时刻的发送,外部设备直接根据目标发送时刻、实际接收时刻和时间差计算出与电子设备的空间距离,减少数据发送次数,能够提升设备间距离测算的效率。其中,通过向外部设备发送测距信号的目标发送时间,便于外部设备根据目标发送时间做出测距信号接收的准备,确保测距信号的顺利发送和接收,而测距信号的顺利发送和接收为设备之间距离的准确测算提供基础。其中,通过将测算的空间距离返回给测距信号的发送方,可实现测距信号发送方在发送测距信号后获取到与外部设备之间的空间距离,便于后续对该空间距离的应用。In this application, the time difference between the electronic device and the external device is obtained by synchronizing the time between the electronic device and the external device, and by further utilizing the time difference, the distance between the electronic device and the external device can be realized by sending and receiving a ranging signal once. Compared with the related art, the present application does not need to send the receiving time of the ranging signal, and the external device directly calculates the spatial distance from the electronic device according to the target sending time, the actual receiving time and the time difference, which reduces the number of data transmissions and can improve the The efficiency of distance measurement between devices. Among them, by sending the target sending time of the ranging signal to the external device, it is convenient for the external device to prepare for receiving the ranging signal according to the target sending time, so as to ensure the smooth sending and receiving of the ranging signal, and the smooth sending and receiving of the ranging signal. Provide a basis for accurate measurement of the distance between devices. Among them, by returning the measured spatial distance to the sender of the ranging signal, the sender of the ranging signal can obtain the spatial distance with the external device after sending the ranging signal, which is convenient for subsequent application of the spatial distance.

附图说明Description of drawings

为了更清楚地说明本申请中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the present application more clearly, the following briefly introduces the accompanying drawings used in the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained from these drawings without any creative effort.

图1是本申请实施例提供的距离获取方法的流程示意图;1 is a schematic flowchart of a distance acquisition method provided by an embodiment of the present application;

图2是本申请实施例提供的距离获取方法中电子设备与外部设备的交互示意图;2 is a schematic diagram of interaction between an electronic device and an external device in a distance acquisition method provided by an embodiment of the present application;

图3是本申请实施例提供的距离获取方法的另一流程示意图;FIG. 3 is another schematic flowchart of a distance acquisition method provided by an embodiment of the present application;

图4是本申请实施例提供的距离获取方法中设备之间时间同步并进行设备之间测距的具体流程示意图;4 is a schematic flowchart of a specific flow of time synchronization between devices and performing ranging between devices in a distance acquisition method provided by an embodiment of the present application;

图5是本申请实施例提供的距离获取过程中数据传输的流程示意图;5 is a schematic flowchart of data transmission in a distance acquisition process provided by an embodiment of the present application;

图6是本申请实施例提供的距离获取系统的结构示意图;6 is a schematic structural diagram of a distance acquisition system provided by an embodiment of the present application;

图7是本申请实施例提供的距离获取装置的结构示意图;7 is a schematic structural diagram of a distance acquisition device provided by an embodiment of the present application;

图8是本申请实施例提供的距离获取装置的另一结构示意图;8 is another schematic structural diagram of a distance acquisition device provided by an embodiment of the present application;

图9是本申请实施例提供的电子设备的结构框图。FIG. 9 is a structural block diagram of an electronic device provided by an embodiment of the present application.

具体实施方式Detailed ways

应当说明的是,本申请中的术语“第一”、“第二”和“第三”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或模块的过程、方法、系统、产品或设备没有限定于已列出的步骤或模块,而是某些实施例还包括没有列出的步骤或模块,或某些实施例还包括对于这些过程、方法、产品或设备固有的其它步骤或模块。It should be noted that the terms "first", "second" and "third" in the present application are used to distinguish different objects, rather than to describe a specific order. Furthermore, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or modules is not limited to the listed steps or modules, but some embodiments also include unlisted steps or modules, or some embodiments Other steps or modules inherent to these processes, methods, products or devices are also included.

在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。Reference herein to an "embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor a separate or alternative embodiment that is mutually exclusive of other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

本申请实施例提供一种距离获取方法、距离获取装置、距离获取系统、存储介质及电子设备,其中距离获取方法的执行主体可以是本申请实施例提供的距离获取装置,或者集成了该距离获取装置的电子设备,其中该距离获取装置可以采用硬件或者软件的方式实现。其中,电子设备可以是智能手机、平板电脑、掌上电脑、笔记本电脑等配置有处理器而具有数据处理能力的设备。The embodiments of the present application provide a distance acquisition method, a distance acquisition device, a distance acquisition system, a storage medium, and an electronic device, wherein the execution subject of the distance acquisition method may be the distance acquisition device provided in the embodiments of the present application, or an integrated distance acquisition method. The electronic equipment of the device, wherein the distance acquisition device can be implemented by means of hardware or software. The electronic device may be a device equipped with a processor and having data processing capability, such as a smart phone, a tablet computer, a palmtop computer, and a notebook computer.

请参照图1,图1为本申请实施例提供的距离获取方法的流程示意图,如图1所示,该距离获取方法应用于电子设备,本申请实施例提供的距离获取方法的流程可以如下:Please refer to FIG. 1, which is a schematic flowchart of a distance acquisition method provided by an embodiment of the present application. As shown in FIG. 1, the distance acquisition method is applied to an electronic device, and the process of the distance acquisition method provided by the embodiment of the present application may be as follows:

101、与外部设备进行时间同步,得到所述电子设备与所述外部设备之间的时间差。101. Perform time synchronization with an external device to obtain a time difference between the electronic device and the external device.

其中,在本申请实施例中,外部设备是与电子设备进行空间距离测算的对端设备,通过测算电子设备与外部设备之间的距离,可实现对电子设备所在位置与外部设备所在位置的空间测算。Among them, in the embodiment of the present application, the external device is the peer device that performs spatial distance measurement with the electronic device. Calculate.

其中,由于不同设备的本地时钟的计时速率、运行环境存在不同,使得不同设备的计时时间存在差异,而本申请实施例通过电子设备与外部设备的时间同步,可以得到电子设备与外部设备在计时上的时间差。其中,该时间差的获取可便于后续根据该时间差获取到测距信号的实际传播时间,进而实现对电子设备与外部设备之间空间距离的有效测算。Among them, due to the different timing rates and operating environments of the local clocks of different devices, the timing times of different devices are different, and in the embodiment of the present application, by synchronizing the time between the electronic device and the external device, it is possible to obtain the electronic device and the external device. time difference. The acquisition of the time difference can facilitate the subsequent acquisition of the actual propagation time of the ranging signal according to the time difference, thereby realizing effective measurement of the spatial distance between the electronic device and the external device.

其中,在本申请实施例中,电子设备与外部设备的时间同步可以通过数据传输链路来实现,例如,通过在电子设备和外部设备之间建立数据传输链路,使得电子设备和外部设备之间可以通过数据传输链路互相交换时间信息,实现电子设备与外部设备之间的时间同步,即,可选的,在本申请的一些实施例中,步骤“与外部设备进行时间同步”,包括:Wherein, in the embodiment of the present application, the time synchronization between the electronic device and the external device may be implemented through a data transmission link, for example, by establishing a data transmission link between the electronic device and the external device, so that the electronic device and the external device Time information can be exchanged with each other through a data transmission link to realize time synchronization between the electronic device and the external device, that is, optionally, in some embodiments of the present application, the step of "synchronizing time with the external device" includes :

通过所述电子设备的通信芯片与所述外部设备的通信芯片建立数据传输链路;Establish a data transmission link with the communication chip of the external device through the communication chip of the electronic device;

通过所述数据传输链路与所述外部设备进行时间同步。Time synchronization is performed with the external device via the data transmission link.

其中,在本申请实施例中,电子设备和外部设备内部均可以设置通信芯片,例如,请参阅图2,图2是本申请实施例提供的电子设备与外部设备的交互示意图,其中,通过通信芯片来建立电子设备与外部设备之间的数据传输链路,比如,通信芯片之间可以互相交换地址信息,根据地址信息建立电子设备与外部设备之间的数据传输链路。Wherein, in this embodiment of the present application, both the electronic device and the external device may be provided with a communication chip. For example, please refer to FIG. 2. FIG. 2 is a schematic diagram of interaction between the electronic device and the external device provided by the embodiment of the present application. The chip is used to establish a data transmission link between the electronic device and the external device. For example, the communication chips can exchange address information with each other, and establish a data transmission link between the electronic device and the external device according to the address information.

其中,电子设备和外部设备在通过数据传输链路互相交换时间信息之后,可各自实现对方时间信息的获取,实现电子设备与外部设备的时间同步,进而实现对电子设备与外部设备之间时间差的获取。Among them, after the electronic device and the external device exchange time information with each other through the data transmission link, each can obtain the time information of the other party, realize the time synchronization between the electronic device and the external device, and then realize the time difference between the electronic device and the external device. Obtain.

102、向所述外部设备传输测距信号的目标发送时刻以及所述时间差。102. Transmit the target sending time of the ranging signal and the time difference to the external device.

其中,测距信号是一种可发送和可接收的信号,通过两个物体分别对测距信号的发送和接收,可获取到测距信号在两个物体之间的传播时间,而测距信号在两个物体之间的传播时间可用来对两个物体之间距离的计算,例如,通过测距信号在两个物体之间的传播时间以及传播速率可实现对传播时间内测距信号移动距离的计算,其中,该测距信号的移动距离即为两个物体之间的空间距离。Among them, the ranging signal is a signal that can be sent and received. By sending and receiving the ranging signal by two objects respectively, the propagation time of the ranging signal between the two objects can be obtained. The propagation time between two objects can be used to calculate the distance between the two objects. For example, the propagation time of the ranging signal between the two objects and the propagation rate can be used to realize the travel distance of the ranging signal in the propagation time. , where the moving distance of the ranging signal is the spatial distance between two objects.

其中,在本申请实施例中,目标发送时刻是发送测距信号的时刻,通过将目标发送时刻传输给外部设备,使得外部设备在接收到电子设备发送测距信号的发送时刻后,可以根据该发送时刻做出测距信号接收的准备,便于外部设备顺利接收到测距信号,而测距信号的顺利发送和接收,可实现对测距信号传播时间的准确获取,便于后续电子设备与外部设备之间空间距离的测算。Among them, in the embodiment of the present application, the target sending time is the time when the ranging signal is sent. By transmitting the target sending time to the external device, after receiving the sending time of the ranging signal sent by the electronic device, the external device can The preparation for receiving the ranging signal is made at the time of sending, which is convenient for the external device to receive the ranging signal smoothly. Calculation of the spatial distance between.

其中,在本申请实施例中,目标发送时刻可以通过双方协商的方式确定,例如,电子设备与外部设备可以先进行时间信息的交换,互相确定各自空闲的时间,从空闲时间中确定出目标发送时刻。其中,在本申请实施例中,目标发送时刻位于时间同步时的节点时间之后,即,在电子设备和外部设备的时间同步之后,才进行测距信号的发送,确保测距信号传播时间的有效获取。Among them, in this embodiment of the present application, the target sending time may be determined through negotiation between the two parties. For example, the electronic device and the external device may first exchange time information, mutually determine their respective idle time, and determine the target sending time from the idle time. time. Among them, in the embodiment of the present application, the target sending time is located after the node time during time synchronization, that is, after the time synchronization between the electronic device and the external device, the sending of the ranging signal is performed to ensure the validity of the propagation time of the ranging signal. Obtain.

其中,在本申请实施例中,通过将时间差发送给外部设备,使得外部设备在接收到测距信号之后,即可根据目标发送时刻、实际接收时刻以及时间差确定出测距信号在电子设备和外部设备之间传播的实际时间,实现测距信号实际传播时间的快速获取。Among them, in the embodiment of the present application, by sending the time difference to the external device, after receiving the ranging signal, the external device can determine whether the ranging signal is between the electronic device and the external device according to the target sending time, the actual receiving time and the time difference. The actual propagation time between devices, to achieve rapid acquisition of the actual propagation time of the ranging signal.

103、在到达所述目标发送时刻时向所述外部设备发送所述测距信号。103. Send the ranging signal to the external device when the target sending time is reached.

其中,由于测距信号是由电子设备一侧发出,因此,该目标发送时刻以电子设备的本地时钟的时刻为基准,即,当电子设备的本地时钟达到目标发送时刻时,由电子设备将测距信号发出,并将测距信号发送给外部设备。Among them, since the ranging signal is sent from the side of the electronic device, the target sending time is based on the time of the local clock of the electronic device, that is, when the local clock of the electronic device reaches the target sending time, the electronic device will measure the time. The distance signal is sent out, and the distance measurement signal is sent to the external device.

其中,在本申请实施例中,可以通过测距芯片发送测距信号或者接收测距信号,即,可选的,在本申请的一些实施例中,步骤“在到达所述目标发送时刻时向所述外部设备发送所述测距信号”,包括:Among them, in the embodiments of the present application, the ranging signal may be sent or received through the ranging chip, that is, optionally, in some embodiments of the present application, the step of "sending to the target sending time when the The external device sends the ranging signal", including:

在达到所述目标发送时刻时,通过所述电子设备的测距芯片向所述外部设备的测距芯片发送所述测距信号。When the target sending time is reached, the ranging signal is sent to the ranging chip of the external device through the ranging chip of the electronic device.

其中,通过电子设备中的测距芯片可以实现向外部设备发送测距信号,而通过外部设备中的测距芯片可实现对电子设备中测距芯片发送过来的测距信号的接收。The ranging chip in the electronic device can send ranging signals to the external device, and the ranging chip in the external device can receive the ranging signal sent by the ranging chip in the electronic device.

其中,在本申请实施例中,通信芯片可以与测距芯片不同,例如,在本申请的一些实施例中,通信芯片与测距芯片发送和接收的信号类型不同。Wherein, in the embodiments of the present application, the communication chip may be different from the ranging chip. For example, in some embodiments of the present application, the types of signals sent and received by the communication chip and the ranging chip are different.

其中,通过发送和接收的信号类型的不同,可实现对时间同步任务和测距任务的明显区分,例如,通过一类信号建立数据传输链路进行时间同步,而另一类信号进行距离计算,避免信号混乱干扰距离测算结果。Among them, the different types of signals sent and received can clearly distinguish between time synchronization tasks and ranging tasks. For example, one type of signal is used to establish a data transmission link for time synchronization, while another type of signal is used for distance calculation. Avoid signal confusion interfering with distance measurement results.

例如,在本申请实施例中,通信芯片包括蓝牙芯片、紫蜂协议芯片、无线保真网络芯片、超带宽芯片或者近场通信芯片中的至少一种;测距芯片包括超声波测距芯片、电磁波测距芯片或者音频芯片中的至少一种。比如,通过蓝牙建立电子设备与外部设备之间的数据传输链路,进而根据该数据传输链路进行电子设备与外部设备之间的时间同步,而通过超声波的发送和接收实现电子设备与外部设备之间空间距离的计算。其中,针对超声波信号的发送和接收来实现电子设备和外部设备之间空间距离的计算,可以在电子设备和外部设备上设置超声波测距芯片来进行超声波信号的发送和接收。For example, in the embodiment of the present application, the communication chip includes at least one of a Bluetooth chip, a Zigbee protocol chip, a wireless fidelity network chip, an ultra-wideband chip, or a near-field communication chip; the ranging chip includes an ultrasonic ranging chip, an electromagnetic wave At least one of a ranging chip or an audio chip. For example, a data transmission link between an electronic device and an external device is established through Bluetooth, and then the time synchronization between the electronic device and the external device is performed according to the data transmission link, and the transmission and reception of ultrasonic waves are used to realize the electronic device and the external device. Calculation of the spatial distance between. Among them, for the transmission and reception of ultrasonic signals to realize the calculation of the spatial distance between the electronic device and the external device, an ultrasonic ranging chip can be set on the electronic device and the external device to transmit and receive the ultrasonic signal.

其中,在本申请实施例中,音频芯片是电子设备和外部设备上自带的音频设备组件,当该音频设备组件可以进行相应信号(如超声波信号)的发送和接收时,则可以直接通过电子设备和外部设备上的音频设备组件实现相应信号的发送和接收,而无需额外配置相应的测距芯片。Among them, in the embodiment of the present application, the audio chip is the audio device component that comes with the electronic device and the external device. When the audio device component can send and receive corresponding signals (such as ultrasonic signals), it can directly pass the electronic device. The audio device components on the device and the external device realize the transmission and reception of corresponding signals without additional configuration of the corresponding ranging chip.

其中,在本申请实施例中,测距芯片对应音频模组,例如,在本申请实施例中,通过电子设备的音频模组向外部设备发送测距信号(如超声波信号),而外部设备通过外部设备的音频模组接收电子设备中音频模组发送的测距信号(如对应电子设备发送的超声波信号)。Among them, in the embodiment of the present application, the ranging chip corresponds to the audio module. For example, in the embodiment of the present application, the audio module of the electronic device sends a ranging signal (such as an ultrasonic signal) to the external device, and the external device passes the The audio module of the external device receives the ranging signal sent by the audio module in the electronic device (for example, the ultrasonic signal sent by the corresponding electronic device).

其中,由于设备之间时间同步和测距信号的发送与接收采用不同的模组,而各个模组的计时受各自本地时钟的计时速率、运行环境等因素的影响,使得各个模组的计时时间存在差异,如图2所示,针对电子设备,该电子设备中的通信芯片的本地时间也与该电子设备中的测距芯片的音频时间存在计时差异;针对外部设备,该外部设备中通信芯片的本地时间也与该外部设备中测距芯片的音频时间存在计时差异。Among them, different modules are used for the time synchronization between devices and the transmission and reception of ranging signals, and the timing of each module is affected by the timing rate of their respective local clocks, the operating environment and other factors, so that the timing time of each module is There are differences, as shown in Figure 2, for electronic devices, the local time of the communication chip in the electronic device also has timing differences with the audio time of the ranging chip in the electronic device; for external devices, the communication chip in the external device has a timing difference. There is also a timing difference with the audio time of the ranging chip in this external device.

然而,为了获取测距信号的传播时间,需要明确电子设备中发送测距信号的音频模组的发送时间以及外部设备中接收测距信号的接收时间,但是,由于两个设备的音频模组在计时上存在时间差,因此,需要去除该时间差的影响才能得到测距信号准确的传播时间。However, in order to obtain the propagation time of the ranging signal, it is necessary to clarify the transmission time of the audio module that sends the ranging signal in the electronic device and the reception time of the ranging signal received in the external device. However, since the audio modules of the two devices are in the There is a time difference in timing. Therefore, it is necessary to remove the influence of the time difference to obtain the accurate propagation time of the ranging signal.

例如,请参阅图2,由于测距信号的发送和接收是通过音频模组(对应的测距芯片)来完成的,因此,电子设备与外部设备之间的时间差是针对音频模组计时的时间差,而,由于本申请实施例中是采用通信芯片进行时间同步,因此,需要根据两个通信芯片计时的时间差以及每个设备中通信芯片与音频模组的时间差来确定电子设备与外部设备之间音频模组计时的时间差,即,可选的,在本申请的一些实施例中,步骤“得到所述电子设备与所述外部设备之间的时间差”,包括:For example, please refer to Figure 2, since the transmission and reception of the ranging signal is completed by the audio module (corresponding ranging chip), the time difference between the electronic device and the external device is the time difference for the audio module timing However, since the communication chip is used for time synchronization in the embodiment of the present application, it is necessary to determine the difference between the electronic device and the external device according to the time difference between the two communication chips and the time difference between the communication chip and the audio module in each device. The time difference of the audio module timing, that is, optionally, in some embodiments of the present application, the step "obtaining the time difference between the electronic device and the external device" includes:

根据所述电子设备的通信芯片的本地时间和所述外部设备的通信芯片的本地时间,得到本地时间差;Obtain the local time difference according to the local time of the communication chip of the electronic device and the local time of the communication chip of the external device;

根据所述电子设备的通信芯片的本地时间以及所述电子设备的测距芯片的音频时间,得到第一通信音频时间差;Obtain the first communication audio time difference according to the local time of the communication chip of the electronic device and the audio time of the ranging chip of the electronic device;

根据所述外部设备的通信芯片的本地时间以及所述外部设备的测距芯片的音频时间,得到第二通信音频时间差;Obtain the second communication audio time difference according to the local time of the communication chip of the external device and the audio time of the ranging chip of the external device;

根据所述本地时间差、第一通信音频时间差和所述第二通信音频时间差,得到所述电子设备与所述外部设备的时间差。According to the local time difference, the first communication audio time difference and the second communication audio time difference, the time difference between the electronic device and the external device is obtained.

其中,在本申请实施例中,本地时间是通信芯片的计时时间,音频时间是测距芯片的计时时间。Wherein, in the embodiment of the present application, the local time is the timing time of the communication chip, and the audio time is the timing time of the ranging chip.

其中,通过两个通信芯片计时存在的本地时间差,以及每个设备中通信芯片与测距芯片的计时时间差,可以得到两个设备在音频模组计时上的时间差,例如,当电子设备的本地时间与外部设备的本地时间的计时时间差为100ms、电子设备中本地时间与音频时间的计时时间差为100ms、且外部设备中本地时间与音频时间的计时时间差为200ms,则电子设备与外部设备的音频时间的计时时间差为400ms(即100ms+100ms+200ms)。Among them, through the local time difference existing in the timing of the two communication chips, and the timing difference between the communication chip and the ranging chip in each device, the time difference between the two devices in the audio module timing can be obtained. For example, when the local time of the electronic device If the timing difference with the local time of the external device is 100ms, the timing difference between the local time in the electronic device and the audio time is 100ms, and the timing difference between the local time in the external device and the audio time is 200ms, then the audio time between the electronic device and the external device The timing difference is 400ms (ie 100ms+100ms+200ms).

104、接收所述外部设备返回的所述外部设备与所述电子设备之间的空间距离,所述空间距离由所述外部设备根据所述测距信号、所述目标发送时刻、所述时间差以及所述外部设备接收到所述测距信号的实际接收时刻计算得到的。104. Receive the spatial distance between the external device and the electronic device returned by the external device, where the spatial distance is determined by the external device according to the ranging signal, the target sending time, the time difference, and It is calculated by the actual receiving moment when the external device receives the ranging signal.

其中,由于外部设备一侧在接收到测距信号以后,已经获取到了测距信号的发送时刻、接收时刻、时间差以及测距信号的类型,因此,外部设备可直接根据测距信号的发送时刻、接收时刻、时间差以及测距信号计算出该外部设备与电子设备之间的空间距离,加快电子设备与外部设备之间空间距离的计算。Among them, after receiving the ranging signal, the external device has obtained the sending time, receiving time, time difference and the type of the ranging signal. Therefore, the external device can directly The receiving time, the time difference and the ranging signal are used to calculate the spatial distance between the external device and the electronic device, so as to speed up the calculation of the spatial distance between the electronic device and the external device.

其中,电子设备通过接收外部设备返回的外部设备与电子设备之间的空间距离,实现测距信号发送一方对空间距离的获取,便于测距信号发送方对空间距离的应用,例如,在实际应用中,用户可以通过电子设备向外部设备发送测距信号,并直接接收外部设备返回的空间距离,实现用户通过电子设备直接获取到与外部设备之间的距离,实现物体之间距离的远程测量,无需手工实地测量,提升测距效率。Among them, the electronic device realizes the acquisition of the spatial distance by the sender of the ranging signal by receiving the spatial distance between the external device and the electronic device returned by the external device, which facilitates the application of the spatial distance by the sender of the ranging signal. For example, in practical applications , the user can send ranging signals to the external device through the electronic device, and directly receive the spatial distance returned by the external device, so that the user can directly obtain the distance from the external device through the electronic device, and realize the remote measurement of the distance between objects. There is no need for manual on-the-spot measurement, which improves the efficiency of ranging.

其中,本申请实施例通过电子设备与外部设备进行时间同步,得到电子设备与外部设备之间的时间差,并进一步利用该时间差,通过一次测距信号的发送和接收即可实现电子设备与外部设备之间的测距,相较于相关技术,本申请无需测距信号接收时刻的发送,外部设备直接根据目标发送时刻、实际接收时刻和时间差计算处与电子设备的空间距离,减少数据发送次数,能够提升设备间距离测算的效率。其中,通过向外部设备发送测距信号的目标发送时间,便于外部设备根据目标发送时间做出测距信号接收的准备,确保测距信号的顺利发送和接收,而测距信号的顺利发送和接收为设备之间距离的准确测算提供基础。其中,通过将测算的空间距离返回给测距信号的发送方,可实现测距信号发送方在发送测距信号后获取到与外部设备之间的空间距离,便于后续对该空间距离的应用。Among them, in the embodiment of the present application, the time synchronization between the electronic device and the external device is performed to obtain the time difference between the electronic device and the external device, and the time difference is further utilized to realize the electronic device and the external device through one transmission and reception of the ranging signal. Compared with the related art, the present application does not require the transmission of the receiving time of the ranging signal, and the external device directly calculates the spatial distance between the place and the electronic device according to the target sending time, the actual receiving time and the time difference, reducing the number of data transmissions, It can improve the efficiency of distance measurement between devices. Among them, by sending the target sending time of the ranging signal to the external device, it is convenient for the external device to prepare for receiving the ranging signal according to the target sending time, so as to ensure the smooth sending and receiving of the ranging signal, and the smooth sending and receiving of the ranging signal. Provide a basis for accurate measurement of the distance between devices. Among them, by returning the measured spatial distance to the sender of the ranging signal, the sender of the ranging signal can obtain the spatial distance with the external device after sending the ranging signal, which is convenient for subsequent application of the spatial distance.

请参照图3,图3是本申请实施例提供的距离获取方法的另一流程示意图,该距离获取方法应用于电子设备,本申请实施例提供的距离获取方法的流程可以如下:Please refer to FIG. 3. FIG. 3 is another schematic flowchart of a distance acquisition method provided by an embodiment of the present application. The distance acquisition method is applied to an electronic device. The process of the distance acquisition method provided by the embodiment of the present application may be as follows:

201、与外部设备进行时间同步,得到所述电子设备与所述外部设备之间的时间差。201. Perform time synchronization with an external device to obtain a time difference between the electronic device and the external device.

其中,在本申请实施例中,外部设备是与电子设备进行空间距离测算的对端设备,通过测算电子设备与外部设备之间的距离,可实现对电子设备所在位置与外部设备所在位置的空间测算。Among them, in the embodiment of the present application, the external device is the peer device that performs spatial distance measurement with the electronic device. Calculate.

其中,由于不同设备的本地时钟的计时速率、运行环境存在不同,使得不同设备的计时时间存在差异,而本申请实施例通过电子设备与外部设备的时间同步,可以得到电子设备与外部设备在计时上的时间差。其中,该时间差的获取可便于后续根据该时间差获取到测距信号的实际传播时间,进而实现对电子设备与外部设备之间空间距离的有效测算。Among them, due to the different timing rates and operating environments of the local clocks of different devices, the timing times of different devices are different, and in the embodiment of the present application, by synchronizing the time between the electronic device and the external device, it is possible to obtain the electronic device and the external device. time difference. The acquisition of the time difference can facilitate the subsequent acquisition of the actual propagation time of the ranging signal according to the time difference, thereby realizing effective measurement of the spatial distance between the electronic device and the external device.

202、接收所述外部设备传输测距信号的目标发送时刻。202. Receive the target sending time of the ranging signal transmitted by the external device.

其中,测距信号是一种可发送和可接收的信号,通过两个物体分别对测距信号的发送和接收,可获取到测距信号在两个物体之间的传播时间,而测距信号在两个物体之间的传播时间可用来对两个物体之间距离的计算,例如,通过测距信号在两个物体之间的传播时间以及传播速率可实现对传播时间内测距信号移动距离的计算,其中,该测距信号的移动距离即为两个物体之间的空间距离。Among them, the ranging signal is a signal that can be sent and received. By sending and receiving the ranging signal by two objects respectively, the propagation time of the ranging signal between the two objects can be obtained. The propagation time between two objects can be used to calculate the distance between the two objects. For example, the propagation time of the ranging signal between the two objects and the propagation rate can be used to realize the travel distance of the ranging signal in the propagation time. , where the moving distance of the ranging signal is the spatial distance between two objects.

其中,在本申请实施例中,目标发送时刻是发送测距信号的时刻,通过在发送测距信号之前接收到外部设备发送过来的目标发送时刻,可根据该目标发送时刻做出测距信号接收的准备,便于顺利的接收到外部设备发送过来的测距信号,而测距信号的顺利接收,可实现对测距信号接收时间的获取,以及进一步可实现对测距信号传播时间的计算,便于后续电子设备与外部设备之间空间距离的测算。Among them, in the embodiment of the present application, the target sending time is the time when the ranging signal is sent. By receiving the target sending time sent by the external device before sending the ranging signal, the ranging signal can be received according to the target sending time. It is convenient to receive the ranging signal sent by the external device smoothly, and the smooth reception of the ranging signal can realize the acquisition of the receiving time of the ranging signal, and further realize the calculation of the propagation time of the ranging signal, which is convenient for The measurement of the spatial distance between subsequent electronic equipment and external equipment.

其中,在本申请实施例中,目标发送时刻可以通过双方协商的方式确定,例如,电子设备与外部设备可以先进行时间信息的交换,互相确定各自空闲的时间,从空闲时间中确定出目标发送时刻。其中,在本申请实施例中,目标发送时刻位于时间同步时的节点时间之后,即,在电子设备和外部设备的时间同步之后,才进行测距信号的发送,确保测距信号的顺利接收。Among them, in this embodiment of the present application, the target sending time may be determined through negotiation between the two parties. For example, the electronic device and the external device may first exchange time information, mutually determine their respective idle time, and determine the target sending time from the idle time. time. Among them, in the embodiment of the present application, the target sending time is located after the node time during time synchronization, that is, after the electronic device and the external device are time synchronized, the ranging signal is sent to ensure smooth reception of the ranging signal.

203、接收所述外部设备发送的所述测距信号。203. Receive the ranging signal sent by the external device.

其中,通过接收外部设备发送过来的测距信号,可以将测距信号接收的时刻作为实际接收时刻,其中,实际接收时刻的获取便于后续测距信号传播时间的计算。Wherein, by receiving the ranging signal sent by the external device, the moment when the ranging signal is received can be taken as the actual receiving moment, wherein the acquisition of the actual receiving moment is convenient for the subsequent calculation of the propagation time of the ranging signal.

其中,由于测距信号是由电子设备接收的,因此,实际接收时间以电子设备的时钟计时为准。其中,考虑到电子设备与外部设备之间存在计时的时间差,因此,需要根据测距信号的目标发送时刻、实际接收时刻以及时间差计算得到测距信号的传播时间。Among them, since the ranging signal is received by the electronic device, the actual receiving time is based on the clock of the electronic device. Among them, considering that there is a timing difference between the electronic device and the external device, the propagation time of the ranging signal needs to be calculated according to the target sending time, the actual receiving time and the time difference of the ranging signal.

204、根据所述目标发送时刻、所述时间差、所述测距信号以及接收到所述测距信号的实际接收时刻,计算所述电子设备与所述外部设备之间的空间距离,并将所述空间距离发送给所述外部设备。204. Calculate the spatial distance between the electronic device and the external device according to the target sending time, the time difference, the ranging signal, and the actual receiving time when the ranging signal is received, and calculate the distance between the electronic device and the external device. The spatial distance is sent to the external device.

其中,由于电子设备一侧在接收到测距信号以后,已经获取到了测距信号的发送时刻、接收时刻、时间差以及测距信号的类型,因此,电子设备可直接根据测距信号的发送时刻、接收时刻、时间差以及测距信号计算出该电子设备与外部设备之间的空间距离,加快电子设备与外部设备之间空间距离的计算。Among them, since the electronic device has obtained the transmission time, reception time, time difference, and type of the ranging signal after receiving the ranging signal, the electronic device can directly The receiving time, the time difference and the ranging signal are used to calculate the spatial distance between the electronic device and the external device, so as to speed up the calculation of the spatial distance between the electronic device and the external device.

其中,电子设备通过将与外部设备之间的空间距离返回给外部设备,使得外部设备在发送测距信号之后可以直接得到与电子设备之间的空间距离,便于测距信号发送方对空间距离的获取和应用。Among them, by returning the spatial distance between the electronic device and the external device to the external device, the external device can directly obtain the spatial distance with the electronic device after sending the ranging signal, which is convenient for the sender of the ranging signal to determine the spatial distance. Get and apply.

其中,在本申请实施例中,由于测距信号在传播过程中会受外部环境的影响,因此,在根据传播时间和测距信号计算电子设备与外部设备之间的空间距离时,还可以根据测距信号在传播过程中的衰减系数来计算空间距离,提升空间距离测算的准确性,即,可选的,在本申请的一些实施例中,步骤“根据所述目标发送时刻、所述时间差、所述测距信号以及接收到所述测距信号的实际接收时刻,计算所述电子设备与所述外部设备之间的空间距离”,包括:Among them, in this embodiment of the present application, since the ranging signal will be affected by the external environment during the propagation process, when calculating the spatial distance between the electronic device and the external device according to the propagation time and the ranging signal, the distance between the electronic device and the external device can also be calculated according to the The attenuation coefficient of the ranging signal during the propagation process is used to calculate the spatial distance, so as to improve the accuracy of the spatial distance measurement. , the ranging signal and the actual receiving moment when the ranging signal is received, and calculating the spatial distance between the electronic device and the external device", including:

确定所述测距信号的传播衰减系数;determining a propagation attenuation coefficient of the ranging signal;

根据所述目标发送时刻、所述时间差、所述传播衰减系数以及接收到所述测距信号的实际接收时刻,计算所述电子设备与所述外部设备的空间距离。Calculate the spatial distance between the electronic device and the external device according to the target sending time, the time difference, the propagation attenuation coefficient, and the actual receiving time when the ranging signal is received.

其中,在本申请实施例中传播衰减系数可以通过多次实验得到,基于不同的外部环境,该传播衰减系数存在不同,其中,本申请实施例对传播衰减系数的具体数值以及获取方式不做限定。Wherein, in the embodiment of the present application, the propagation attenuation coefficient can be obtained through multiple experiments. Based on different external environments, the propagation attenuation coefficient is different. The specific value and acquisition method of the propagation attenuation coefficient are not limited in the embodiment of the present application. .

其中,在本申请实施例中,在计算电子设备与外部设备之间的空间距离时,还可以通过校验的方式来提升设备之间空间距离测算的准确性,即,可选的,在本申请的一些实施例中,步骤“根据所述目标发送时刻、所述时间差、所述测距信号以及接收到所述测距信号的实际接收时刻,计算所述电子设备与所述外部设备之间的空间距离”,包括:Among them, in the embodiment of the present application, when calculating the spatial distance between the electronic device and the external device, the accuracy of the measurement of the spatial distance between the devices can also be improved by means of verification, that is, optionally, in this In some embodiments of the application, the step "calculates the distance between the electronic device and the external device according to the target sending time, the time difference, the ranging signal, and the actual receiving time when the ranging signal is received. the spatial distance", including:

解调所述测距信号,得到设备标识信息;demodulating the ranging signal to obtain device identification information;

若所述设备标识信息为预设的设备标识信息,根据所述目标发送时刻、所述时间差、所述测距信号以及接收到所述测距信号的实际接收时刻,计算所述电子设备与所述外部设备之间的空间距离。If the device identification information is preset device identification information, according to the target sending time, the time difference, the ranging signal, and the actual receiving time when the ranging signal is received, calculate the difference between the electronic device and the device. the spatial distance between the external devices.

其中,通过对测距信号中设备标识信息的校验,可判断出测距信号的发送方是否是预先设定的设备,例如,在本申请实施例中,预设的设备标识信息是与电子设备预先建立授权的设备的标识信息,该授权操作可确保测距信号来源的可靠性、安全性和有效性。Wherein, by checking the device identification information in the ranging signal, it can be determined whether the sender of the ranging signal is a preset device. For example, in this embodiment of the present application, the preset device identification information is the same as the electronic device The device pre-establishes the identification information of the authorized device, and the authorization operation can ensure the reliability, security and validity of the source of the ranging signal.

其中,在本申请实施例中,可以将建立数据通信链路的对方设备设置为授权的设备,通过测距信号的发送方与数据通信链路的对方设置为一致的,可确保测距信号发送时刻、时间差等信息的有效性,有利于实现对传播时间以及空间距离的有效测算。Among them, in the embodiment of the present application, the counterpart device that establishes the data communication link can be set as an authorized device, and the transmitter of the ranging signal and the counterpart of the data communication link are set to be consistent, so that the transmission of the ranging signal can be ensured The validity of information such as time and time difference is conducive to the effective measurement of propagation time and spatial distance.

其中,本申请实施例通过电子设备与外部设备进行时间同步,确定电子设备与外部设备之间的时间差,以便于根据该时间差计算测距信号在电子设备和外部设备之间传播的有效时间,便于后续根据该有效的传播时间计算出电子设备与外部设备之间的空间距离。其中,通过将计算得到的空间距离返回给外部设备,使得发送测距信号的外部设备可以在发送测距信号后直接获取到电子设备与外部设备之间的空间距离,便于该空间距离的获取和应用。Among them, in the embodiment of the present application, the time synchronization between the electronic device and the external device is performed to determine the time difference between the electronic device and the external device, so as to calculate the effective time for the ranging signal to propagate between the electronic device and the external device according to the time difference, which is convenient for Subsequently, the spatial distance between the electronic device and the external device is calculated according to the effective propagation time. Among them, by returning the calculated spatial distance to the external device, the external device that sends the ranging signal can directly obtain the spatial distance between the electronic device and the external device after sending the ranging signal, which facilitates the acquisition of the spatial distance and application.

请参阅图4,图4是本申请实施例提供的设备之间时间同步并进行设备之间测距的具体流程示意图,其中,该设备之间时间同步并进行设备之间测距的具体流程如下:Please refer to FIG. 4 . FIG. 4 is a schematic diagram of a specific flow of time synchronization between devices and ranging between devices provided by an embodiment of the present application. The specific process of time synchronization between devices and ranging between devices is as follows :

301、电子设备与外部设备先通过蓝牙建立连接;其中,蓝牙连接方式可以包括传统蓝牙(classic BT)或者低功耗蓝牙(BLE);301. First establish a connection between the electronic device and the external device through Bluetooth; wherein, the Bluetooth connection method may include traditional Bluetooth (classic BT) or low-power Bluetooth (BLE);

302、通过蓝牙链接层(linklayer)的时间同步机制将电子设备与外部设备的蓝牙本地时钟(RTC,real time clock)对齐,得到电子设备蓝牙本地时间与外部设备蓝牙本地时间的时间差;302, align the Bluetooth local clock (RTC, real time clock) of electronic equipment and external equipment by the time synchronization mechanism of bluetooth link layer (linklayer), obtain the time difference of electronic equipment bluetooth local time and external equipment bluetooth local time;

303、针对电子设备,将电子设备中蓝牙本地时间与音频本地时间通过软总线或硬总线方式实现微秒(us)级的时间同步,得到电子设备中蓝牙本地时间与音频本地时间的时间差;同理,得到外部设备中蓝牙本地时间与音频本地时间的时间差;303. For the electronic device, realize the microsecond (us)-level time synchronization between the Bluetooth local time in the electronic device and the audio local time through a soft bus or a hard bus, and obtain the time difference between the Bluetooth local time and the audio local time in the electronic device; the same to get the time difference between the Bluetooth local time and the audio local time in the external device;

304、通过蓝牙获取到对方蓝牙本地时间与音频本地时间的时间差,根据电子设备与外部设备蓝牙本地时间的时间差、电子设备中蓝牙本地时间与音频时间的时间差以及外部设备中蓝牙本地时间与音频本地时间的时间差,得到电子设备与外部设备的音频时间差,该音频时间差即为电子设备与外部设备的时间差(同步时间参数)Tsys;304. Obtain the time difference between the other party's Bluetooth local time and the audio local time through Bluetooth, according to the time difference between the Bluetooth local time of the electronic device and the external device, the time difference between the Bluetooth local time and the audio time in the electronic device, and the Bluetooth local time and the audio local time in the external device. The time difference of time, the audio time difference between the electronic device and the external device is obtained, and the audio time difference is the time difference (synchronization time parameter) Tsys between the electronic device and the external device;

305、电子设备下发指令通过蓝牙向外部设备发送数据包,其中数据包中包含有指令信息以及超声波发射的时间信息TS1;305. The electronic device issues an instruction to send a data packet to an external device through Bluetooth, wherein the data packet contains instruction information and time information TS1 of ultrasonic transmission;

306、外部设备在接收到数据包时,解析数据包得到指令信息和超声波的发射时间信息TS1,并根据超声波的发射时间TS1触发超声波接收指令,开始接收超声波信号;306. When receiving the data packet, the external device parses the data packet to obtain the instruction information and the transmission time information TS1 of the ultrasonic wave, and triggers the ultrasonic wave receiving instruction according to the transmission time TS1 of the ultrasonic wave, and starts to receive the ultrasonic wave signal;

307、当达到超声波发射时间TS1时,由电子设备向外部设备发送超声波信号,并通过超声波调制电子设备的蓝牙地址信息或者设备标识信息;307. When the ultrasonic transmission time TS1 is reached, the electronic device sends an ultrasonic signal to the external device, and modulates the Bluetooth address information or device identification information of the electronic device through the ultrasonic wave;

308、当外部设备接收到超声波信号时,记录接收到超声波信号的接收时间TS2,并解调超声波信号得到电子设备的蓝牙地址信息或者设备标识信息;308. When the external device receives the ultrasonic signal, record the reception time TS2 of the received ultrasonic signal, and demodulate the ultrasonic signal to obtain the Bluetooth address information or device identification information of the electronic device;

309、当外部设备解调超声波信号得到的蓝牙地址信息或者设备标识信息与电子设备(建立蓝牙连接的电子设备)的蓝牙地址信息或者设备标识信息一致时,根据超声波信号的发射时间TS1和超声波信号的接收时间TS2以及时间差Tsys计算电子设备与外部设备之间的空间距离;309. When the Bluetooth address information or device identification information obtained by the external device demodulating the ultrasonic signal is consistent with the Bluetooth address information or device identification information of the electronic device (electronic device establishing a Bluetooth connection), according to the transmission time TS1 of the ultrasonic signal and the ultrasonic signal The receiving time TS2 and the time difference Tsys calculate the spatial distance between the electronic device and the external device;

310、外部设备将与电子设备的空间距离发送给电子设备。310. The external device sends the spatial distance from the electronic device to the electronic device.

其中,在本申请实施例中,电子设备与外部设备之间的空间距离L可以通过如下公式计算,具体包括:Wherein, in the embodiment of the present application, the spatial distance L between the electronic device and the external device can be calculated by the following formula, which specifically includes:

L=340*K*(TS2-TS1+Tsys)L=340*K*(TS2-TS1+Tsys)

其中,K为外部因素影响声速传播因子,也即超声波在电子设备与外部设备之间传播时的传播衰减系数;Tsys为电子设备与外部设备音频时间的同步时间参数。Among them, K is the propagation factor of the speed of sound affected by external factors, that is, the propagation attenuation coefficient of the ultrasonic wave when it propagates between the electronic device and the external device; Tsys is the synchronization time parameter of the audio time of the electronic device and the external device.

其中,通过电子设备与外部设备之间蓝牙链路的建立,可根据蓝牙链路实现蓝牙本地时间和音频本地时间的交换,进一步实现电子设备与外部设备之间的时间同步,而通过时间同步后的电子设备和外部设备,可实现测距信号在电子设备和外部设备之间传播时间的有效获取,测距信号传播时间的获取可实现对电子设备与外部设备之间空间距离的测算。Among them, through the establishment of the Bluetooth link between the electronic device and the external device, the Bluetooth local time and the audio local time can be exchanged according to the Bluetooth link, and the time synchronization between the electronic device and the external device can be further realized. The electronic equipment and external equipment can realize the effective acquisition of the propagation time of the ranging signal between the electronic equipment and the external equipment, and the acquisition of the propagation time of the ranging signal can realize the measurement of the spatial distance between the electronic equipment and the external equipment.

请参阅图5,图5是本申请实施例提供的距离获取过程中数据传输的流程示意图,其中,该距离获取过程中数据传输流程包括如下:Please refer to FIG. 5. FIG. 5 is a schematic flowchart of data transmission in a distance acquisition process provided by an embodiment of the present application, wherein the data transmission process in the distance acquisition process includes the following:

401、电子设备向外部设备发送蓝牙连接请求;401. The electronic device sends a Bluetooth connection request to an external device;

402、外部设备基于蓝牙连接请求与电子设备建立蓝牙连接链路;402. The external device establishes a Bluetooth connection link with the electronic device based on the Bluetooth connection request;

403、电子设备通过蓝牙连接链路向外部设备发送电子设备本地蓝牙时间;403. The electronic device sends the local Bluetooth time of the electronic device to the external device through the Bluetooth connection link;

404、外部设备接收到电子设备发送过来的电子设备本地蓝牙时间后向电子设备发送外部设备本地蓝牙时间;404. After receiving the local Bluetooth time of the electronic device sent by the electronic device, the external device sends the local Bluetooth time of the external device to the electronic device;

405、电子设备通过蓝牙连接链路向外部设备发送电子设备本地音频时间;405. The electronic device sends the local audio time of the electronic device to the external device through the Bluetooth connection link;

406、外部设备接收到电子设备发送过来的电子设备本地音频时间后向电子设备发送外部设备本地音频时间;并根据电子设备的蓝牙本地时间和音频本地时间以及外部设备的蓝牙本地时间和音频本地时间计算外部设备与电子设备的音频时间差(即时间差Tsys);406. After receiving the local audio time of the electronic device sent by the electronic device, the external device sends the local audio time of the external device to the electronic device; and according to the Bluetooth local time and audio local time of the electronic device and the Bluetooth local time and audio local time of the external device Calculate the audio time difference between the external device and the electronic device (that is, the time difference Tsys);

407、电子设备向外部设备发送测距信号的目标发送时刻TS1;外部设备在接收到目标发送时间后做出超声波信号接收准备;电子设备做出超声波信号发射准备;407. The target sending time TS1 when the electronic device sends the ranging signal to the external device; the external device makes preparations for receiving the ultrasonic signal after receiving the target sending time; the electronic device makes preparations for transmitting the ultrasonic signal;

408、经过一段时间到达目标发送时刻TS1后,电子设备向外部设备发送超声波信号;408. After reaching the target sending time TS1 after a period of time, the electronic device sends an ultrasonic signal to the external device;

409、外部设备接收到超声波信号,并解析超声波信号得到设备标识信息;409. The external device receives the ultrasonic signal, and analyzes the ultrasonic signal to obtain the device identification information;

410、当设备标识信息与电子设备的设备标识一致时,根据目标发送时刻TS1、超声波接收时刻TS2以及时间差Tsys计算外部设备与电子设备之间的空间距离;410, when the device identification information is consistent with the device identification of the electronic device, calculate the spatial distance between the external device and the electronic device according to the target sending time TS1, the ultrasonic receiving time TS2 and the time difference Tsys;

411、外部设备将与电子设备的空间距离发送给电子设备。411. The external device sends the spatial distance from the electronic device to the electronic device.

其中,通过电子设备与外部设备蓝牙连接链路的建立,便于电子设备与外部设备之间进行蓝牙本地时间和音频本地时间的发送或交换,而通过电子设备与外部设备之间蓝牙本地时间和音频本地时间的交换,可计算出电子设备与外部设备之间的时间差,便于测距信号传播时间的准确计算。其中,外部设备在接收到测距信号后,直接根据测距信号的发送时刻、接收时刻和时间差计算得到与电子设备的空间距离,实现空间距离的快速计算,其中,外部设备对空间距离的计算可避免电子设备一侧对空间距离的计算,相应的,可避免测距信号接收时刻向电子设备的发送,减少信息发送次数,提升空间距离计算效率。其中,通过将空间距离返回给电子设备,使得测距信号的发送方在发送测距信号后实现空间距离的直接获取,便于该空间距离的应用,同时,该种远程测算物体之间空间距离的方式也避免手工实地测量,提升距离测量的效率。Among them, through the establishment of the Bluetooth connection link between the electronic device and the external device, it is convenient to send or exchange the Bluetooth local time and the audio local time between the electronic device and the external device, and the Bluetooth local time and audio between the electronic device and the external device are facilitated. The exchange of local time can calculate the time difference between the electronic device and the external device, which is convenient for the accurate calculation of the propagation time of the ranging signal. Among them, after receiving the ranging signal, the external device directly calculates the spatial distance with the electronic device according to the sending time, receiving time and time difference of the ranging signal, so as to realize the fast calculation of the spatial distance. Among them, the external device calculates the spatial distance The calculation of the spatial distance on the side of the electronic device can be avoided, and accordingly, the transmission of the ranging signal to the electronic device at the time of receiving can be avoided, the number of information transmissions can be reduced, and the calculation efficiency of the spatial distance can be improved. Among them, by returning the spatial distance to the electronic device, the sender of the ranging signal can directly obtain the spatial distance after sending the ranging signal, which is convenient for the application of the spatial distance. The method also avoids manual on-site measurement and improves the efficiency of distance measurement.

为便于更好的实施本申请的距离获取方法,本申请还提供一种基于上述距离获取方法的距离获取系统。其中,该距离获取装置中词语的含义与上述距离获取方法中相同,具体实现细节可以参考方法实施例中的说明。In order to better implement the distance acquisition method of the present application, the present application further provides a distance acquisition system based on the above distance acquisition method. Wherein, the meanings of the words in the distance acquisition device are the same as those in the above distance acquisition method, and the specific implementation details may refer to the descriptions in the method embodiments.

请参阅图6,图6是本申请提供的距离获取系统的结构示意图,其中,该距离获取系统可以包括:Please refer to FIG. 6. FIG. 6 is a schematic structural diagram of a distance acquisition system provided by the present application, wherein the distance acquisition system may include:

电子设备501,用于与所述外部设备进行时间同步,得到所述电子设备与所述外部设备之间的时间差,并向所述外部设备传输测距信号的目标发送时刻以及所述时间差,在到达所述目标发送时刻时向所述外部设备发送所述测距信号,接收所述外部设备返回的所述外部设备与所述电子设备之间的空间距离;The electronic device 501 is configured to perform time synchronization with the external device, obtain the time difference between the electronic device and the external device, and transmit the target sending time of the ranging signal and the time difference to the external device, in Sending the ranging signal to the external device when reaching the target sending time, and receiving the spatial distance between the external device and the electronic device returned by the external device;

外部设备502,用于接收所述电子设备发送的测距信号以及所述时间差,根据所述目标发送时刻、所述时间差、所述测距信号以及接收到所述测距信号的实际接收时刻,计算所述外部设备与所述电子设备之间的空间距离,并将所述空间距离发送给所述电子设备。The external device 502 is configured to receive the ranging signal and the time difference sent by the electronic device, and according to the target sending time, the time difference, the ranging signal and the actual receiving time when the ranging signal is received, Calculate the spatial distance between the external device and the electronic device, and send the spatial distance to the electronic device.

为便于更好的实施本申请的距离获取方法,本申请还提供一种基于上述距离获取方法的距离获取装置。其中,该距离获取装置中词语的含义与上述距离获取方法中相同,具体实现细节可以参考方法实施例中的说明。In order to better implement the distance acquisition method of the present application, the present application further provides a distance acquisition device based on the above distance acquisition method. Wherein, the meanings of the words in the distance obtaining device are the same as those in the above distance obtaining method, and the specific implementation details may refer to the description in the method embodiment.

请参阅图7,图7为本申请实施例提供的距离获取装置的结构示意图,其中,该距离获取装置应用于电子设备,该距离获取装置可以包括:Please refer to FIG. 7. FIG. 7 is a schematic structural diagram of a distance acquisition device provided by an embodiment of the present application, wherein the distance acquisition device is applied to an electronic device, and the distance acquisition device may include:

获取模块601,用于与外部设备进行时间同步,得到所述电子设备与所述外部设备之间的时间差;an acquisition module 601, configured to perform time synchronization with an external device to obtain a time difference between the electronic device and the external device;

时间信息传输模块602,用于向所述外部设备传输测距信号的目标发送时刻以及所述时间差;a time information transmission module 602, configured to transmit the target sending time of the ranging signal and the time difference to the external device;

测距信号发送模块603,用于在到达所述目标发送时刻时向所述外部设备发送所述测距信号;A ranging signal sending module 603, configured to send the ranging signal to the external device when the target sending time is reached;

空间距离接收模块604,用于接收所述外部设备返回的所述外部设备与所述电子设备之间的空间距离,所述空间距离由所述外部设备根据所述测距信号、所述目标发送时刻、所述时间差以及所述外部设备接收到所述测距信号的实际接收时刻计算得到的。Spatial distance receiving module 604, configured to receive the spatial distance between the external device and the electronic device returned by the external device, where the spatial distance is sent by the external device according to the ranging signal and the target It is calculated from the time, the time difference, and the actual receiving time when the external device receives the ranging signal.

可选地,在本申请的一实施例中,获取模块601包括:Optionally, in an embodiment of the present application, the obtaining module 601 includes:

链路单元,用于通过所述电子设备的通信芯片与所述外部设备的通信芯片建立数据传输链路;a link unit, configured to establish a data transmission link with the communication chip of the external device through the communication chip of the electronic device;

同步单元,用于通过所述数据传输链路与所述外部设备进行时间同步。A synchronization unit, configured to perform time synchronization with the external device through the data transmission link.

可选的,在本申请的一实施例中,测距信号发送模块603包括:Optionally, in an embodiment of the present application, the ranging signal sending module 603 includes:

测距信号发送单元,用于在达到所述目标发送时刻时,通过所述电子设备的测距芯片向所述外部设备的测距芯片发送所述测距信号;其中,所述通信芯片与所述测距芯片发送和接收的信号类型不同。A ranging signal sending unit, configured to send the ranging signal to the ranging chip of the external device through the ranging chip of the electronic device when the target sending time is reached; wherein the communication chip is connected to the ranging chip of the external device. The types of signals sent and received by the ranging chip are different.

可选的,在本申请的一些实施例中,所述通信芯片包括蓝牙芯片、紫蜂协议芯片、无线保真网络芯片、超带宽芯片或者近场通信芯片中的至少一种,所述测距芯片包括超声波测距芯片、电磁波测距芯片或者音频芯片中的至少一种。Optionally, in some embodiments of the present application, the communication chip includes at least one of a Bluetooth chip, a Zigbee protocol chip, a wireless fidelity network chip, an ultra-wideband chip, or a near field communication chip, and the ranging chip The chip includes at least one of an ultrasonic ranging chip, an electromagnetic wave ranging chip or an audio chip.

可选的,在本申请的一些实施例中,获取模块601包括:Optionally, in some embodiments of the present application, the obtaining module 601 includes:

第一获取单元,用于根据所述电子设备的通信芯片的本地时间和所述外部设备的通信芯片的本地时间,得到本地时间差;a first obtaining unit, configured to obtain the local time difference according to the local time of the communication chip of the electronic device and the local time of the communication chip of the external device;

第二获取单元,用于根据所述电子设备的通信芯片的本地时间以及所述电子设备的测距芯片的音频时间,得到第一通信音频时间差;a second obtaining unit, configured to obtain the first communication audio time difference according to the local time of the communication chip of the electronic device and the audio time of the ranging chip of the electronic device;

第三获取单元,用于根据所述外部设备的通信芯片的本地时间以及所述外部设备的测距芯片的音频时间,得到第二通信音频时间差;a third obtaining unit, configured to obtain the second communication audio time difference according to the local time of the communication chip of the external device and the audio time of the ranging chip of the external device;

第四获取单元,用于根据所述本地时间差、第一通信音频时间差和所述第二通信音频时间差,得到所述电子设备与所述外部设备的时间差。The fourth obtaining unit is configured to obtain the time difference between the electronic device and the external device according to the local time difference, the first communication audio time difference and the second communication audio time difference.

请参阅图8,图8是本申请实施例提供的距离获取装置的另一结构示意图,其中,该距离获取装置应用于电子设备,该距离获取装置可以包括:Please refer to FIG. 8. FIG. 8 is another schematic structural diagram of a distance acquisition device provided by an embodiment of the present application, wherein the distance acquisition device is applied to an electronic device, and the distance acquisition device may include:

同步模块701,用于与外部设备进行时间同步,得到所述电子设备与所述外部设备之间的时间差;a synchronization module 701, configured to perform time synchronization with an external device to obtain a time difference between the electronic device and the external device;

时间信息接收模块702,用于接收所述外部设备传输测距信号的目标发送时刻;A time information receiving module 702, configured to receive the target sending time of the ranging signal transmitted by the external device;

测距信号接收模块703,用于接收所述外部设备发送的所述测距信号;A ranging signal receiving module 703, configured to receive the ranging signal sent by the external device;

空间距离发送模块704,用于根据所述目标发送时刻、所述时间差、所述测距信号以及接收到所述测距信号的实际接收时刻,计算所述电子设备与所述外部设备之间的空间距离,并将所述空间距离发送给所述外部设备。The spatial distance sending module 704 is configured to calculate the distance between the electronic device and the external device according to the target sending time, the time difference, the ranging signal and the actual receiving time when the ranging signal is received. space distance, and send the space distance to the external device.

可选的,在本申请的一些实施例中,空间距离发送模块704包括:Optionally, in some embodiments of the present application, the spatial distance sending module 704 includes:

确定单元,用于确定所述测距信号的传播衰减系数;a determining unit, configured to determine the propagation attenuation coefficient of the ranging signal;

第一计算单元,用于根据所述目标发送时刻、所述时间差、所述传播衰减系数以及接收到所述测距信号的实际接收时刻,计算所述电子设备与所述外部设备的空间距离。The first calculation unit is configured to calculate the spatial distance between the electronic device and the external device according to the target sending time, the time difference, the propagation attenuation coefficient, and the actual receiving time when the ranging signal is received.

可选的,在本申请的一些实施例中,空间距离发送模块704还包括:Optionally, in some embodiments of the present application, the spatial distance sending module 704 further includes:

解调单元,用于解调所述测距信号,得到设备标识信息;a demodulation unit, configured to demodulate the ranging signal to obtain device identification information;

第二计算单元,用于若所述设备标识信息为预设的设备标识信息,根据所述目标发送时刻、所述时间差、所述测距信号以及接收到所述测距信号的实际接收时刻,计算所述电子设备与所述外部设备之间的空间距离。The second calculation unit is configured to, if the device identification information is preset device identification information, according to the target sending time, the time difference, the ranging signal and the actual receiving time of the ranging signal, A spatial distance between the electronic device and the external device is calculated.

应当说明的是,本申请实施例提供的距离获取装置与上文实施例中的距离获取方法属于同一构思,其具体实现过程详见以上相关实施例,此处不再赘述。It should be noted that the distance acquisition device provided in the embodiment of the present application and the distance acquisition method in the above embodiments belong to the same concept, and the specific implementation process thereof is detailed in the above related embodiments, which will not be repeated here.

本申请实施例提供一种存储介质,其上存储有计算机程序,当其存储的计算机程序在本申请实施例提供的电子设备的处理器上执行时,使得电子设备的处理器执行以上任一适于电子设备的距离获取方法中的步骤。其中,存储介质可以是磁碟、光盘、只读存储器(Read Only Memory,ROM)或者随机存取器(Random Access Memory,RAM)等。The embodiments of the present application provide a storage medium on which a computer program is stored. When the stored computer program is executed on the processor of the electronic device provided by the embodiment of the present application, the processor of the electronic device can execute any one of the above suitable programs. Steps in a method for obtaining a distance from an electronic device. The storage medium may be a magnetic disk, an optical disk, a read only memory (Read Only Memory, ROM), or a random access device (Random Access Memory, RAM), or the like.

本申请实施例还提供一种电子设备,请参照图9,电子设备800包括处理器810和存储器820。An embodiment of the present application further provides an electronic device. Referring to FIG. 9 , the electronic device 800 includes a processor 810 and a memory 820 .

本申请实施例中的处理器810可以是通用处理器,比如ARM架构的处理器。The processor 810 in this embodiment of the present application may be a general-purpose processor, such as a processor of an ARM architecture.

存储器820中存储有计算机程序,其可以为高速随机存取存储器,还可以为非易失性存储器,比如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件等。相应地,存储器820还可以包括存储器控制器,以提供处理器810对存储器820的访问。处理器810通过执行存储器820中的计算机程序,用于执行以上任一距离获取方法,比如:A computer program is stored in the memory 820, which may be a high-speed random access memory, or a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage devices. Accordingly, memory 820 may also include a memory controller to provide processor 810 access to memory 820 . The processor 810 is configured to execute any of the above distance acquisition methods by executing the computer program in the memory 820, such as:

与外部设备进行时间同步,得到所述电子设备与所述外部设备之间的时间差;Perform time synchronization with an external device to obtain the time difference between the electronic device and the external device;

向所述外部设备传输测距信号的目标发送时刻以及所述时间差;The target sending time and the time difference for transmitting the ranging signal to the external device;

在到达所述目标发送时刻时向所述外部设备发送所述测距信号;Send the ranging signal to the external device when the target sending time is reached;

接收所述外部设备返回的所述外部设备与所述电子设备之间的空间距离,所述空间距离由所述外部设备根据所述测距信号、所述目标发送时刻、所述时间差以及所述外部设备接收到所述测距信号的实际接收时刻计算得到的。receiving the spatial distance between the external device and the electronic device returned by the external device, the spatial distance is determined by the external device according to the ranging signal, the target sending time, the time difference and the It is calculated by the actual receiving moment when the external device receives the ranging signal.

以上对本申请所提供的一种距离获取方法、装置、系统、存储介质及电子设备进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The method, device, system, storage medium and electronic device for distance acquisition provided by the present application have been described in detail above. The principles and implementations of the present application are described with specific examples. The descriptions of the above embodiments are only It is used to help understand the method and the core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation and application scope. In summary, this specification The content should not be construed as a limitation on this application.

Claims (12)

1. A distance acquisition method is applied to electronic equipment and is characterized by comprising the following steps:
carrying out time synchronization with external equipment to obtain a time difference between the electronic equipment and the external equipment;
transmitting the target sending time of the ranging signal and the time difference to the external equipment;
transmitting the ranging signal to the external device when the target transmission time is reached;
and receiving a space distance between the external equipment and the electronic equipment, wherein the space distance is obtained by the external equipment through calculation according to the ranging signal, the target sending time, the time difference and the actual receiving time of the ranging signal received by the external equipment.
2. The distance acquisition method according to claim 1, wherein said time-synchronizing with the external device comprises:
establishing a data transmission link with a communication chip of the external device through the communication chip of the electronic device;
time synchronization is carried out with the external equipment through the data transmission link;
the sending the ranging signal to the external device when the target sending time is reached includes:
when the target sending time is reached, sending the ranging signal to a ranging chip of the external equipment through the ranging chip of the electronic equipment;
the communication chip and the ranging chip send and receive signals of different types.
3. The distance obtaining method according to claim 2, wherein the communication chip comprises at least one of a bluetooth chip, a zigbee protocol chip, a wireless fidelity network chip, an ultra-wideband chip, or a near field communication chip, and the distance measuring chip comprises at least one of an ultrasonic distance measuring chip, an electromagnetic wave distance measuring chip, or an audio chip.
4. The distance acquisition method according to claim 2, wherein said obtaining a time difference between the electronic device and the external device comprises:
obtaining a local time difference according to the local time of the communication chip of the electronic equipment and the local time of the communication chip of the external equipment;
obtaining a first communication audio time difference according to the local time of a communication chip of the electronic equipment and the audio time of a distance measuring chip of the electronic equipment;
obtaining a second communication audio time difference according to the local time of the communication chip of the external equipment and the audio time of the ranging chip of the external equipment;
and obtaining the time difference between the electronic equipment and the external equipment according to the local time difference, the first communication audio time difference and the second communication audio time difference.
5. A distance acquisition method is applied to electronic equipment and is characterized by comprising the following steps:
carrying out time synchronization with external equipment to obtain a time difference between the electronic equipment and the external equipment;
receiving the target sending time of the ranging signal transmitted by the external equipment;
receiving the ranging signal sent by the external equipment;
and calculating the space distance between the electronic equipment and the external equipment according to the target sending time, the time difference, the ranging signal and the actual receiving time of receiving the ranging signal, and sending the space distance to the external equipment.
6. The method according to claim 5, wherein the calculating a spatial distance between the electronic device and the external device according to the target transmission time, the time difference, the ranging signal, and an actual reception time at which the ranging signal is received comprises:
determining a propagation attenuation coefficient of the ranging signal;
and calculating the space distance between the electronic equipment and the external equipment according to the target sending time, the time difference, the propagation attenuation coefficient and the actual receiving time of the received ranging signal.
7. The method according to claim 5, wherein the calculating a spatial distance between the electronic device and the external device according to the target transmission time, the time difference, the ranging signal, and an actual reception time at which the ranging signal is received comprises:
demodulating the ranging signal to obtain equipment identification information;
if the equipment identification information is preset equipment identification information, calculating the spatial distance between the electronic equipment and the external equipment according to the target sending time, the time difference, the ranging signal and the actual receiving time of the ranging signal.
8. A distance obtaining system comprises an electronic device and an external device, and is characterized in that the electronic device is used for carrying out time synchronization with the external device to obtain a time difference between the electronic device and the external device, transmitting a target sending time of a ranging signal and the time difference to the external device, sending the ranging signal to the external device when the target sending time is reached, and receiving a space distance between the external device and the electronic device, wherein the space distance is returned by the external device;
the external device is used for receiving the ranging signal sent by the electronic device and the time difference, calculating a spatial distance between the external device and the electronic device according to the target sending time, the time difference, the ranging signal and the actual receiving time of the ranging signal, and sending the spatial distance to the electronic device.
9. A distance acquisition device is applied to electronic equipment and is characterized by comprising:
the acquisition module is used for carrying out time synchronization with external equipment to obtain a time difference between the electronic equipment and the external equipment;
the time information transmission module is used for transmitting the target sending time of the ranging signal and the time difference to the external equipment;
the ranging signal sending module is used for sending the ranging signal to the external equipment when the target sending time is reached;
and the spatial distance receiving module is used for receiving a spatial distance between the external equipment and the electronic equipment, wherein the spatial distance is obtained by the external equipment through calculation according to the ranging signal, the target sending time, the time difference and the actual receiving time when the external equipment receives the ranging signal.
10. A distance acquisition device is applied to electronic equipment and is characterized by comprising:
the synchronization module is used for carrying out time synchronization with external equipment to obtain a time difference between the electronic equipment and the external equipment;
the time information receiving module is used for receiving the target sending time of the ranging signal transmitted by the external equipment;
the ranging signal receiving module is used for receiving the ranging signal sent by the external equipment;
and the space distance sending module is used for calculating the space distance between the electronic equipment and the external equipment according to the target sending time, the time difference, the ranging signal and the actual receiving time of the ranging signal, and sending the space distance to the external equipment.
11. A storage medium having stored thereon a computer program for performing the steps of the distance acquisition method according to any one of claims 1-7 when the computer program is loaded by a processor of an electronic device.
12. An electronic device comprising a processor and a memory, said memory storing a computer program, wherein said processor performs the steps in the distance acquisition method according to any one of claims 1-4 or 5-7 by loading said computer program.
CN202210255507.6A 2022-03-15 2022-03-15 Distance acquisition method, device, system, storage medium and electronic equipment Active CN114646952B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210255507.6A CN114646952B (en) 2022-03-15 2022-03-15 Distance acquisition method, device, system, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210255507.6A CN114646952B (en) 2022-03-15 2022-03-15 Distance acquisition method, device, system, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN114646952A true CN114646952A (en) 2022-06-21
CN114646952B CN114646952B (en) 2024-10-11

Family

ID=81993957

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210255507.6A Active CN114646952B (en) 2022-03-15 2022-03-15 Distance acquisition method, device, system, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN114646952B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115390014A (en) * 2022-08-08 2022-11-25 北京小米移动软件有限公司 Distance determination method and device, terminal and computer readable storage medium
WO2024145947A1 (en) * 2023-01-06 2024-07-11 北京小米移动软件有限公司 Information processing methods and apparatuses, and communication device and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006234425A (en) * 2005-02-22 2006-09-07 Mitsubishi Electric Corp Time error computation apparatus and time synchronization system
WO2006093162A1 (en) * 2005-03-01 2006-09-08 Inter-University Research Institute Corporation Research Organization Of Information And Systems Ultrasonic distance measuring system and ultrasonic distance measuring method
JP2007139638A (en) * 2005-11-21 2007-06-07 Nec Viewtechnology Ltd Distance measuring system and distance measuring method
WO2016201952A1 (en) * 2015-06-18 2016-12-22 苏州触达信息技术有限公司 Ranging system, positioning system and method, and wearable device
CN106886028A (en) * 2017-02-28 2017-06-23 四川九洲电器集团有限责任公司 A kind of distance-finding method and terminal device
CN111989592A (en) * 2020-07-16 2020-11-24 北京小米移动软件有限公司 Ranging method, device and equipment in synchronous system and readable storage medium
CN112291710A (en) * 2020-09-21 2021-01-29 宇龙计算机通信科技(深圳)有限公司 Distance measuring method, distance measuring device, storage medium and electronic equipment
WO2021017945A1 (en) * 2019-07-31 2021-02-04 Oppo广东移动通信有限公司 Electronic device control method and apparatus, electronic device, and storage medium
CN113514820A (en) * 2021-03-29 2021-10-19 深圳航天科技创新研究院 Time synchronization and ranging method, device, electronic device and storage medium
WO2022000354A1 (en) * 2020-06-30 2022-01-06 Oppo广东移动通信有限公司 Method for ranging and terminal device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006234425A (en) * 2005-02-22 2006-09-07 Mitsubishi Electric Corp Time error computation apparatus and time synchronization system
WO2006093162A1 (en) * 2005-03-01 2006-09-08 Inter-University Research Institute Corporation Research Organization Of Information And Systems Ultrasonic distance measuring system and ultrasonic distance measuring method
JP2007139638A (en) * 2005-11-21 2007-06-07 Nec Viewtechnology Ltd Distance measuring system and distance measuring method
WO2016201952A1 (en) * 2015-06-18 2016-12-22 苏州触达信息技术有限公司 Ranging system, positioning system and method, and wearable device
CN106886028A (en) * 2017-02-28 2017-06-23 四川九洲电器集团有限责任公司 A kind of distance-finding method and terminal device
WO2021017945A1 (en) * 2019-07-31 2021-02-04 Oppo广东移动通信有限公司 Electronic device control method and apparatus, electronic device, and storage medium
WO2022000354A1 (en) * 2020-06-30 2022-01-06 Oppo广东移动通信有限公司 Method for ranging and terminal device
CN111989592A (en) * 2020-07-16 2020-11-24 北京小米移动软件有限公司 Ranging method, device and equipment in synchronous system and readable storage medium
CN112291710A (en) * 2020-09-21 2021-01-29 宇龙计算机通信科技(深圳)有限公司 Distance measuring method, distance measuring device, storage medium and electronic equipment
CN113514820A (en) * 2021-03-29 2021-10-19 深圳航天科技创新研究院 Time synchronization and ranging method, device, electronic device and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115390014A (en) * 2022-08-08 2022-11-25 北京小米移动软件有限公司 Distance determination method and device, terminal and computer readable storage medium
WO2024145947A1 (en) * 2023-01-06 2024-07-11 北京小米移动软件有限公司 Information processing methods and apparatuses, and communication device and storage medium

Also Published As

Publication number Publication date
CN114646952B (en) 2024-10-11

Similar Documents

Publication Publication Date Title
CN114646952A (en) Distance acquisition method, device, system, storage medium and electronic equipment
US11240586B1 (en) Method, apparatus and device for synchronously playing audio
US9316717B2 (en) Position determination of devices using stereo audio
US8909244B2 (en) Distributed positioning mechanism for wireless communication devices
CN106896356B (en) Determine method, position indicating method and its device and system of distance change
EP4191585B1 (en) Systems and methods for generating a cleaned version of ambient sound
CN112187627B (en) Interaction control method and system, wearable device, mobile terminal and storage medium
CN111308452A (en) System and method for phase shift based time of arrival reporting in passive positioning ranging
TW201543059A (en) Polled time-of-flight response
CN110213024A (en) Data package retransmission method, device and equipment
CN112698311A (en) Ranging method, ranging device, ranging system, intelligent device and computer readable storage medium
CN104243133B (en) A kind of synchronous method and device
TW202002699A (en) Method and apparatus for determining a position of a terminal
CN111405336A (en) Multi-device synchronous playing method and system, electronic device and storage medium
CN107147544A (en) A method and device for testing network delay
CN112086095A (en) Data processing method, device, equipment and storage medium
WO2016011601A1 (en) Access point, terminal and wireless fidelity (wifi) indoor locating method
CN115443665B (en) Method and terminal device for ranging
CN113655437A (en) Ranging method, ranging device and storage medium
CN115390014A (en) Distance determination method and device, terminal and computer readable storage medium
US12022411B2 (en) Communication apparatus and communication system
CN115567080B (en) Communication method, system and equipment based on USART
WO2023024944A1 (en) Speed measurement method and electronic devices
CN115308725B (en) Ranging method, device and system
CN115297364B (en) Cloud game video transmission time delay determining method, cloud game video transmission time delay determining system and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant