WO2023160177A1 - 测距方法、装置、系统及可读存储介质 - Google Patents

测距方法、装置、系统及可读存储介质 Download PDF

Info

Publication number
WO2023160177A1
WO2023160177A1 PCT/CN2022/140420 CN2022140420W WO2023160177A1 WO 2023160177 A1 WO2023160177 A1 WO 2023160177A1 CN 2022140420 W CN2022140420 W CN 2022140420W WO 2023160177 A1 WO2023160177 A1 WO 2023160177A1
Authority
WO
WIPO (PCT)
Prior art keywords
moment
ranging signal
time
system clock
chip
Prior art date
Application number
PCT/CN2022/140420
Other languages
English (en)
French (fr)
Inventor
彭兰
杜振国
王琪
魏佩征
曲鹏程
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2023/077349 priority Critical patent/WO2023160524A1/zh
Publication of WO2023160177A1 publication Critical patent/WO2023160177A1/zh

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
    • G01S5/00Position-fixing by co-ordinating two or more direction or position line determinations; Position-fixing by co-ordinating two or more distance determinations
    • G01S5/02Position-fixing by co-ordinating two or more direction or position line determinations; Position-fixing by co-ordinating two or more distance determinations using radio waves
    • G01S5/0252Radio frequency fingerprinting
    • 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
    • G01S5/00Position-fixing by co-ordinating two or more direction or position line determinations; Position-fixing by co-ordinating two or more distance determinations
    • G01S5/02Position-fixing by co-ordinating two or more direction or position line determinations; Position-fixing by co-ordinating two or more distance determinations using radio waves
    • 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
    • G01S5/00Position-fixing by co-ordinating two or more direction or position line determinations; Position-fixing by co-ordinating two or more distance determinations
    • G01S5/02Position-fixing by co-ordinating two or more direction or position line determinations; Position-fixing by co-ordinating two or more distance determinations using radio waves
    • G01S5/0257Hybrid positioning
    • G01S5/0258Hybrid positioning by combining or switching between measurements derived from different systems
    • G01S5/02585Hybrid positioning by combining or switching between measurements derived from different systems at least one of the measurements being a non-radio measurement
    • 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
    • G01S5/00Position-fixing by co-ordinating two or more direction or position line determinations; Position-fixing by co-ordinating two or more distance determinations
    • G01S5/18Position-fixing by co-ordinating two or more direction or position line determinations; Position-fixing by co-ordinating two or more distance determinations using ultrasonic, sonic, or infrasonic waves
    • G01S5/20Position of source determined by a plurality of spaced direction-finders

Definitions

  • the present application relates to the field of terminals, and in particular to a ranging method, device, system and readable storage medium.
  • One-way ranging is a widely used technique.
  • One-way ranging can obtain the distance between the master device and the slave device through the master device.
  • the distance between the mobile phone and the paired Bluetooth headset can be obtained through the mobile phone.
  • the one-way ranging solution mainly reads the signal strength of the slave device connection through the master device, and obtains the distance between the master device and the slave device through the reverse deduction of the signal strength.
  • Embodiments of the present application provide a ranging method, device, system, and readable storage medium, which can solve the problems of insufficient accuracy and large errors of the distance calculated by the existing one-way ranging scheme.
  • the embodiment of the present application provides a ranging method applied to the first device, including:
  • the first offset time is the time difference between the system clock of the first device and the system clock of the second device.
  • the first moment is the moment when the second device sends the ranging signal.
  • the first moment is based on The system clock of the second device is obtained.
  • the second moment is obtained based on the third moment when the first device starts receiving the ranging signal and the receiving interval time.
  • the third moment is based on the receiving chip receiving the ranging signal.
  • the fourth moment of the distance signal time, the system clock of the first device and the chip clock of the ranging signal receiving chip are converted, and the receiving interval time is the time interval between starting to receive the ranging signal and receiving the ranging signal. Acquire the distance between the first device and the second device according to the first offset time, the first moment and the second moment.
  • the first device may be a mobile phone, a tablet computer, an augmented reality (augmented reality, AR)/virtual reality (virtual reality, VR) device, a large-screen device, a notebook computer, a netbook , personal digital assistant (personal digital assistant, PDA), etc.
  • the first device needs to have the ability to receive ranging signals, and the embodiment of the present application does not impose any restrictions on the specific type of the first device.
  • the second device may be a terminal device including a function of transmitting a ranging signal, a first device having a function of transmitting a ranging signal, and the like.
  • the terminal device including the function of transmitting ranging signals may be an electronic tag, a smart key fob including an electronic tag, a Bluetooth headset, and the like.
  • the first device obtains a first offset time from the system clock of the second device, and synchronizes the system time of the first device with the system time of the second device. Then, acquire the second moment when the ranging signal sent by the second device is received, and acquire the first moment when the second device sends the ranging signal. Finally, the distance between the first device and the second device can be calculated according to the first offset time, the first moment and the second moment. Due to the high precision of the system clock, the distance calculated according to the time acquired by the system clock is also more accurate and has smaller errors.
  • obtaining the second moment when the ranging signal is received includes: the ranging signal receiving chip acquires the fourth moment and sends the fourth moment to the driver of the ranging signal receiving chip.
  • the driver program of the ranging signal receiving chip corrects the fourth moment to the third moment based on the system clock.
  • the driver program of the ranging signal receiving chip sends the third moment to the application layer, and adds the receiving interval time to the third moment in the application layer to obtain the second moment.
  • the driver program of the ranging signal receiving chip corrects the fourth moment to the third moment based on the system clock, including: when the driver program of the ranging signal receiving chip receives the fourth moment, correcting the fourth moment is the third time based on the system clock. Or, the driver program of the ranging signal receiving chip corrects the fourth moment to the third moment based on the system clock in response to the parameter acquisition instruction from the application layer.
  • acquiring the second moment when the ranging signal is received includes: acquiring the fourth moment by the ranging signal receiving chip.
  • the driver program of the ranging signal receiving chip responds to the parameter acquisition instruction, acquires the fourth moment from the ranging signal receiving chip, and corrects the fourth moment to the third moment based on the system clock.
  • the driver program of the ranging signal receiving chip sends the third moment to the application layer, and adds the interval time to the third moment in the application layer to obtain the second moment.
  • correcting the fourth moment to the third moment based on the system clock includes: receiving the chip driver through the ranging signal, and simultaneously obtaining the fifth moment based on the system clock and the sixth moment based on the chip clock.
  • the time difference between the fourth moment and the sixth moment is the second offset time.
  • the third moment is obtained according to the fifth moment and the second offset time.
  • acquiring the distance between the first device and the second device according to the first offset time, the first moment and the second moment includes: acquiring the distance measured according to the first offset time, the first moment and the second moment The flight time from the signal. Acquire the distance between the first device and the second device according to the propagation speed and flight time of the ranging signal in the medium.
  • acquiring the time-of-flight of the ranging signal according to the first offset time, the first moment, and the second moment includes: correcting the first moment to the first time based on the system clock of the first device according to the first offset time. Seventh moment; subtract the seventh moment from the second moment to get the flight time of the ranging signal. Or, according to the first offset time, correct the second time to the eighth time based on the system clock of the second device; subtract the first time from the eighth time to obtain the flight time of the ranging signal.
  • obtaining the first offset time includes: the first device sequentially sends at least one synchronization command to the second device, and records the ninth moment when each synchronization command is sent based on the system clock of the first device.
  • Receive the synchronization feedback identifier from the second device record the tenth moment when each synchronization feedback identifier is received based on the system clock of the first device, the synchronization feedback identifier includes the eleventh moment when the second device receives the synchronization instruction and the second device
  • the twelfth moment, the eleventh moment and the twelfth moment when the synchronization feedback identifier is sent are obtained based on the system clock of the second device. According to the ninth moment, the tenth moment, the eleventh moment and the twelfth moment, the first offset time is obtained.
  • obtaining the first time includes: sending a first time query instruction to the second device. At least one first moment sent by the second device is received.
  • obtaining the first time includes: sending a first time query instruction to the second device. Receive device identification information sent by the second device. Acquiring at least one preset first moment according to the device identification information.
  • the embodiment of the present application provides a ranging method applied to a second device, including: acquiring a first moment when a ranging signal is sent. A first moment is sent to the first device. Based on the system clock of the second device, the ranging signal is sent at the first moment.
  • the method before sending the ranging signal at the first time based on the system clock of the second device, the method further includes: receiving at least one synchronization command from the first device, and recording each received signal based on the system clock of the second device.
  • the synchronization feedback identifier includes the eleventh moment and the twelfth moment when the synchronization feedback identifier is sent. The twelfth moment is obtained based on the system clock record of the second device.
  • acquiring the first moment of sending the ranging signal includes: confirming that the synchronization with the first device is completed. The time when the preset period of time has elapsed after confirming that the synchronization is completed is taken as the first time.
  • acquiring the first moment of sending the ranging signal includes: receiving a ranging signal sending instruction, and acquiring at least one first moment included in the ranging signal sending instruction. Or, at least one preset first moment is acquired according to the device identification information of the second device.
  • sending the first moment to the first device includes: after acquiring the first moment, sending the first moment to the first device. Or, in response to a first time query instruction from the first device, at least one first time is sent to the first device.
  • sending the first time to the first device further includes: sending the device identification information of the second device to the first device in response to a first time query instruction from the first device.
  • the embodiment of the present application provides a ranging system, including a first device and a second device, including: the first device obtains the first offset time and the first moment, and the first offset time is the first device The time difference between the system clock and the system clock of the second device, the first moment is the moment when the second device sends the ranging signal, and the first moment is obtained based on the system clock of the second device.
  • the second device sends the ranging signal at the first moment based on the system clock of the second device.
  • the first device obtains the second moment when the ranging signal is received.
  • the second moment is obtained based on the third moment when the first device starts receiving the ranging signal and the receiving interval time.
  • the third moment is obtained according to the receiving chip of the ranging signal
  • the fourth moment when the ranging signal is started to be received, converted from the system clock of the first device and the chip clock of the ranging signal receiving chip, the receiving interval time is the time interval between starting to receive the ranging signal and receiving the ranging signal .
  • the first device acquires the distance between the first device and the second device according to the first offset time, the first moment, and the second moment.
  • An acquisition module configured to acquire a first offset time and a first moment
  • the first offset time is the time difference between the system clock of the first device and the system clock of the second device
  • the first moment is the moment when the second device sends a ranging signal
  • the first moment is obtained based on the system clock of the second device.
  • the obtaining module is also used to obtain the second moment when the ranging signal is received, the second moment is obtained according to the third moment when the first device starts to receive the ranging signal and the receiving interval time, the third moment is obtained according to the ranging.
  • the fourth moment when the signal receiving chip starts to receive the ranging signal, the system clock of the first device and the chip clock of the ranging signal receiving chip are converted. time interval.
  • the acquiring module is specifically used for the ranging signal receiving chip to acquire the fourth moment and send the fourth moment to the driver of the ranging signal receiving chip.
  • the driver program of the ranging signal receiving chip corrects the fourth moment to the third moment based on the system clock.
  • the driver program of the ranging signal receiving chip sends the third moment to the application layer, and adds the receiving interval time to the third moment in the application layer to obtain the second moment.
  • the acquisition module specifically the driver program for the ranging signal receiving chip, corrects the fourth moment to the third moment based on the system clock when receiving the fourth moment.
  • the driver program of the ranging signal receiving chip corrects the fourth moment to the third moment based on the system clock in response to the parameter acquisition instruction from the application layer.
  • the acquisition module is specifically used for the ranging signal receiving chip to acquire the fourth moment.
  • the driver program of the ranging signal receiving chip responds to the parameter acquisition instruction, acquires the fourth moment from the ranging signal receiving chip, and corrects the fourth moment to the third moment based on the system clock.
  • the driver program of the ranging signal receiving chip sends the third moment to the application layer, and adds the interval time to the third moment in the application layer to obtain the second moment.
  • the calculation module is specifically configured to acquire the time-of-flight of the ranging signal according to the first offset time, the first moment and the second moment. Acquire the distance between the first device and the second device according to the propagation speed and flight time of the ranging signal in the medium.
  • the calculation module is specifically configured to correct the first moment to the seventh moment based on the system clock of the first device according to the first offset time; subtract the seventh moment from the second moment to obtain the distance measurement signal flight duration. Or, according to the first offset time, correct the second time to the eighth time based on the system clock of the second device; subtract the first time from the eighth time to obtain the flight time of the ranging signal.
  • the obtaining module is specifically configured to sequentially send at least one synchronization command to the second device, based on the system clock of the first device to record the ninth moment when each synchronization command is sent.
  • Receive the synchronization feedback identifier from the second device record the tenth moment when each synchronization feedback identifier is received based on the system clock of the first device, the synchronization feedback identifier includes the eleventh moment when the second device receives the synchronization instruction and the second device
  • the twelfth moment, the eleventh moment and the twelfth moment when the synchronization feedback identifier is sent are obtained based on the system clock of the second device. According to the ninth moment, the tenth moment, the eleventh moment and the twelfth moment, the first offset time is obtained.
  • the obtaining module is specifically configured to send a first time query instruction to the second device. At least one first moment sent by the second device is received.
  • the embodiment of the present application provides a ranging device, which is applied to a second device, and includes: an acquiring module, configured to acquire a first moment when a ranging signal is sent.
  • a sending module configured to send the first moment to the first device.
  • the sending module is further configured to send the ranging signal at the first moment based on the system clock of the second device.
  • the obtaining module is specifically configured to confirm that the synchronization with the first device is completed.
  • the time when the preset time period has elapsed after confirming the completion of the synchronization is taken as the first time.
  • the embodiment of the present application provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method provided in the second aspect is implemented.
  • the embodiment of the present application provides a computer program product, which causes the terminal device to execute the method provided in the second aspect when the computer program product is run on the second device.
  • an embodiment of the present application provides a chip system, the chip system includes a memory and a processor, and the processor executes a computer program stored in the memory to implement the method provided in the first aspect.
  • an embodiment of the present application provides a chip system, the chip system includes a processor, the processor is coupled to the computer-readable storage medium provided in the eighth aspect, and the processor executes the computer program stored in the computer-readable storage medium , to implement the method provided in the first aspect.
  • FIG. 1 shows a schematic diagram of an application scenario of a ranging method provided by an embodiment of the present application
  • FIG. 4 shows a schematic flowchart of a ranging method provided by an embodiment of the present application
  • FIG. 5 shows a schematic diagram of the system structure of the first device in a ranging method provided by an embodiment of the present application
  • Fig. 6 shows a schematic flow chart of acquiring T2 in the ranging method provided by the embodiment of the present application
  • FIG. 9 shows a structural block diagram of a distance measuring device applied to a second device provided by an embodiment of the present application.
  • FIG. 11 is a structural block diagram of a second device provided by an embodiment of the present application.
  • the ultrasonic distance measurement between the first device and the second device is taken as an example for description. It should be noted that, in other cases, the distance between the first device and the second device can also be achieved by means of laser ranging, infrared ranging, etc., and this application does not limit the medium used for ranging.
  • FIG. 1 shows a schematic diagram of an application scenario of a ranging method provided by an embodiment of the present application.
  • the first device 100 includes at least one first device 100 and at least one second device 200 .
  • the first device 100 may be a mobile phone, a tablet computer, an augmented reality (augmented reality, AR)/virtual reality (virtual reality, VR) device, a large-screen device, a notebook computer, a netbook, a personal digital assistant (personal digital assistant, PDA), etc.
  • the first device 100 needs to have the capability of receiving ranging signals, and the embodiment of the present application does not impose any limitation on the specific type of the first device 100 .
  • the first device 100 needs to have a recording device capable of receiving ultrasonic waves, such as including a microphone capable of receiving ultrasonic waves and a corresponding audio chip, for example, the audio chip may be a high-fidelity (High-Fidelity, HiFi) chip.
  • a recording device capable of receiving ultrasonic waves such as including a microphone capable of receiving ultrasonic waves and a corresponding audio chip
  • the audio chip may be a high-fidelity (High-Fidelity, HiFi) chip.
  • the second device 200 may be a terminal device including a function of transmitting a ranging signal, the first device 100 having a function of transmitting a ranging signal, and the like.
  • the terminal device including the function of transmitting ranging signals may be an electronic tag, a smart key fob including an electronic tag, a Bluetooth headset, and the like.
  • the second device 200 needs to have a device capable of emitting ultrasonic waves.
  • the first device 100 can record ultrasonic signals through an audio chip and a microphone.
  • the second device 200 may send a ranging signal through an ultrasonic transmitting device, and the ranging signal may be an ultrasonic pulse signal or a square wave signal of a specific frequency or the like.
  • FIG. 2 shows a schematic structural diagram of a first device in a ranging method provided by an embodiment of the present application.
  • the first device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charging management module 140, a power management module 141, and a battery 142 , antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193 , a display screen 194, and a subscriber identification module (subscriber identification module, SIM) card interface 195, etc.
  • SIM subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, bone conduction sensor 180M, etc.
  • the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the first device 100 .
  • the first device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange different components.
  • the illustrated components can be realized in hardware, software or a combination of software and hardware.
  • the first device 100 when the first device 100 is a mobile phone, a tablet computer, or a large-screen device, it may include all components shown in the illustration, or may include only some of the components shown in the illustration.
  • the processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU) wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • application processor application processor, AP
  • modem processor graphics processing unit
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • baseband processor baseband processor
  • neural network processor neural-network processing unit, NPU
  • the controller may be the nerve center and command center of the first device 100 .
  • the controller can generate an operation control signal according to the instruction opcode and timing signal, and complete the control of fetching and executing the instruction.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is a cache memory.
  • the memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. Repeated access is avoided, and the waiting time of the processor 110 is reduced, thereby improving the efficiency of the system.
  • processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transmitter (universal asynchronous receiver/transmitter, UART) interface, mobile industry processor interface (mobile industry processor interface, MIPI), general-purpose input and output (general-purpose input/output, GPIO) interface, subscriber identity module (subscriber identity module, SIM) interface, and /or universal serial bus (universal serial bus, USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input and output
  • subscriber identity module subscriber identity module
  • SIM subscriber identity module
  • USB universal serial bus
  • the I2C interface is a bidirectional synchronous serial bus, including a serial data line (serial data line, SDA) and a serial clock line (derail clock line, SCL).
  • processor 110 may include multiple sets of I2C buses.
  • the processor 110 can be respectively coupled to the touch sensor 180K, the charger, the flashlight, the camera 193 and the like through different I2C bus interfaces.
  • the processor 110 may be coupled to the touch sensor 180K through an I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface to realize the touch function of the first device 100 .
  • the I2S interface can be used for audio communication.
  • processor 110 may include multiple sets of I2S buses.
  • the processor 110 may be coupled to the audio module 170 through an I2S bus to implement communication between the processor 110 and the audio module 170 .
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface.
  • the PCM interface can also be used for audio communication, sampling, quantizing and encoding the analog signal.
  • the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
  • the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface. Both I2S interface and PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus can be a bidirectional communication bus. It converts the data to be transferred to and from parallel communication.
  • a UART interface is generally used to connect the processor 110 and the wireless communication module 160 .
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to realize the Bluetooth function.
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface, so as to realize the function of playing music through the Bluetooth headset.
  • the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
  • MIPI interface includes camera serial interface (camera serial interface, CSI), display serial interface (display serial interface, DSI), etc.
  • the processor 110 communicates with the camera 193 through the CSI interface to realize the shooting function of the first device 100 .
  • the processor 110 communicates with the display screen 194 through the DSI interface to realize the display function of the first device 100 .
  • the GPIO interface can be configured by software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface can be used to connect the processor 110 with the camera 193 , the display screen 194 , the wireless communication module 160 , the audio module 170 , the sensor module 180 and so on.
  • the GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the USB interface 130 is an interface conforming to the USB standard specification, specifically, it can be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like.
  • the USB interface 130 can be used to connect a charger to charge the first device 100 , and can also be used to transmit data between the first device 100 and peripheral devices. It can also be used to connect headphones and play audio through them. This interface can also be used to connect other electronic devices, such as AR devices.
  • the interface connection relationship between the modules shown in the embodiment of the present application is only a schematic illustration, and does not constitute a structural limitation of the first device 100 .
  • the first device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
  • the charging management module 140 is configured to receive a charging input from a charger.
  • the charger may be a wireless charger or a wired charger.
  • the charging management module 140 can receive charging input from the wired charger through the USB interface 130 .
  • the charging management module 140 may receive wireless charging input through the wireless charging coil of the first device 100 . While the charging management module 140 is charging the battery 142 , it can also supply power to the electronic device through the power management module 141 .
  • the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
  • the power management module 141 receives the input from the battery 142 and/or the charging management module 140 to provide power for the processor 110 , the internal memory 121 , the external memory, the display screen 194 , the camera 193 , and the wireless communication module 160 .
  • the power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, and battery health status (leakage, impedance).
  • the power management module 141 may also be disposed in the processor 110 . In some other embodiments, the power management module 141 and the charging management module 140 may also be set in the same device.
  • the wireless communication function of the first device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, a baseband processor, and the like.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in the first device 100 can be used to cover single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization of the antennas.
  • Antenna 1 can be multiplexed as a diversity antenna of a wireless local area network.
  • the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 may provide solutions for wireless communication including 2G/3G/4G/5G applied on the first device 100.
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (low noise amplifier, LNA) and the like.
  • the mobile communication module 150 can receive electromagnetic waves through the antenna 1, filter and amplify the received electromagnetic waves, and send them to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signals modulated by the modem processor, and convert them into electromagnetic waves and radiate them through the antenna 1 .
  • At least part of the functional modules of the mobile communication module 150 may be set in the processor 110 .
  • At least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be set in the same device.
  • a modem processor may include a modulator and a demodulator.
  • the modulator is used for modulating the low-frequency baseband signal to be transmitted into a medium-high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator sends the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the low-frequency baseband signal is passed to the application processor after being processed by the baseband processor.
  • the application processor outputs sound signals through audio equipment (not limited to speaker 170A, receiver 170B, etc.), or displays images or videos through display screen 194 .
  • the modem processor may be a stand-alone device. In some other embodiments, the modem processor may be independent from the processor 110, and be set in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide wireless local area networks (wireless local area networks, WLAN) (such as wireless fidelity (wireless fidelity, Wi-Fi) network), bluetooth (bluetooth, BT), global navigation, etc. applied on the first device 100. Satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions.
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency-modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , frequency-modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
  • the antenna 1 of the first device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the first device 100 can communicate with the network and other devices through wireless communication technology.
  • Wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband code division Multiple access (wideband code division multiple access, WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM , and/or IR technology, etc.
  • GSM global system for mobile communications
  • GPRS general packet radio service
  • CDMA code division multiple access
  • WCDMA broadband code division Multiple access
  • TD-SCDMA time-division code division multiple access
  • LTE long term evolution
  • BT GNSS
  • GLONASS global navigation satellite system
  • Beidou satellite navigation system beidou navigation satellite system, BDS
  • quasi-zenith satellite system quasi-zenith satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation systems
  • the first device 100 implements a display function through a GPU, a display screen 194 , and an application processor.
  • the GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
  • the display screen 194 is used to display images, videos and the like.
  • the display screen 194 includes a display panel.
  • the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode, AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diodes (quantum dot light emitting diodes, QLED), etc.
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • AMOLED active matrix organic light emitting diode
  • FLED flexible light-emitting diode
  • Miniled MicroLed, Micro-oLed
  • quantum dot light emitting diodes quantum dot light emitting diodes (quantum dot light emitting diodes, QLED),
  • the first device 100 may include 1 or N display screens 194 , where N is a positive integer greater than 1.
  • the first device 100 can realize the shooting function through the ISP, the camera 193 , the video codec, the GPU, the display screen 194 and the application processor.
  • the ISP is used for processing the data fed back by the camera 193 .
  • the light is transmitted to the photosensitive element of the camera through the lens, and the optical signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye.
  • ISP can also perform algorithm optimization on image noise, brightness, and skin color.
  • ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be located in the camera 193 .
  • Camera 193 is used to capture still images or video.
  • the object generates an optical image through the lens and projects it to the photosensitive element.
  • the focal length of the lens can be used to indicate the viewing range of the camera, and the smaller the focal length of the lens, the larger the viewing range of the lens.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the light signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal.
  • the ISP outputs the digital image signal to the DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other image signals.
  • the first device 100 may include cameras 193 with two or more focal lengths.
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the first device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the energy of the frequency point.
  • Video codecs are used to compress or decompress digital video.
  • the first device 100 may support one or more video codecs.
  • the first device 100 can play or record videos in various encoding formats, for example: moving picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
  • the NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • Applications such as intelligent cognition of the first device 100 can be realized through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
  • the NPU or other processors may be used to perform operations such as analysis and processing on the images in the video stored by the first device 100 .
  • the external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the first device 100.
  • the external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. Such as saving music, video and other files in the external memory card.
  • the internal memory 121 may be used to store computer-executable program codes including instructions.
  • the processor 110 executes various functional applications and data processing of the first device 100 by executing instructions stored in the internal memory 121 .
  • the internal memory 121 may include an area for storing programs and an area for storing data.
  • the stored program area can store an operating system and at least one application program required by a function (such as a sound playing function, an image playing function, etc.).
  • the storage data area can store data created during the use of the first device 100 (such as audio data, phonebook, etc.).
  • the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (universal flash storage, UFS) and the like.
  • a non-volatile memory such as at least one magnetic disk storage device, flash memory device, universal flash storage (universal flash storage, UFS) and the like.
  • the first device 100 may implement an audio function through an audio module 170 , a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, and an application processor.
  • the audio module 170 is used for converting digital audio signals into analog audio signals for output, and also for converting analog audio input into digital audio signals.
  • the audio module 170 may also be used to encode and decode audio signals.
  • the audio module 170 may be set in the processor 110 , or some functional modules of the audio module 170 may be set in the processor 110 .
  • Speaker 170A also referred to as a "horn" is used to convert audio electrical signals into sound signals.
  • the first device 100 can listen to music through the speaker 170A, or listen to the hands-free call.
  • the speaker can play the comparison and analysis results provided by the embodiment of the present application.
  • Receiver 170B also called “earpiece” is used to convert audio electrical signals into sound signals.
  • the first device 100 receives a call or a voice message, it can listen to the voice by bringing the receiver 170B close to the human ear.
  • the microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals.
  • the user can put his mouth close to the microphone 170C to make a sound, and input the sound signal to the microphone 170C.
  • the first device 100 may be provided with at least one microphone 170C. In some other embodiments, the first device 100 may be provided with two microphones 170C, which may also implement a noise reduction function in addition to collecting sound signals. When distance measurement is performed by ultrasonic waves, the selected microphone 170C needs to be able to record ultrasonic audio signals.
  • the first device 100 can also be provided with three, four or more microphones 170C, so as to collect sound signals, reduce noise, identify sound sources, and realize directional recording functions, etc.
  • the earphone interface 170D is used for connecting wired earphones.
  • the earphone interface 170D can be a USB interface 130, or a 3.5mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the pressure sensor 180A is used to sense the pressure signal and convert the pressure signal into an electrical signal.
  • pressure sensor 180A may be disposed on display screen 194 .
  • pressure sensors 180A such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors.
  • a capacitive pressure sensor may be comprised of at least two parallel plates with conductive material.
  • the first device 100 determines the intensity of pressure from the change in capacitance.
  • the first device 100 detects the intensity of the touch operation according to the pressure sensor 180A.
  • the first device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A.
  • touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view short messages is executed. When a touch operation whose intensity is greater than or equal to the first pressure threshold acts on the icon of the short message application, the instruction of creating a new short message is executed.
  • the gyro sensor 180B can be used to determine the motion posture of the first device 100 .
  • the angular velocity of the first device 100 about three axes may be determined by the gyro sensor 180B.
  • the gyro sensor 180B can be used for image stabilization. Exemplarily, when the shutter is pressed, the gyroscope sensor 180B detects the shake angle of the first device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to counteract the shake of the first device 100 through reverse motion to achieve anti- shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenes.
  • the air pressure sensor 180C is used to measure air pressure.
  • the first device 100 calculates the altitude based on the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
  • the magnetic sensor 180D includes a Hall sensor.
  • the first device 100 may detect opening and closing of the flip holster using the magnetic sensor 180D.
  • the first device 100 may detect opening and closing of the clamshell according to the magnetic sensor 180D.
  • features such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 180E can detect the acceleration of the first device 100 in various directions (generally three axes).
  • the magnitude and direction of gravity can be detected when the first device 100 is stationary. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.
  • the distance sensor 180F is used to measure the distance.
  • the first device 100 may measure the distance through ultrasound, infrared or laser. In some embodiments, when shooting a scene, the first device 100 may use the distance sensor 180F for distance measurement to achieve fast focusing.
  • Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes.
  • the light emitting diodes may be infrared light emitting diodes.
  • the first device 100 emits infrared light outwards through a light emitting diode.
  • the first device 100 detects infrared reflected light from nearby objects using a photodiode. When sufficient reflected light is detected, it may be determined that there is an object near the first device 100 . When insufficient reflected light is detected, the first device 100 may determine that there is no object near the first device 100 .
  • the first device 100 may use the proximity light sensor 180G to detect that the user is holding the first device 100 close to the ear for a call, so as to automatically turn off the screen to save power.
  • the proximity light sensor 180G can also be used in leather case mode, automatic unlock and lock screen in pocket mode.
  • the ambient light sensor 180L is used for sensing ambient light brightness.
  • the first device 100 may adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the first device 100 is in the pocket, so as to prevent accidental touch.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the first device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access to application locks, take pictures with fingerprints, answer incoming calls with fingerprints, and the like.
  • the temperature sensor 180J is used to detect temperature.
  • the first device 100 uses the temperature detected by the temperature sensor 180J to implement a temperature treatment strategy. For example, when the temperature reported by the temperature sensor 180J exceeds the threshold, the first device 100 may reduce the performance of the processor located near the temperature sensor 180J, so as to reduce power consumption and implement thermal protection.
  • the first device 100 when the temperature is lower than another threshold, the first device 100 heats the battery 142 to prevent the first device 100 from being shut down abnormally due to the low temperature.
  • the first device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • Touch sensor 180K also known as "touch panel”.
  • the touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”.
  • the touch sensor 180K is used to detect a touch operation on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • Visual output related to the touch operation can be provided through the display screen 194 .
  • the touch sensor 180K may also be disposed on the surface of the first device 100 , which is different from the position of the display screen 194 .
  • the bone conduction sensor 180M can acquire vibration signals.
  • the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human voice.
  • the bone conduction sensor 180M can also contact the human pulse and receive the blood pressure beating signal.
  • the bone conduction sensor 180M can also be disposed in the earphone, combined into a bone conduction earphone.
  • the audio module 170 can analyze the voice signal based on the vibration signal of the vibrating bone mass of the vocal part acquired by the bone conduction sensor 180M, so as to realize the voice function.
  • the application processor can analyze the heart rate information based on the blood pressure beating signal acquired by the bone conduction sensor 180M, so as to realize the heart rate detection function.
  • the keys 190 include a power key, a volume key and the like.
  • the key 190 may be a mechanical key. It can also be a touch button.
  • the first device 100 may receive key input and generate key signal input related to user settings and function control of the first device 100 .
  • the motor 191 can generate a vibrating reminder.
  • the motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback.
  • touch operations applied to different applications may correspond to different vibration feedback effects.
  • the motor 191 may also correspond to different vibration feedback effects for touch operations acting on different areas of the display screen 194 .
  • Different application scenarios for example: time reminder, receiving information, alarm clock, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the indicator 192 can be an indicator light, and can be used to indicate charging status, power change, and can also be used to indicate messages, missed calls, notifications, and the like.
  • the SIM card interface 195 is used for connecting a SIM card.
  • the SIM card can be connected to and separated from the first device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195 .
  • the first device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
  • SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card etc. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of multiple cards may be the same or different.
  • the SIM card interface 195 is also compatible with different types of SIM cards.
  • the SIM card interface 195 is also compatible with external memory cards.
  • the first device 100 interacts with the network through the SIM card to implement functions such as calling and data communication.
  • the first device 100 adopts an eSIM, that is, an embedded SIM card.
  • the eSIM card can be embedded in the first device 100 and cannot be separated from the first device 100 .
  • the structure of the second device 200 may be similar to that of the first device 100 , or may be simplified based on the structure of the first device 100 .
  • the second device 200 also needs to include a ranging signal transmitting module, such as an ultrasonic transmitter, an infrared transmitter, a laser transmitter, and the like.
  • FIG. 3 shows a schematic diagram of a software structure of a first device in a ranging method provided by an embodiment of the present application.
  • the operating system in the first device may be an Android system, a Microsoft window system (Windows), an Apple mobile operating system (iOS) or a Harmony OS.
  • the operating system of the first device is the Harmony OS as an example for illustration.
  • the Hongmeng system can be divided into four layers, including a kernel layer, a system service layer, a framework layer, and an application layer, and the layers communicate through software interfaces.
  • the kernel layer includes a Kernel Abstract Layer (KAL) and a driver subsystem.
  • KAL includes multiple kernels, such as the kernel Linux Kernel of the Linux system, the lightweight IoT system kernel LiteOS, etc.
  • the driver subsystem may include a Hardware Driver Foundation (HDF).
  • HDF Hardware Driver Foundation
  • the hardware driver framework can provide a unified peripheral access capability and a driver development and management framework.
  • the multi-core kernel layer can select the corresponding kernel for processing according to the requirements of the system.
  • the system service layer is a collection of core capabilities of the Hongmeng system, and the system service layer provides services to applications through the framework layer.
  • This layer can include:
  • the framework layer provides Java, C, C++, JS and other multi-language user program frameworks and ability frameworks for Hongmeng system application development, and two user interface (UI) frameworks (including Java UI for the Java language) framework, a JS UI framework suitable for the JS language), and a multilingual framework application programming interface (Application Programming Interface, API) that is open to the outside world for various software and hardware services.
  • UI user interface
  • API Application Programming Interface
  • HarmonyOS can realize hardware mutual assistance and resource sharing through distributed soft bus, distributed device virtualization, distributed data management and distributed task scheduling.
  • the ninth time is T 9
  • the tenth time is T 10
  • the eleventh time is T 11
  • the twelfth time is T 12
  • the first offset time is ⁇ 1
  • the first device and the second device The two-way transmission delay between is the same as T d , then the following formula can be obtained:
  • the second device acquires the first moment when the ranging signal is sent.
  • the first moment may be after the second device confirms that the synchronization with the first device is completed, and the moment when a preset period of time has elapsed after confirming that the synchronization is completed is taken as the first moment.
  • the second device confirms that the synchronization with the first device is completed, which may be receiving a synchronization completion instruction from the first device, or sending a synchronization feedback identifier for a preset number of times. For example, if the preset duration is 10ms.
  • the second device sends the synchronization feedback identifier 200 times to the first device, it can be confirmed that the second device confirms that the synchronization with the first device is completed.
  • a ranging signal is sent to the first device, that is, the first moment is the time when the 200th synchronous feedback flag is sent plus 10 ms.
  • the first moment may be set by the second device when it leaves the factory.
  • the second device when it leaves the factory, it can be set to send a ranging signal every minute, and then a first moment can be obtained every minute after the system clock of the second device starts timing.
  • the device identification information of the second device may be obtained first, and then the factory settings of the second device may be obtained from the server according to the device identification information of the second device.
  • the first moment may be set according to an instruction.
  • the second device may receive a ranging signal sending instruction, and acquire at least one first moment included in the ranging signal sending instruction.
  • the ranging signal sending instruction may be sent by the first device through the wireless communication module. Or, it may also be sent by other electronic devices communicating with the second device, for example, it may be a ranging signal sending instruction forwarded by other second devices in the scene. If the scene includes a gateway device, and the gateway device communicates with the second device in a wireless manner, the ranging signal sending instruction may also be sent by the gateway device to the second device.
  • the first device may send a ranging signal sending instruction to the Bluetooth module of the second device through the Bluetooth module, and the ranging signal sending instruction may include instructing the second device to send a ranging signal after 5 seconds, then at the first moment Add 5 seconds to the moment when the second device receives the ranging signal sending instruction.
  • the ranging signal sending instruction may indicate to send multiple ranging signals. For example, you can instruct to send the first ranging signal after 5 seconds, then send the ranging signal every 5 seconds, and stop after sending 10 times. Then there are multiple first moments, and the difference between two adjacent first moments is 5 seconds.
  • the second device after the second device determines the first time, it will send the first time to the first device, and the first device receives the first time from the second device, that is, the acquired first time.
  • the second device sends the first time information to the first device by carrying the first time information in Bluetooth or wireless network (WiFi) information.
  • WiFi wireless network
  • the second device may add 10 ms to the time of completion of synchronization as the first time and send it to the first device, so that the first device can obtain the first moment.
  • the first device obtains the first time, and may first send a first time query instruction to the second device through the wireless communication module.
  • the second device will send the device identification information of the second device to the first device after receiving the first time query instruction, and the first device will The device identification information of the second device is queried to obtain the first moment. For example, if the data of the factory settings of the second device is stored on the first device, the corresponding second device may be found in the stored data of the factory settings of the second device according to the received device identification information of the second device, And obtain the factory settings corresponding to the second device, and then obtain the first moment.
  • the first device receives the device model of the second device, and determines according to the device model of the second device that the second device sends a ranging signal every integral minute. Then multiple first moments based on the system clock of the second device may be acquired according to the system clock of the first device and the first offset time.
  • the first offset time is 0.1 second
  • the current time of the system clock of the first device is T′ 1 .
  • T′ 1 can be corrected to the system clock of the second device according to the first offset time, and then the time of the next integral minute is determined as the first time.
  • the second device may send at least one first time to the first device after receiving the first time query instruction.
  • the first device uses a first moment closest to the current time among the multiple received first moments for calculating the distance.
  • the first device starts to receive the ranging signal, and acquires a fourth moment.
  • the second device sends a ranging signal at the first moment.
  • the first device acquires a second moment when the ranging signal is received.
  • Fig. 5 shows a schematic diagram of a system structure of a first device in a ranging method provided by an embodiment of the present application.
  • the system structure shown in FIG. 5 can be applied to an Android system or a Hongmeng system that uses ultrasonic distance measurement. It includes application layer, hardware virtualization layer (Android system) ⁇ framework layer and system service layer (Hongmeng system), kernel layer and hardware layer.
  • the application layer runs an application program, and the application program can receive and respond to a ranging instruction from a user, and instruct the first device to start ranging.
  • the hardware virtualization layer ⁇ framework layer and system service layer are used to pass the instructions of the application layer to the kernel layer.
  • the kernel layer includes hardware drivers. The kernel layer can control the corresponding hardware or obtain the parameters of the hardware through the hardware driver according to the instructions of the application layer.
  • the ranging signal receiving chip included in the hardware layer may be a HiFi chip, and the HiFi chip includes a 32-bit counter (32K Counter) for timing, that is, the chip clock.
  • the kernel layer may include a HiFi chip driver (HiFi Driver), and the HiFi chip may respond to instructions from the upper layer to start receiving ranging signals, and record the fourth moment T 4 when starting to receive ranging signals through a 32-bit counter.
  • T 4 Since T 4 is obtained based on the chip clock, in order to obtain the second time T 2 based on the system clock, T 4 may be corrected to a third time T 3 based on the system time. Then T 3 is added to the receiving interval time to obtain the second time T 2 based on the system clock.
  • the receiving interval time is a time interval between starting to receive the ranging signal and receiving the ranging signal.
  • the receiving time interval can be obtained at the chip level (that is, taking T4 as a reference).
  • the time interval may also be acquired at the software level (that is, based on T3 ), which is not limited in the present application.
  • FIG. 6 shows a schematic flow chart of acquiring T 2 in the ranging method provided by the embodiment of the present application.
  • the ranging application program when the ranging application program is started, it can be determined that the ranging instruction is received.
  • At least one available second device may be displayed on the screen of the first device.
  • the display can be displayed in the form of text or icons.
  • the first device may also receive the distance measurement instruction through voice control, gesture and other operation methods, and the method of receiving the distance measurement instruction is not limited in this application.
  • the HiFi chip may actively send the fourth moment to the driver of the HiFi chip after obtaining the fourth moment. Alternatively, you can also wait to receive the four-time query command sent by the driver of the HiFi chip. After receiving the fourth time query instruction, send the fourth time to the driver of the HiFi chip.
  • the driver program of the HiFi chip acquires the fifth moment based on the system clock and the sixth moment based on the chip clock at the same time, and the time difference between the fourth moment and the sixth moment is the second offset time.
  • the driver can read instructions from the system clock to obtain the fifth time based on the system clock, for example, the fifth time can be obtained through the "do_gettimeofday" instruction.
  • the driver obtains the sixth moment based on the chip clock, the sixth moment can be obtained by reading the value of the register in the 32-bit counter in the HiFi chip by referring to the example in S430.
  • the second offset time is ⁇ 2 , which represents the duration from the start of recording to the acquisition of the fifth moment based on the system clock and the sixth moment based on the chip clock. If the fourth moment is T 4 and the sixth moment is T 6 , then:
  • T 6 when T 6 is smaller than T 4 , it means that the 32-bit counter may overflow, so correct T 6 and then calculate to get accurate ⁇ 2 .
  • the driver program of S480 and HiFi chip sends the third moment to the application program of the application layer.
  • the application program at the application layer adds the receiving interval to the third time to obtain the second time.
  • the second moment T 2 is:
  • the fifth time based on the system clock and the sixth time based on the chip clock are obtained simultaneously through the HiFi driver. Then, the fourth moment when the ranging signal is started to be received based on the chip clock (that is, the recording is started) is corrected to the third moment when the ranging signal is started to be received based on the system clock. It realizes the conversion of the underlying chip clock into the upper system clock, and then supports the function of ultrasonic ranging, making the ranging accuracy more accurate and the error lower.
  • FIG. 7 shows a schematic flow chart of another method for obtaining T 2 in the ranging method provided by the embodiment of the present application.
  • the process includes:
  • the application program of the application layer receives and responds to the ranging instruction, and starts to receive the ranging signal.
  • the application program sends an instruction to the HiFi chip at the hardware layer, instructing the HiFi chip to start recording.
  • the application program of the application layer sends the third moment query instruction to the HiFi chip through the hardware virtual layer ⁇ framework layer and the system service layer.
  • the application program of the application layer can send query instructions to Audiohal in the hardware virtualization layer ⁇ framework layer and the system service layer, such as "getParameter('Nearby_RecordTime')". Then, after Audiohal responds to the query command, it can instruct the HiFi chip to obtain the third moment through IOCtrl and send the third moment to the application program of the application layer after obtaining it.
  • the HiFi chip can read instructions through the system clock to obtain the fifth time based on the system clock, for example, the fifth time can be obtained through the "do_gettimeofday" instruction.
  • the HiFi chip obtains the sixth moment based on the chip clock, the sixth moment can be obtained by reading the value of the register in the 32-bit counter in the HiFi chip by referring to the example in S430.
  • the second offset time is ⁇ 2 , which represents the duration from the start of recording to the acquisition of the fifth moment based on the system clock and the sixth moment based on the chip clock. If the fourth moment is T 4 and the sixth moment is T 6 , then:
  • the HiFi chip obtains the third moment according to the fifth moment and the second offset time.
  • the HiFi chip may pass the obtained third moment to the application program of the application layer through the IOCtrl.
  • the second moment T 2 is:
  • the fifth time based on the system clock and the sixth time based on the chip clock are obtained simultaneously through the HiFi chip. Then, the fourth moment when the ranging signal is started to be received based on the chip clock (that is, the recording is started) is corrected to the third moment when the ranging signal is started to be received based on the system clock. It realizes the conversion of the bottom chip clock into the upper system clock, and then supports the function of ultrasonic distance measurement, so that the distance measurement accuracy can be more accurate and the error is lower.
  • the first device can also obtain the atmospheric pressure P and relative humidity RH of the current scene to obtain the atmospheric pressure P and relative humidity RH of the current scene to
  • the unit of V is m/s
  • the unit of T is Celsius
  • the first device may acquire atmospheric pressure P, relative humidity RH, and temperature T from sensors set in the current scene. If no corresponding sensor is set in the current scene, the location information of the current scene can be obtained, and the atmospheric pressure P, relative humidity RH and temperature T of the current location can be obtained from the server according to the location information.
  • sequence numbers of the steps in the above embodiments do not mean the order of execution.
  • S340 is shown to be performed after S310, but S340 may also be performed before S310.
  • the execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiment of the present application.
  • FIG. 8 shows a structural block diagram of a ranging device applied to the first device provided in the embodiment of the present application. For the convenience of description, only Parts related to the embodiments of the present application are shown.
  • the ranging device applied to the first device includes:
  • An acquisition module 61 configured to acquire a first offset time and a first moment, the first offset time is the time difference between the system clock of the first device and the system clock of the second device, and the first moment is the moment when the second device sends a ranging signal , the first moment is obtained based on the system clock of the second device.
  • the obtaining module 61 is also used to obtain the second moment when the ranging signal is received, the second moment is obtained according to the third moment when the first device starts to receive the ranging signal and the receiving interval time, the third moment is obtained according to the The fourth moment when the distance signal receiving chip starts to receive the distance measurement signal, the system clock of the first device and the chip clock of the distance measurement signal reception chip are converted. time interval between.
  • the calculating module 62 is configured to acquire the distance between the first device and the second device according to the first offset time, the first moment and the second moment.
  • the acquiring module 61 is specifically used for the ranging signal receiving chip to acquire the fourth moment and send the fourth moment to the driver of the ranging signal receiving chip.
  • the driver program of the ranging signal receiving chip corrects the fourth moment to the third moment based on the system clock.
  • the driver program of the ranging signal receiving chip sends the third moment to the application layer, and adds the receiving interval time to the third moment in the application layer to obtain the second moment.
  • the acquisition module 61 specifically the driver program for the ranging signal receiving chip, corrects the fourth time to the third time based on the system clock when receiving the fourth time.
  • the driver program of the ranging signal receiving chip corrects the fourth moment to the third moment based on the system clock in response to the parameter acquisition instruction from the application layer.
  • the obtaining module 61 is specifically used for the ranging signal receiving chip to obtain the fourth moment.
  • the driver program of the ranging signal receiving chip responds to the parameter acquisition instruction, acquires the fourth moment from the ranging signal receiving chip, and corrects the fourth moment to the third moment based on the system clock.
  • the driver program of the ranging signal receiving chip sends the third moment to the application layer, and adds the interval time to the third moment in the application layer to obtain the second moment.
  • the acquisition module 61 is specifically used to receive the driver program of the chip through the ranging signal, and simultaneously acquire the fifth moment based on the system clock and the sixth moment based on the chip clock, and the time difference between the fourth moment and the sixth moment is Second offset time.
  • the third moment is obtained according to the fifth moment and the second offset time.
  • the calculating module 62 is specifically configured to acquire the time-of-flight of the ranging signal according to the first offset time, the first moment and the second moment. Acquire the distance between the first device and the second device according to the propagation speed and flight time of the ranging signal in the medium.
  • the calculation module 62 is specifically configured to correct the first time to the seventh time based on the system clock of the first device according to the first offset time; subtract the seventh time from the second time to obtain the ranging signal flight time. Or, according to the first offset time, correct the second time to the eighth time based on the system clock of the second device; subtract the first time from the eighth time to obtain the flight time of the ranging signal.
  • the obtaining module 61 is specifically configured to sequentially send at least one synchronization command to the second device, and record the ninth moment when each synchronization command is sent based on the system clock of the first device.
  • Receive the synchronization feedback identifier from the second device record the tenth moment when each synchronization feedback identifier is received based on the system clock of the first device, the synchronization feedback identifier includes the eleventh moment when the second device receives the synchronization instruction and the second device
  • the twelfth moment, the eleventh moment and the twelfth moment when the synchronization feedback identifier is sent are obtained based on the system clock of the second device. According to the ninth moment, the tenth moment, the eleventh moment and the twelfth moment, the first offset time is obtained.
  • the obtaining module 61 is specifically configured to send a first time query instruction to the second device. At least one first moment sent by the second device is received.
  • the obtaining module 61 is specifically configured to send a first time query instruction to the second device. Receive device identification information sent by the second device. Acquiring at least one preset first moment according to the device identification information.
  • FIG. 9 shows a structural block diagram of a ranging device applied to the second device provided in the embodiment of the present application. For the convenience of description, only Parts related to the embodiments of the present application are shown.
  • the ranging device applied to the second device includes:
  • the obtaining module 71 is configured to obtain the first moment when the ranging signal is sent.
  • a sending module 72 configured to send the first moment to the first device.
  • the sending module 72 is further configured to send a ranging signal at the first moment based on the system clock of the second device.
  • the apparatus further includes a receiving module 73, configured to receive at least one synchronization command from the first device, and record the eleventh moment when each synchronization command is received based on the system clock of the second device.
  • a receiving module 73 configured to receive at least one synchronization command from the first device, and record the eleventh moment when each synchronization command is received based on the system clock of the second device.
  • the synchronization feedback identifier includes the eleventh moment and the twelfth moment when the synchronization feedback identifier is sent.
  • the twelfth moment is obtained based on the system clock record of the second device.
  • the obtaining module 71 is specifically configured to confirm that the synchronization with the first device is completed.
  • the time when the preset period of time has elapsed after confirming that the synchronization is completed is taken as the first time.
  • the acquiring module 71 is specifically configured to receive the instruction for sending the ranging signal, and acquire at least one first moment included in the instruction for sending the ranging signal. Or, at least one preset first moment is acquired according to the device identification information of the second device.
  • the sending module 72 is further configured to send the first time to the first device after the first time is obtained.
  • the apparatus further includes a response module 74, configured to send at least one first time to the first device in response to a first time query instruction from the first device.
  • the response module 74 is further configured to send the device identification information of the second device to the first device in response to the first time query instruction from the first device.
  • FIG. 10 is a structural block diagram of a first device provided in an embodiment of the present application. As shown in Figure 10, the first device 8 of this embodiment includes:
  • At least one processor 801 (only one is shown in FIG. 10 ), a memory 802, a ranging signal receiving component 804, and a computer program 803 stored in the memory 802 and operable on the at least one processor 801, the processor 801
  • the ranging signal receiving component 804 implements the steps in the above control method embodiment.
  • the first device 8 may be a mobile phone, a tablet computer, an augmented reality (augmented reality, AR)/virtual reality (virtual reality, VR) device, a large-screen device, a notebook computer, a netbook, a personal digital assistant (personal digital assistant, PDA), etc. .
  • FIG. 10 is only an example of the first device 8 and does not constitute a limitation to the first device 8. It may include more or less components than those shown in the illustration, or combine certain components, or be different. Components, for example, may also include input and output devices, network access devices, and so on.
  • the so-called processor 801 can be a central processing unit (Central Processing Unit, CPU), and the processor 801 can also be other general processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit , ASIC), SOC, off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
  • the storage 802 may be an internal storage unit of the first device 8 in some embodiments, such as a hard disk or a memory of the first device 8 .
  • the memory 802 may also be an external storage device of the first device 8 in other embodiments, such as a plug-in hard disk equipped on the first device 8, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, flash memory card (Flash Card), etc.
  • the memory 802 may also include both an internal storage unit of the first device 8 and an external storage device.
  • the memory 802 is used to store operating systems, application programs, boot loaders (BootLoader), data, and other programs, such as program codes of computer programs.
  • the memory 802 can also be used to temporarily store data that has been output or will be output.
  • FIG. 11 is a structural block diagram of a second device provided by an embodiment of the present application. As shown in Figure 11, the second device 9 of this embodiment includes:
  • At least one processor 901 (only one is shown in FIG. 11 ), a memory 902, a ranging signal transmitting component 904, and a computer program 903 stored in the memory 902 and operable on the at least one processor 901, the processor 901 executes the computer In program 903 , the steps in the above control method embodiment are implemented by the ranging signal transmitting component 904 .
  • the second device 9 may be a terminal device including a function of transmitting a ranging signal, a first device having a function of transmitting a ranging signal, or the like.
  • the terminal device including the distance measuring signal transmission function may be an electronic tag, a smart key fob including an electronic tag, a Bluetooth headset, and the like.
  • FIG. 11 is only an example of the second device 9, and does not constitute a limitation to the second device 9. It may include more or less components than those shown in the illustration, or combine certain components, or be different. Components, for example, may also include input and output devices, network access devices, and so on.
  • the so-called processor 901 can be a central processing unit (Central Processing Unit, CPU), and the processor 901 can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit) , ASIC), SOC, off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
  • the storage 902 may be an internal storage unit of the second device 9 in some embodiments, such as a hard disk or a memory of the second device 9 .
  • the memory 902 may also be an external storage device of the second device 9 in other embodiments, such as a plug-in hard disk equipped on the second device 9, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, flash memory card (Flash Card), etc.
  • the memory 902 may also include both an internal storage unit of the second device 9 and an external storage device.
  • the memory 902 is used to store operating systems, application programs, boot loaders (BootLoader), data, and other programs, such as program codes of computer programs.
  • the memory 902 can also be used to temporarily store data that has been output or will be output.
  • An embodiment of the present application provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium.
  • the computer program implements the method applied to the first device when executed by the processor.
  • An embodiment of the present application provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, a method applied to a second device is implemented.
  • An embodiment of the present application provides a computer program product.
  • the terminal device is made to execute the above-mentioned method applied to the first device.
  • An embodiment of the present application provides a computer program product, which enables a terminal device to execute the above-mentioned method applied to the second device when the computer program product runs on the second device.
  • An embodiment of the present application provides a chip system, where the chip system includes a memory and a processor, and the processor executes a computer program stored in the memory to implement a method applied to a first device.
  • An embodiment of the present application provides a chip system, where the chip system includes a memory and a processor, and the processor executes a computer program stored in the memory to implement a method applied to a second device.
  • An embodiment of the present application provides a chip system, the chip system includes a processor, the processor is coupled to the computer-readable storage medium provided in the eighth aspect, and the processor executes the computer program stored in the computer-readable storage medium to implement the application The method of the first device.
  • An embodiment of the present application provides a chip system, the chip system includes a processor, the processor is coupled to the computer-readable storage medium provided in the ninth aspect, and the processor executes the computer program stored in the computer-readable storage medium to implement the application The method of the second device.
  • the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the procedures in the method of the above-mentioned embodiments in the present application can be completed by instructing related hardware through a computer program.
  • the computer program can be stored in a computer-readable storage medium.
  • the computer program When executed by a processor, the steps in the above-mentioned various method embodiments can be realized.
  • the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form.
  • the computer-readable medium may at least include: any entity or device capable of carrying computer program codes to the first device or the second device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random memory Access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium.
  • ROM read-only memory
  • RAM random memory Access memory
  • electrical carrier signal telecommunication signal and software distribution medium.
  • U disk mobile hard disk, magnetic disk or optical disk, etc.
  • computer readable media may not be electrical carrier signals and telecommunication signals under legislation and patent practice.
  • the disclosed method, device, system, first device or second device may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components can be Incorporation may either be integrated into another system, or some features may be omitted, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

Abstract

一种测距方法、装置、系统及可读存储介质;测距方法包括获取第一偏移时间和第一时刻,第一偏移时间为第一设备(100)系统时钟与第二设备(200)系统时钟的时间差,第一时刻是第二设备(200)发送测距信号的时刻。获取接收到测距信号时的第二时刻(S360),第二时刻是根据第一设备(100)开始接收测距信号时的第三时刻和接收间隔时间得到的,第三时刻是根据测距信号接收芯片开始接收测距信号时的第四时刻、第一设备(100)的系统时钟以及测距信号接收芯片的芯片时钟转换得到的。根据第一偏移时间、第一时刻和第二时刻获取第一设备(100)与第二设备(200)之间的距离(S370)。由于系统时钟的精度较高,因此根据系统时钟获取的时刻计算得到的距离也更加精准、误差更小。

Description

测距方法、装置、系统及可读存储介质
本申请要求于2022年02月28日提交国家知识产权局、申请号为202210196160.2、申请名称为“测距方法、装置、系统及可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及终端领域,尤其涉及一种测距方法、装置、系统及可读存储介质。
背景技术
单向测距是一种广泛应用的技术。单向测距可以通过主设备获取主设备与从设备之间的距离。例如,通过手机获取手机与已配对的蓝牙耳机之间的距离等。
目前,单向测距的方案主要是通过主设备读取从设备连接的信号强度,并通过信号强度反推得到主设备和从设备之间的距离。
但是,现有的单向测距方案计算得到的距离精确度不足,误差较大。
发明内容
本申请实施例提供了一种测距方法、装置、系统及可读存储介质,可以解决现有的单向测距方案计算得到的距离精确度不足,误差较大的问题。
第一方面,本申请实施例提供了一种测距方法,应用于第一设备,包括:
获取第一偏移时间和第一时刻,第一偏移时间为第一设备系统时钟与第二设备系统时钟的时间差,第一时刻是第二设备发送测距信号的时刻,第一时刻是基于第二设备的系统时钟得到的。获取接收到测距信号时的第二时刻,第二时刻是根据第一设备开始接收测距信号时的第三时刻和接收间隔时间得到的,第三时刻是根据测距信号接收芯片开始接收测距信号时的第四时刻、第一设备的系统时钟以及测距信号接收芯片的芯片时钟转换得到的,接收间隔时间是开始接收测距信号与接收到测距信号之间的时间间隔。根据第一偏移时间、第一时刻和第二时刻获取第一设备与第二设备之间的距离。
在第一方面的一种可能的实现方式中,第一设备可以是手机、平板电脑、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、大屏设备、笔记本电脑、上网本、个人数字助理(personal digital assistant,PDA)等,第一设备需要具有接收测距信号的能力,本申请实施例对第一设备的具体类型不作任何限制。第二设备则可以是包括测距信号发射功能的终端设备、具有测距信号发射功能的第一设备等。例如,包括测距信号发射功能的终端设备可以是电子标签、包括电子标签的智能钥匙扣、蓝牙耳机等。
在第一方面中,第一设备获取与第二设备的系统时钟的第一偏移时间,将第一设备的系统时间与第二设备的系统时间同步。然后,获取接收到第二设备发送的测距信号的第二时刻以及获取第二设备发送测距信号的第一时刻。最后,根据第一偏移时间、第一时刻和第二时刻即可计算得到第一设备与第二设备之间的距离。由于系统时钟的精度较高,因此根据系统时钟获取的时刻计算的得到的距离也更加精准,误差更小。
一些实施方式中,获取接收到测距信号时的第二时刻,包括:测距信号接收芯片获取第四时刻并将第四时刻发送给测距信号接收芯片的驱动程序。测距信号接收芯片的驱动程序将第四时刻修正为基于系统时钟的第三时刻。测距信号接收芯片的驱动程序将第三时刻发送至应用层,在应用层将第三时刻加上接收间隔时间,得到第二时刻。
一些实施方式中,测距信号接收芯片的驱动程序将第四时刻修正为基于系统时钟的第三时刻,包括:测距信号接收芯片的驱动程序在接收到第四时刻时,将第四时刻修正为基于系统时钟的第三时刻。或,测距信号接收芯片的驱动程序响应来自应用层的参数获取指令,将第四时刻修正为基于系统时钟的第三时刻。
一些实施方式中,获取接收到测距信号时的第二时刻,包括:测距信号接收芯片获取第四时刻。测距信号接收芯片的驱动程序响应参数获取指令,从测距信号接收芯片获取第四时刻,并将第四时刻修正为基于系统时钟的第三时刻。测距信号接收芯片的驱动程序将第三时刻发送至应用层,在应用层将第三时刻加上间隔时间,得到第二时刻。
一些实施方式中,将第四时刻修正为基于系统时钟的第三时刻,包括:通过测距信号接收芯片的驱动程序,同时获取基于系统时钟的第五时刻和基于芯片时钟的第六时刻,第四时刻和第六时刻的时间差为第二偏移时间。根据第五时刻和第二偏移时间得到第三时刻。
一些实施方式中,根据第一偏移时间、第一时刻和第二时刻获取第一设备与第二设备之间的距离,包括:根据第一偏移时间、第一时刻和第二时刻获取测距信号的飞行时间。根据测距信号在介质中的传播速度和飞行时间,获取第一设备与第二设备之间的距离。
一些实施方式中,根据第一偏移时间、第一时刻和第二时刻获取测距信号的飞行时间,包括:根据第一偏移时间,将第一时刻修正为基于第一设备系统时钟的第七时刻;将第二时刻减去第七时刻,得到测距信号的飞行时间。或,根据第一偏移时间,将第二时刻修正为基于第二设备系统时钟的第八时刻;将第八时刻减去第一时刻,得到测距信号的飞行时间。
一些实施方式中,获取第一偏移时间,包括:第一设备依次向第二设备发送至少一个同步指令,基于第一设备系统时钟记录发送每个同步指令时的第九时刻。接收来自第二设备的同步反馈标识,基于第一设备系统时钟记录接收到每个同步反馈标识时的第十时刻,同步反馈标识包括第二设备接收到同步指令的第十一时刻以及第二设备发送同步反馈标识时的第十二时刻,第十一时刻和第十二时刻是基于第二设备系统时钟得到的。根据第九时刻、第十时刻、第十一时刻以及第十二时刻,获取第一偏移时间。
一些实施方式中,获取第一时刻,包括:向第二设备发送第一时刻查询指令。接收第二设备发送的至少一个第一时刻。
一些实施方式中,获取第一时刻,包括:向第二设备发送第一时刻查询指令。接收第二设备发送的设备识别信息。根据设备识别信息,获取预先设置的至少一个第一时刻。
第二方面,本申请实施例提供了一种测距方法,应用于第二设备,包括:获取发 送测距信号的第一时刻。向第一设备发送第一时刻。基于第二设备的系统时钟,在第一时刻时发送测距信号。
一些实施方式中,在基于第二设备的系统时钟,在第一时刻时发送测距信号之前,方法还包括:接收来自第一设备的至少一个同步指令,基于第二设备系统时钟记录接收到每个同步指令时的第十一时刻。响应每个同步指令,向第一设备发送同步反馈标识,同步反馈标识包括第十一时刻和发送同步反馈标识时的第十二时刻,第十二时刻是基于第二设备系统时钟记录得到的。
一些实施方式中,获取发送测距信号的第一时刻,包括:确认与第一设备完成同步。将确认完成同步后经过预设时长的时刻作为第一时刻。
一些实施方式中,获取发送测距信号的第一时刻,包括:接收测距信号发送指令,获取测距信号发送指令中包括的至少一个第一时刻。或,根据第二设备的设备识别信息,获取预先设置的至少一个第一时刻。
一些实施方式中,向第一设备发送第一时刻,包括:在获取到第一时刻后,将第一时刻发送给第一设备。或,响应来自第一设备的第一时刻查询指令,向第一设备发送至少一个第一时刻。
一些实施方式中,向第一设备发送第一时刻还包括:响应来自第一设备的第一时刻查询指令,向第一设备发送第二设备的设备识别信息。
第三方面,本申请实施例提供了一种测距系统,包括第一设备和第二设备,包括:第一设备获取第一偏移时间和第一时刻,第一偏移时间为第一设备系统时钟与第二设备系统时钟的时间差,第一时刻是第二设备发送测距信号的时刻,第一时刻是基于第二设备的系统时钟得到的。第二设备基于第二设备的系统时钟,在第一时刻时发送测距信号。第一设备获取接收到测距信号时的第二时刻,第二时刻是根据第一设备开始接收测距信号时的第三时刻和接收间隔时间得到的,第三时刻是根据测距信号接收芯片开始接收测距信号时的第四时刻、第一设备的系统时钟以及测距信号接收芯片的芯片时钟转换得到的,接收间隔时间是开始接收测距信号与接收到测距信号之间的时间间隔。第一设备根据第一偏移时间、第一时刻和第二时刻获取第一设备与第二设备之间的距离。
第四方面,本申请实施例提供了一种测距装置,应用于第一设备,包括:
获取模块,用于获取第一偏移时间和第一时刻,第一偏移时间为第一设备系统时钟与第二设备系统时钟的时间差,第一时刻是第二设备发送测距信号的时刻,第一时刻是基于第二设备的系统时钟得到的。
获取模块,还用于获取接收到测距信号时的第二时刻,第二时刻是根据第一设备开始接收测距信号时的第三时刻和接收间隔时间得到的,第三时刻是根据测距信号接收芯片开始接收测距信号时的第四时刻、第一设备的系统时钟以及测距信号接收芯片的芯片时钟转换得到的,接收间隔时间是开始接收测距信号与接收到测距信号之间的时间间隔。
计算模块,用于根据第一偏移时间、第一时刻和第二时刻获取第一设备与第二设备之间的距离。
一些实施方式中,获取模块,具体用于测距信号接收芯片获取第四时刻并将第四 时刻发送给测距信号接收芯片的驱动程序。测距信号接收芯片的驱动程序将第四时刻修正为基于系统时钟的第三时刻。测距信号接收芯片的驱动程序将第三时刻发送至应用层,在应用层将第三时刻加上接收间隔时间,得到第二时刻。
一些实施方式中,获取模块,具体用于测距信号接收芯片的驱动程序在接收到第四时刻时,将第四时刻修正为基于系统时钟的第三时刻。或,测距信号接收芯片的驱动程序响应来自应用层的参数获取指令,将第四时刻修正为基于系统时钟的第三时刻。
一些实施方式中,获取模块,具体用于测距信号接收芯片获取第四时刻。测距信号接收芯片的驱动程序响应参数获取指令,从测距信号接收芯片获取第四时刻,并将第四时刻修正为基于系统时钟的第三时刻。测距信号接收芯片的驱动程序将第三时刻发送至应用层,在应用层将第三时刻加上间隔时间,得到第二时刻。
一些实施方式中,获取模块,具体用于通过测距信号接收芯片的驱动程序,同时获取基于系统时钟的第五时刻和基于芯片时钟的第六时刻,第四时刻和第六时刻的时间差为第二偏移时间。根据第五时刻和第二偏移时间得到第三时刻。
一些实施方式中,计算模块,具体用于根据第一偏移时间、第一时刻和第二时刻获取测距信号的飞行时间。根据测距信号在介质中的传播速度和飞行时间,获取第一设备与第二设备之间的距离。
一些实施方式中,计算模块,具体用于根据第一偏移时间,将第一时刻修正为基于第一设备系统时钟的第七时刻;将第二时刻减去第七时刻,得到测距信号的飞行时间。或,根据第一偏移时间,将第二时刻修正为基于第二设备系统时钟的第八时刻;将第八时刻减去第一时刻,得到测距信号的飞行时间。
一些实施方式中,获取模块,具体用于依次向第二设备发送至少一个同步指令,基于第一设备系统时钟记录发送每个同步指令时的第九时刻。接收来自第二设备的同步反馈标识,基于第一设备系统时钟记录接收到每个同步反馈标识时的第十时刻,同步反馈标识包括第二设备接收到同步指令的第十一时刻以及第二设备发送同步反馈标识时的第十二时刻,第十一时刻和第十二时刻是基于第二设备系统时钟得到的。根据第九时刻、第十时刻、第十一时刻以及第十二时刻,获取第一偏移时间。
一些实施方式中,获取模块,具体用于向第二设备发送第一时刻查询指令。接收第二设备发送的至少一个第一时刻。
一些实施方式中,获取模块,具体用于向第二设备发送第一时刻查询指令。接收第二设备发送的设备识别信息。根据设备识别信息,获取预先设置的至少一个第一时刻。
第五方面,本申请实施例提供了一种测距装置,应用于第二设备,包括:获取模块,用于获取发送测距信号的第一时刻。发送模块,用于向第一设备发送第一时刻。发送模块,还用于基于第二设备的系统时钟,在第一时刻时发送测距信号。
一些实施方式中,该装置还包括接收模块,用于接收来自第一设备的至少一个同步指令,基于第二设备系统时钟记录接收到每个同步指令时的第十一时刻。响应每个同步指令,向第一设备发送同步反馈标识,同步反馈标识包括第十一时刻和发送同步反馈标识时的第十二时刻,第十二时刻是基于第二设备系统时钟记录得到的。
一些实施方式中,获取模块,具体用于确认与第一设备完成同步。将确认完成同 步后经过预设时长的时刻作为第一时刻。
一些实施方式中,获取模块,具体用于接收测距信号发送指令,获取测距信号发送指令中包括的至少一个第一时刻。或,根据第二设备的设备识别信息,获取预先设置的至少一个第一时刻。
一些实施方式中,发送模块,还用于在获取到第一时刻后,将第一时刻发送给第一设备。或,该装置还包括响应模块,用于响应来自第一设备的第一时刻查询指令,向第一设备发送至少一个第一时刻。
一些实施方式中,响应模块,还用于响应来自第一设备的第一时刻查询指令,向第一设备发送第二设备的设备识别信息。
第六方面,本申请实施例提供了一种电子设备,包括存储器、处理器、测距信号接收组件以及存储在存储器中并可在处理器上运行的计算机程序。处理器执行计算机程序时实现第一方面提供的方法。
第七方面,本申请实施例提供了一种电子设备,包括存储器、处理器、测距信号发射组件以及存储在存储器中并可在处理器上运行的计算机程序。处理器执行计算机程序时实现第二方面提供的方法。
第八方面,本申请实施例提供了一种计算机可读存储介质,计算机可读存储介质存储有计算机程序。计算机程序被处理器执行时实现第一方面提供的方法。
第九方面,本申请实施例提供了一种计算机可读存储介质,计算机可读存储介质存储有计算机程序,计算机程序被处理器执行时实现第二方面提供的方法。
第十方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在第一设备上运行时,使得终端设备执行上述第一方面提供的方法。
第十一方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在第二设备上运行时,使得终端设备执行上述第二方面提供的方法。
第十二方面,本申请实施例提供了一种芯片系统,芯片系统包括存储器和处理器,处理器执行存储器中存储的计算机程序,以实现第一方面提供的方法。
第十三方面,本申请实施例提供了一种芯片系统,芯片系统包括存储器和处理器,处理器执行存储器中存储的计算机程序,以实现第二方面提供的方法。
第十四方面,本申请实施例提供了一种芯片系统,芯片系统包括处理器,处理器与第八方面提供的计算机可读存储介质耦合,处理器执行计算机可读存储介质中存储的计算机程序,以实现第一方面提供的方法。
第十五方面,本申请实施例提供了一种芯片系统,芯片系统包括处理器,处理器与第九方面提供的计算机可读存储介质耦合,处理器执行计算机可读存储介质中存储的计算机程序,以实现第二方面提供的方法。
可以理解的是,上述第二方面至第十五方面的有益效果可以参见上述第一方面中的相关描述,在此不再赘述。
附图说明
图1示出了本申请实施例提供的一种测距方法的应用场景示意图;
图2示出了本申请实施例提供的一种测距方法中的第一设备的结构示意图;
图3示出了本申请实施例提供的一种测距方法中第一设备的软件结构示意图;
图4示出了本申请实施例提供的一种测距方法的示意性流程图;
图5示出了本申请实施例提供的一种测距方法中第一设备的系统结构示意图;
图6示出了本申请实施例提供的测距方法中一种获取T 2的流程示意图;
图7示出了本申请实施例提供的测距方法中另一种获取T 2的流程示意图;
图8示出了本申请实施例提供的一种应用于第一设备的测距装置的结构框图;
图9示出了本申请实施例提供的一种应用于第二设备的测距装置的结构框图;
图10为本申请实施例提供的一种第一设备的结构框图;
图11为本申请实施例提供的一种第二设备的结构框图。
具体实施方式
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。
应当理解,当在本申请说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。
还应当理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。
如在本申请说明书和所附权利要求书中所使用的那样,术语“如果”可以依据上下文被解释为“当...时”或“一旦”或“响应于确定”或“响应于检测到”。
另外,在本申请说明书和所附权利要求书的描述中,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。
在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。
在现有技术中,单向测距时往往是通过第一设备获取与第二设备连接时的信号强度,并通过信号强度与距离的函数关系反推得到第一设备和第二设备之间的距离。但是,由于信号强度的精度不高,且信号还会受到干扰而导致信号强度发生变化,因此测距结果精度不高,误差较大。
对此,本申请提供了一种应用于第一设备的测距方法,包括:获取第一偏移时间和第一时刻,第一偏移时间为第一设备系统时钟与第二设备系统时钟的时间差,第一时刻是第二设备发送测距信号的时刻,第一时刻是基于第二设备的系统时钟得到的。获取接收到测距信号时的第二时刻,第二时刻是根据第一设备开始接收测距信号时的第三时刻和接收间隔时间得到的,第三时刻是根据测距信号接收芯片开始接收测距信号时的第四时刻、第一设备的系统时钟以及测距信号接收芯片的芯片时钟转换得到的,接收间隔时间是第四时刻与测距信号接收芯片接收到测距信号时的间隔时间。根据第 一偏移时间、第一时刻和第二时刻获取第一设备与第二设备之间的距离。以及,提供了一种应用于第二设备的测距方法,包括:获取发送测距信号的第一时刻。基于第二设备的系统时钟,在第一时刻时发送测距信号。
在本申请中,第一设备获取与第二设备的系统时钟的第一偏移时间,将第一设备的系统时间与第二设备的系统时间同步。然后,获取接收到第二设备发送的测距信号的第二时刻以及获取第二设备发送测距信号的第一时刻。最后,根据第一偏移时间、第一时刻和第二时刻即可计算得到第一设备与第二设备之间的距离。由于系统时钟的精度较高,因此根据系统时钟获取的时刻计算的得到的距离也更加精准,误差更小。
在本申请中,以第一设备和第二设备之间通过超声波测距为例进行说明。需要说明的是,在其他情况下,第一设备和第二设备之间还可以通过激光测距、红外测距等方式实现,本申请对测距时使用的媒介不作限制。
图1示出了本申请实施例提供的一种测距方法的应用场景示意图。
参考图1,其中包括至少一个第一设备100和至少一个第二设备200。第一设备100可以是手机、平板电脑、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、大屏设备、笔记本电脑、上网本、个人数字助理(personal digital assistant,PDA)等,第一设备100需要具有接收测距信号的能力,本申请实施例对第一设备100的具体类型不作任何限制。对于超声波测距,第一设备100需要具有能够接收超声波的录音设备,如包括能够接收超声波的麦克风以及对应的音频芯片,例如,音频芯片可以是高保真(High-Fidelity,HiFi)芯片。
第二设备200则可以是包括测距信号发射功能的终端设备、具有测距信号发射功能的第一设备100等。例如,包括测距信号发射功能的终端设备可以是电子标签、包括电子标签的智能钥匙扣、蓝牙耳机等。对于超声波测距,第二设备200需要具有能够发射超声波的装置。
第一设备100可以通过音频芯片和麦克风录制超声波信号。第二设备200可以通过超声波发射装置发送测距信号,测距信号可以是特定频率的超声波脉冲信号或者方波信号等。
图2示出了本申请实施例提供的一种测距方法中的第一设备的结构示意图。
在图2中,第一设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
可以理解的是,本申请实施例示意的结构并不构成对第一设备100的具体限定。在本申请另一些实施例中,第一设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软 件或软件和硬件的组合实现。
作为举例,当第一设备100为手机、平板电脑或大屏设备时,可以包括图示中的全部部件,也可以仅包括图示中的部分部件。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
其中,控制器可以是第一设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现第一设备100的触摸功能。
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号。
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。
在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号。I2S接口和PCM接口都可以用于音频通信。
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在与并行通信之间转换。
在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。 例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。
在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现第一设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现第一设备100的显示功能。
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为第一设备100充电,也可以用于第一设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对第一设备100的结构限定。在本申请另一些实施例中,第一设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。
在一些无线充电的实施例中,充电管理模块140可以通过第一设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。
在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。
第一设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。第一设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在第一设备100上的包括2G/3G/4G/5G等无线通 信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。
在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。
在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。
在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在第一设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,第一设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得第一设备100可以通过无线通信技术与网络以及其他设备通信。
无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
第一设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算, 用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。例如本申请实施例中的教学视频和用户动作画面视频,显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。
在一些实施例中,第一设备100可以包括1个或N个显示屏194,N为大于1的正整数。
第一设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。镜头的焦段可以用于表示摄像头的取景范围,镜头的焦段越小,表示镜头的取景范围越大。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。
在本申请中,第一设备100可以包括2个或2个以上焦段的摄像头193。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当第一设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。第一设备100可以支持一种或多种视频编解码器。这样,第一设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现第一设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
在本申请实施例中,NPU或其他处理器可以用于对第一设备100存储的视频中的图像进行分析处理等操作。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展第一 设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
内部存储器121可以用于存储计算机可执行程序代码,可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行第一设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)。存储数据区可存储第一设备100使用过程中所创建的数据(比如音频数据,电话本等)。
此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。
第一设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。
音频模块170用于将数字音频信号转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。第一设备100可以通过扬声器170A收听音乐,或收听免提通话,例如扬声器可以播放本申请实施例提供的比对分析结果。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当第一设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。第一设备100可以设置至少一个麦克风170C。在另一些实施例中,第一设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在通过超声波进行测距时,选用的麦克风170C需要能够录制超声波音频信号。
在另一些实施例中,第一设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。
在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。第一设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,第一设备100根据压力传感器180A检测触摸操作强度。第 一设备100也可以根据压力传感器180A的检测信号计算触摸的位置。
在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。
陀螺仪传感器180B可以用于确定第一设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定第一设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测第一设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消第一设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。
气压传感器180C用于测量气压。在一些实施例中,第一设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。
磁传感器180D包括霍尔传感器。第一设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当第一设备100是翻盖机时,第一设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。
加速度传感器180E可检测第一设备100在各个方向上(一般为三轴)加速度的大小。当第一设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。
距离传感器180F,用于测量距离。第一设备100可以通过超声波、红外或激光测量距离。在一些实施例中,拍摄场景,第一设备100可以利用距离传感器180F测距以实现快速对焦。
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。第一设备100通过发光二极管向外发射红外光。第一设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定第一设备100附近有物体。当检测到不充分的反射光时,第一设备100可以确定第一设备100附近没有物体。第一设备100可以利用接近光传感器180G检测用户手持第一设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。
环境光传感器180L用于感知环境光亮度。第一设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测第一设备100是否在口袋里,以防误触。
指纹传感器180H用于采集指纹。第一设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。
温度传感器180J用于检测温度。在一些实施例中,第一设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,第一设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施 热保护。在另一些实施例中,当温度低于另一阈值时,第一设备100对电池142加热,以避免低温导致第一设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,第一设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于第一设备100的表面,与显示屏194所处的位置不同。
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。
在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。第一设备100可以接收按键输入,产生与第一设备100的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和第一设备100的接触和分离。第一设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。第一设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,第一设备100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在第一设备100中,不能和第一设备100分离。
需要说明的是,第二设备200的结构可以与第一设备100类似,也可以基于第一设备100的结构进行精简。但第二设备200还需要包括测距信号发射模块,如超声波发射器、红外发射器、激光发射器等。
图3示出了本申请实施例提供的一种测距方法中第一设备的软件结构示意图。
第一设备中的操作系统可以是安卓(Android)系统,微软窗口系统(Windows), 苹果移动操作系统(iOS)或者鸿蒙系统(Harmony OS)等。在此,以第一设备的操作系统为鸿蒙系统为例进行说明。
在一些实施例中,可将鸿蒙系统分为四层,包括内核层、系统服务层、框架层以及应用层,层与层之间通过软件接口通信。
如图3所示,内核层包括内核抽象层(Kernel Abstract Layer,KAL)和驱动子系统。KAL下包括多个内核,如Linux系统的内核Linux Kernel、轻量级物联网系统内核LiteOS等。驱动子系统则可以包括硬件驱动框架(Hardware Driver Foundation,HDF)。硬件驱动框架能够提供统一外设访问能力和驱动开发、管理框架。多内核的内核层可以根据系统的需求选择相应的内核进行处理。
系统服务层是鸿蒙系统的核心能力集合,系统服务层通过框架层对应用程序提供服务。该层可包括:
系统基本能力子系统集:为分布式应用在鸿蒙系统多设备上的运行、调度、迁移等操作提供了基础能力。可包括分布式软总线、分布式数据管理、分布式任务调度、多语言运行时、公共基础库、多模输入、图形、安全、人工智能(Artificial Intelligence,AI)、用户程序框架等子系统。其中,多语言运行时提供了C或C++或JavaScript(JS)多语言运行时和基础的系统类库,也可以为使用编译器静态化的Java程序(即应用程序或框架层中使用Java语言开发的部分)提供运行时。
基础软件服务子系统集:为鸿蒙系统提供公共的、通用的软件服务。可包括事件通知、电话、多媒体、面向X设计(Design For X,DFX)、MSDP&DV等子系统。
增强软件服务子系统集:为鸿蒙系统提供针对不同设备的、差异化的能力增强型软件服务。可包括智慧屏专有业务、穿戴专有业务、物联网(Internet of Things,IoT)专有业务子系统组成。
硬件服务子系统集:为鸿蒙系统提供硬件服务。可包括位置服务、生物特征识别、穿戴专有硬件服务、IoT专有硬件服务等子系统。
框架层为鸿蒙系统应用开发提供了Java、C、C++、JS等多语言的用户程序框架和能力(Ability)框架,两种用户界面(User Interface,UI)框架(包括适用于Java语言的Java UI框架、适用于JS语言的JS UI框架),以及各种软硬件服务对外开放的多语言框架应用程序接口(Application Programming Interface,API)。根据系统的组件化裁剪程度,鸿蒙系统设备支持的API也会有所不同。
应用层包括系统应用和第三方非系统应用。系统应用可包括桌面、控制栏、设置、电话等电子设备默认安装的应用程序。扩展应用可以是由电子设备的制造商开发设计的、非必要的应用,如电子设备管家、换机迁移、便签、天气等应用程序。而第三方非系统应用则可以是由其他厂商开发,但是可以在鸿蒙系统中运行应用程序,如游戏、导航、社交或购物等应用程序。
鸿蒙系统的应用由一个或多个元程序(Feature Ability,FA)或元服务(Particle Ability,PA)组成。其中,FA有UI界面,提供与用户交互的能力。而PA无UI界面,提供后台运行任务的能力以及统一的数据访问抽象。PA主要为FA提供支持,例如作为后台服务提供计算能力,或作为数据仓库提供数据访问能力。基于FA或PA开发的应用,能够实现特定的业务功能,支持跨设备调度与分发,为用户提供一致、高效的 应用体验。
多个运行鸿蒙系统的电子设备之间可以通过分布式软总线、分布式设备虚拟化、分布式数据管理和分布式任务调度实现硬件互助和资源共享。
需要说明的是,第二设备的操作系统可以与第一设备相同,也可以不同。或者,第一设备和第二设备还可以采用相同操作系统,但是使用不同的内核。例如,当第一设备和第二设备均使用鸿蒙系统时,第一设备可以使用Linux Kernel内核,第二设备则可以使用LiteOS内核。
图4示出了本申请实施例提供的一种测距方法的示意性流程图,作为示例而非限定,该方法可以应用于上述第一设备100和第二设备200中。
S310、第一设备与第二设备同步系统时钟,获取第一偏移时间。
一些实施方式中,第一设备和第二设备可以通过相同的无线通信模块同步系统时钟。例如,第一设备和第二设备可以同时具有蓝牙模块或无线保真(Wireless Fidelity,Wi-Fi)模块等。
第一设备可以通过无线通信模块依次向第二设备发送至少一个同步指令,并且基于第一设备系统时钟记录发送每个同步指令时的第九时刻。
然后,接收来自第二设备的无线通信模块发送的同步反馈标识,并基于第一设备系统时钟记录接收到每个同步反馈标识时的第十时刻。
其中,同步反馈标识包括第二设备的无线通信模块接收到同步指令的第十一时刻以及第二设备的无线通信模块发送同步反馈标识时的第十二时刻,第十一时刻和第十二时刻是基于第二设备系统时钟得到的。根据第九时刻、第十时刻、第十一时刻以及第十二时刻,获取第一偏移时间。
作为示例,假设第九时刻为T 9、第十时刻为T 10、第十一时刻为T 11、第十二时刻为T 12、第一偏移时间为δ 1、第一设备和第二设备之间的双向传输延时相同为T d,则可以得到以下公式:
T 10-T 9=T d1
T 12-T 11=T d1
通过以上公式计算可得:
Figure PCTCN2022140420-appb-000001
需要说明的是,在计算时将第一设备和第二设备之间的双向传输延时设置为了相同。但是实际应用时,不同的指令、报文等处理的时长可能存在差异,传输延时也存在一定的变化。因此,可以通过多次计算第一偏移时间δ 1,并获取多个第一偏移时间δ 1的平均值作为最终的第一偏移时间δ 1,以减少可能存在的误差。
S320、第二设备获取发送测距信号的第一时刻。
一些实施方式中,第一时刻可以是第二设备确认与第一设备完成同步后,将确认完成同步后经过预设时长的时刻作为第一时刻。其中,第二设备确认与第一设备完成同步,可以是接收到来自第一设备的同步完成指令,也可以是发送了预设次数的同步反馈标识。例如,若预设时长为10ms。参考S310,当第二设备向第一设备发送200次同步反馈标识后,即可确认第二设备确认与第一设备完成同步。然后,在发送第200次同步反馈标识的时刻后经过10ms,向第一设备发送测距信号,即第一时刻为发送第 200次同步反馈标识的时刻加10ms。
还有一些实施方式中,第一时刻可以是第二设备出厂时设置好的。例如,第二设备出厂时可以设置每个整分发送一次测距信号,则可以在第二设备的系统时钟开始计时后,每隔一分钟得到一个第一时刻。获取第二设备的出厂设置时,可以先获取第二设备的设备识别信息,然后根据第二设备的设备识别信息从服务器获取第二设备的出厂设置。
另一些实施方式中,第一时刻可以是根据指令设置。例如,第二设备可以接收测距信号发送指令,并获取测距信号发送指令中包括的至少一个第一时刻。测距信号发送指令可以是第一设备通过无线通信模块发送的。或者,也可以是其他与第二设备通信的电子设备发送的,例如,可以是场景中其他第二设备转发的测距信号发送指令。若场景中包括网关设备,网关设备通过无线方式与第二设备通信连接,则测距信号发送指令也可以是网关设备向第二设备发送的。
作为示例,第一设备可以通过蓝牙模块向第二设备的蓝牙模块发送测距信号发送指令,测距信号发送指令中可以包括指示第二设备在5秒后发送一次测距信号,则第一时刻为第二设备接收到测距信号发送指令的时刻加上5秒。
还有一些实施方式中,测距信号发送指令中可以指示发送多次测距信号。例如,可以指示在5秒后发送第一次测距信号,然后每隔5秒发送一次测距信号,发送10次后停止。则第一时刻有多个,相邻两个第一时刻之间相差5秒。
S330、第一设备获取第一时刻。
一些实施方式中,第二设备在确定第一时刻后,会将第一时刻发送给第一设备,第一设备接收到来自第二设备的第一时刻,即获取的到第一时刻。例如,第二设备将第一时刻信息承载在蓝牙或者无线网络(WiFi)信息中发送给第一设备。或者,再例如,参考S320,第二设备还可以在确认与第一设备完成同步后,将完成同步的时间加上10ms,作为第一时刻发送给第一设备,以使得第一设备获取到该第一时刻。
另一些实施方式中,第一设备获取第一时刻,可以先通过无线通信模块向第二设备发送第一时刻查询指令。参考S320,若第二设备的第一时刻是出厂时设置的,则第二设备在接收到第一时刻查询指令后,向第一设备发送第二设备的设备识别信息,第一设备根据接收到的第二设备的设备识别信息查询获取第一时刻。例如,若在第一设备上存储有第二设备出厂设置的数据,则可以根据接收到的第二设备的设备识别信息,在存储的第二设备出厂设置的数据中查找对应的第二设备,并获取对应第二设备的出厂设置,进而获取第一时刻。
作为示例,若第一设备接收到第二设备的设备型号,并根据第二设备的设备型号确定该第二设备每个整分发送一次测距信号。则可以根据第一设备的系统时钟,以及第一偏移时间获取基于第二设备的系统时钟的多个第一时刻。例如,第一偏移时间为0.1秒,第一设备的系统时钟当前时刻为T′ 1。则可以将T′ 1根据第一偏移时间修正为第二设备的系统时钟,然后确定下个整分的时刻为第一时刻。
另一些实施方式中,参考S320,若第二设备的第一时刻是根据指令设置的,则第二设备可以在接收到第一时刻查询指令后,向第一设备发送至少一个第一时刻。第一设备将接收到的多个第一时刻中与当前时间最接近的一个第一时刻用于计算距离。
S340、第一设备开始接收测距信号,获取第四时刻。
S350、第二设备在第一时刻时发送测距信号。
S360、第一设备获取接收到测距信号时的第二时刻。
图5示出了本申请实施例提供的一种测距方法中第一设备的系统结构示意图。
一些实施方式中,参考图5,图5中示出的系统结构可以应用于通过超声波测距的安卓系统或鸿蒙系统。其中包括应用层、硬件虚拟层(安卓系统)\框架层和系统服务层(鸿蒙系统)、内核层以及硬件层。应用层运行有应用程序,应用程序可以接收并响应来自用户的测距指令,指示第一设备开始测距。硬件虚拟层\框架层和系统服务层用将应用层的指令传递至内核层,内核层包括硬件驱动,内核层可以根据应用层的指令,通过硬件驱动控制对应的硬件或获取该硬件的参数。
例如,在本申请中是通过超声波进行测距的。则硬件层包括的测距信号接收芯片可以为HiFi芯片,HiFi芯片中包括一个32位计数器(32K Counter)用于计时,即芯片时钟。内核层可以包括HiFi芯片的驱动程序(HiFi Driver),HiFi芯片可以响应来自上层的指令,开始接收测距信号,并通过32位计数器记录开始接收测距信号时的第四时刻T 4
在本实施例中,通过HiFi芯片接收测距信号,可以通过HiFi芯片开始录音实现。HiFi芯片开始录音的时刻即为HiFi芯片开始接收测距信号的时刻(第四时刻T 4)。
由于T 4是基于芯片时钟获取的,为了获取基于系统时钟的第二时刻T 2,可以将T 4修正为基于系统时间的第三时刻T 3。然后将T 3加上接收间隔时间,即可得到基于系统时钟的第二时刻T 2
一些实施方式中,在开始录音后,第一设备根据在本地预先存储的测距信号序列与接收到的录音信号进行相关计算,得到测距信号序列与接收到的录音信号之间的相关值。然后,确定相关值符合预设条件的录音信号,例如,预设条件可以是录音信号的相关值之中的最大值,或者,预设条件也可以是录音信号的相关值与预设的相关值阈值最接近的。将符合预设条件的录音信号对应的时刻的时长作为接收间隔时间。
需要说明的是,接收间隔时间是开始接收测距信号与接收到测距信号之间的时间间隔。其中,可以在芯片层面获取该接收时间间隔(即以T 4为基准)。也可以在软件层面获取该时间间隔(即以T 3为基准),本申请对此不做限制。
图6示出了本申请实施例提供的测距方法中一种获取T 2的流程示意图。
参考图5和图6,该流程包括:
S410、应用层的应用程序接收并响应测距指令,开始接收测距信号。
一些实施方式中,测距指令可以是来自用户对第一设备的操作。例如,当第一设备中安装有测距应用程序时,当接收到用户作用于展示测距应用程序图标区域的点击操作时,可以启动测距应用程序。
一些示例中,当测距应用程序启动后,即可以确定接收到测距指令。
或者,在另一些示例中,当测距应用程序启动后,可以在第一设备的屏幕上展示至少一个可用的第二设备。展示时可以通过文字或图标的形式展示。当接收到作用于展示其中一个第二设备的区域的点击操作时,可以确定接收到测距指令。
需要说明的是,第一设备还可以通过语音控制、手势等操作方式接收测距指令, 本申请接收测距指令的方式不做限制。
S420、应用程序向硬件层的HiFi芯片发送指令,指示HiFi芯片开始录音。
S430、HiFi芯片开始录音,记录开始录音的第四时刻。
一些实施方式中,HiFi芯片的芯片时钟是基于32位计数器实现的。在HiFi芯片响应指令开始录音时,可以通过读取32位计数器中寄存器的值获取第四时刻。作为示例,该寄存器的地址可以为“cnf_msg->kernel_stamp=DSP_STAMP”。
S440、HiFi芯片将第四时刻发送至HiFi芯片的驱动程序。
一些实施方式中,HiFi芯片可以在获取到第四时刻后,主动将第四时刻发送给HiFi芯片的驱动程序。或者,也可以等待接收HiFi芯片的驱动程序发送得的四时刻查询指令。在接收到第四时刻查询指令后,将第四时刻发送给HiFi芯片的驱动程序。
一些实施方式中,HiFi芯片可以通过邮箱(Mailbox)机制将第四时刻发送给HiFi芯片的驱动程序。Mailbox机制是不同核间数据传输通信的一种方式,可以通过Mailbox寄存器在不同的处理器之间交换数据。
一些实施方式中,测距信号接收芯片的驱动程序在接收到第四时刻时,将第四时刻修正为基于系统时钟的第三时刻。或者,测距信号接收芯片的驱动程序响应来自应用层的参数获取指令,将第四时刻修正为基于系统时钟的第三时刻。
例如,HiFi芯片的驱动程序可以在接收到第四时刻时,立即执行S450-S490,获取到第三时刻。或者,HiFi芯片的驱动程序也可以在接收到第四时刻后,等待响应来自应用层的参数获取指令(如getParameter指令),在响应参数获取指令时再执行S450-S490,获取到第三时刻。
S450、HiFi芯片的驱动程序同时获取基于系统时钟的第五时刻和基于芯片时钟的第六时刻,第四时刻和第六时刻的时间差为第二偏移时间。
一些实施方式中,驱动程序可以通过系统时钟读取指令,获取基于系统时钟的第五时刻,例如,可以通过“do_gettimeofday”指令获取第五时刻。驱动程序在获取基于芯片时钟的第六时刻时,可以参考S430中的示例,通过读取HiFi芯片中32位计数器中寄存器的值获取第六时刻。
一些实施方式中,第二偏移时间为δ 2,表示从开始录音到获取基于系统时钟的第五时刻和基于芯片时钟的第六时刻时的时长。若第四时刻为T 4,第六时刻为T 6,则:
δ 2=T 6-T 4(T 6>T 4)
δ 2=(T 6+2 32)-T 4(T 6<T 4)
其中,当T 6小于T 4时,表示32位计数器可能溢出,故对T 6进行修正后再进行计算,即可得到准确的δ 2
需要说明的是,“同时获取基于系统时钟的第五时刻和基于芯片时钟的第六时刻”指的是在相同的绝对时间分别获取第五时刻和第六时刻。由于设备本身可能存在延时、误差等无法避免的原因,“同时获取”的动作可能无法精准做到在同一绝对时间分别执行。当分别获取第五时刻和第六时刻之间的时间差值小于预设的阈值时,即可认为是“同时获取基于系统时钟的第五时刻和基于芯片时钟的第六时刻”。该预设的阈值可以根据不同第一设备中器件的性能、精度等因素确定。
S460、HiFi芯片的驱动程序根据第五时刻和第二偏移时间得到第三时刻。
一些实施方式中,第三时刻为T 3,第二偏移时间为δ 2,则:
Figure PCTCN2022140420-appb-000002
其中,将第五时刻减去第二偏移时间后,除以32767,即可得到开始录音时系统时钟的时刻(第三时刻)。
S470、应用层的应用程序通过硬件虚拟层\框架层和系统服务层向HiFi芯片的驱动程序发送第三时刻查询指令。
S480、HiFi芯片的驱动程序将第三时刻发送给应用层的应用程序。
一些实施方式中,应用层的应用程序可以给硬件虚拟层\框架层和系统服务层中的音频硬件抽象层(Audiohal)发送查询指令,如“getParameter(‘Nearby_RecordTime’)”。然后,Audiohal响应查询指令,通过输入输出控制(Input/Outputcontrol,IOCtrl)指示核心层的驱动程序将第三时刻传送至应用层的应用程序。
S490、应用层的应用程序将第三时刻加上接收间隔时间得到第二时刻。
一些实施方式中,若第三时刻为T 3,接收间隔时间为ΔT,则第二时刻T 2为:
T 2=T 3+ΔT
在本实施例中,通过HiFi驱动程序同时获取基于系统时钟的第五时刻和基于芯片时钟的第六时刻。然后将基于芯片时钟获取的开始接收测距信号(即开始录音)时的第四时刻修正为基于系统时钟的开始接收测距信号时的第三时刻。实现了将底层的芯片时钟转换为上层的系统时钟,进而支持完成超声波测距的功能,使得测距精度能够更加精确,误差更低。
图7示出了本申请实施例提供的测距方法中另一种获取T 2的流程示意图。
参考图5和图7,该流程包括:
S510、应用层的应用程序接收并响应测距指令,开始接收测距信号。
S520、应用程序向硬件层的HiFi芯片发送指令,指示HiFi芯片开始录音。
S530、HiFi芯片开始录音,记录开始录音的第四时刻。
在本实施例中,S510至S530中的实现方式与S410至S430中一致,在此不做赘述。
S540、应用层的应用程序通过硬件虚拟层\框架层和系统服务层向HiFi芯片发送第三时刻查询指令。
一些实施方式中,应用层的应用程序可以给硬件虚拟层\框架层和系统服务层中的Audiohal发送查询指令,如“getParameter(‘Nearby_RecordTime’)”。然后,Audiohal响应查询指令后,可以通过IOCtrl指示HiFi芯片获取第三时刻并在获取到后将第三时刻发送给应用层的应用程序。
S550、HiFi芯片同时获取基于系统时钟的第五时刻和基于芯片时钟的第六时刻,第四时刻和第六时刻的时间差为第二偏移时间。
一些实施方式中HiFi芯片可以通过系统时钟读取指令,获取基于系统时钟的第五时刻,例如,可以通过“do_gettimeofday”指令获取第五时刻。HiFi芯片在获取基于芯片时钟的第六时刻时,可以参考S430中的示例,通过读取HiFi芯片中32位计数器中寄存器的值获取第六时刻。
一些实施方式中,第二偏移时间为δ 2,表示从开始录音到获取基于系统时钟的第 五时刻和基于芯片时钟的第六时刻时的时长。若第四时刻为T 4,第六时刻为T 6,则:
δ 2=T 6-T 4(T 6>T 4)
δ 2=(T 6+2 32)-T 4(T 6<T 4)
其中,当T 6小于T 4时,表示32位计数器可能溢出,故对T 6进行修正后再进行计算,即可得到准确的δ 2
需要说明的是,“同时获取基于系统时钟的第五时刻和基于芯片时钟的第六时刻”指的是在相同的绝对时间分别获取第五时刻和第六时刻。由于设备本身可能存在延时、误差等无法避免的原因,“同时获取”的动作可能无法精准做到在同一绝对时间分别执行。当分别获取第五时刻和第六时刻之间的时间差值小于预设的阈值时,即可认为是“同时获取基于系统时钟的第五时刻和基于芯片时钟的第六时刻”。该预设的阈值可以根据不同第一设备中器件的性能、精度等因素确定。
S560、HiFi芯片根据第五时刻和第二偏移时间得到第三时刻。
一些实施方式中,第三时刻为T 3,第二偏移时间为δ 2,则:
Figure PCTCN2022140420-appb-000003
其中,将第五时刻减去第二偏移时间后,除以32767,即可得到开始录音时系统时钟的时刻(第三时刻)。
S570、HiFi芯片将第三时刻发送给应用层的应用程序。
一些实施方式中,HiFi芯片可以通过IOCtrl将得到的第三时刻传递至应用层的应用程序。
S580、应用层的应用程序将第三时刻加上接收间隔时间得到第二时刻。
一些实施方式中,若第三时刻为T 3,接收间隔时间为ΔT,则第二时刻T 2为:
T 2=T 3+ΔT
在本实施例中,通过HiFi芯片同时获取基于系统时钟的第五时刻和基于芯片时钟的第六时刻。然后将基于芯片时钟获取的开始接收测距信号(即开始录音)时的第四时刻修正为基于系统时钟的开始接收测距信号时的第三时刻。实现了将底层的芯片时钟转换为上层的系统时钟,进而支持完成超声波测距的功能,使得测距精度能够更加精确,误差更低。
S370、第一设备根据第一偏移时间、第一时刻和第二时刻获取第一设备与第二设备之间的距离。
一些实施方式中,可以先根据第一偏移时间、第一时刻和第二时刻获取测距信号的飞行时间(Time of flight,tof)。
作为示例,可以先根据第一偏移时间δ 1,将第一时刻为T 1修正为基于第一设备系统时钟的第七时刻T 7,即:
T 7=T 11
然后,将第二时刻T 2减去第七时刻T 7,得到测距信号的飞行时间T tof,即:
T tof=T 2-T 7=T 2-T 11
在另一些示例中,根据第一偏移时间δ 1,将第二时刻T 2修正为基于第二设备系统时钟的第八时刻T 8,即:
T 8=T 21
然后,将第八时刻T 8减去第一时刻T 1,得到测距信号的飞行时间T tof,即:
T tof=T 8-T 1=T 21-T 1
最后,根据测距信号在介质中的传播速度V和飞行时间T tof,获取第一设备与第二设备之间的距离D,即:
D=V*T tof
作为示例,本申请中使用的是超声波测距,则传播速度V是声音在空气中的传播速度,例如,在1个标准大气压、15℃的环境下,V=340米/秒。
但是,声音在空气中的传播速度还会受大气压强、空气湿度以及温度的影响。因此,一些实施方式中,第一设备还可以获取当前场景的大气压强P、相对湿度RH以
Figure PCTCN2022140420-appb-000004
其中,V的单位为米/秒,大气压强P的单位为千帕(kPa),T的单位为摄氏度,P w为空气中水蒸气的分压强,单位为千帕(kPa),p为水蒸气在温度为T时的饱和蒸气压,单位为千帕(kPa)。
另一些实施方式中,若不考虑湿度和压强的影响,仅考虑温度的影响,则传播速度V还可以根据以下公式计算:
Figure PCTCN2022140420-appb-000005
其中,V的单位为米/秒,T的单位为摄氏度。
一些实施方式中,第一设备可以从当前场景中设置的传感器获取大气压强P、相对湿度RH以及温度T。若当前场景中未设置相应的传感器,则可以获取当前场景的定位信息,根据定位信息从服务器获取当前位置的大气压强P、相对湿度RH以及温度T。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后。例如,在图4中,S340显示为在S310之后进行,但是S340也可以在S310之前进行。各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
对应于上文实施例提供的应用于第一设备的测距方法,图8示出了本申请实施例提供的一种应用于第一设备的测距装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。
参照图8,应用于第一设备的测距装置,包括:
获取模块61,用于获取第一偏移时间和第一时刻,第一偏移时间为第一设备系统时钟与第二设备系统时钟的时间差,第一时刻是第二设备发送测距信号的时刻,第一时刻是基于第二设备的系统时钟得到的。
获取模块61,还用于获取接收到测距信号时的第二时刻,第二时刻是根据第一设备开始接收测距信号时的第三时刻和接收间隔时间得到的,第三时刻是根据测距信号接收芯片开始接收测距信号时的第四时刻、第一设备的系统时钟以及测距信号接收芯片的芯片时钟转换得到的,接收间隔时间是开始接收测距信号与接收到测距信号之间的时间间隔。
计算模块62,用于根据第一偏移时间、第一时刻和第二时刻获取第一设备与第二设备之间的距离。
一些实施方式中,获取模块61,具体用于测距信号接收芯片获取第四时刻并将第四时刻发送给测距信号接收芯片的驱动程序。测距信号接收芯片的驱动程序将第四时刻修正为基于系统时钟的第三时刻。测距信号接收芯片的驱动程序将第三时刻发送至应用层,在应用层将第三时刻加上接收间隔时间,得到第二时刻。
一些实施方式中,获取模块61,具体用于测距信号接收芯片的驱动程序在接收到第四时刻时,将第四时刻修正为基于系统时钟的第三时刻。或,测距信号接收芯片的驱动程序响应来自应用层的参数获取指令,将第四时刻修正为基于系统时钟的第三时刻。
一些实施方式中,获取模块61,具体用于测距信号接收芯片获取第四时刻。测距信号接收芯片的驱动程序响应参数获取指令,从测距信号接收芯片获取第四时刻,并将第四时刻修正为基于系统时钟的第三时刻。测距信号接收芯片的驱动程序将第三时刻发送至应用层,在应用层将第三时刻加上间隔时间,得到第二时刻。
一些实施方式中,获取模块61,具体用于通过测距信号接收芯片的驱动程序,同时获取基于系统时钟的第五时刻和基于芯片时钟的第六时刻,第四时刻和第六时刻的时间差为第二偏移时间。根据第五时刻和第二偏移时间得到第三时刻。
一些实施方式中,计算模块62,具体用于根据第一偏移时间、第一时刻和第二时刻获取测距信号的飞行时间。根据测距信号在介质中的传播速度和飞行时间,获取第一设备与第二设备之间的距离。
一些实施方式中,计算模块62,具体用于根据第一偏移时间,将第一时刻修正为基于第一设备系统时钟的第七时刻;将第二时刻减去第七时刻,得到测距信号的飞行时间。或,根据第一偏移时间,将第二时刻修正为基于第二设备系统时钟的第八时刻;将第八时刻减去第一时刻,得到测距信号的飞行时间。
一些实施方式中,获取模块61,具体用于依次向第二设备发送至少一个同步指令,基于第一设备系统时钟记录发送每个同步指令时的第九时刻。接收来自第二设备的同步反馈标识,基于第一设备系统时钟记录接收到每个同步反馈标识时的第十时刻,同步反馈标识包括第二设备接收到同步指令的第十一时刻以及第二设备发送同步反馈标识时的第十二时刻,第十一时刻和第十二时刻是基于第二设备系统时钟得到的。根据第九时刻、第十时刻、第十一时刻以及第十二时刻,获取第一偏移时间。
一些实施方式中,获取模块61,具体用于向第二设备发送第一时刻查询指令。接收第二设备发送的至少一个第一时刻。
一些实施方式中,获取模块61,具体用于向第二设备发送第一时刻查询指令。接收第二设备发送的设备识别信息。根据设备识别信息,获取预先设置的至少一个第一时刻。
对应于上文实施例提供的应用于第二设备的测距方法,图9示出了本申请实施例提供的一种应用于第二设备的测距装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。
参照图9,应用于第二设备的测距装置,包括:
获取模块71,用于获取发送测距信号的第一时刻。
发送模块72,用于向第一设备发送第一时刻。
发送模块72,还用于基于第二设备的系统时钟,在第一时刻时发送测距信号。
一些实施方式中,该装置还包括接收模块73,用于接收来自第一设备的至少一个同步指令,基于第二设备系统时钟记录接收到每个同步指令时的第十一时刻。响应每个同步指令,向第一设备发送同步反馈标识,同步反馈标识包括第十一时刻和发送同步反馈标识时的第十二时刻,第十二时刻是基于第二设备系统时钟记录得到的。
一些实施方式中,获取模块71,具体用于确认与第一设备完成同步。将确认完成同步后经过预设时长的时刻作为第一时刻。
一些实施方式中,获取模块71,具体用于接收测距信号发送指令,获取测距信号发送指令中包括的至少一个第一时刻。或,根据第二设备的设备识别信息,获取预先设置的至少一个第一时刻。
一些实施方式中,发送模块72,还用于在获取到第一时刻后,将第一时刻发送给第一设备。或,该装置还包括响应模块74,用于响应来自第一设备的第一时刻查询指令,向第一设备发送至少一个第一时刻。
一些实施方式中,响应模块74,还用于响应来自第一设备的第一时刻查询指令,向第一设备发送第二设备的设备识别信息。
需要说明的是,上述模块之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
图10为本申请实施例提供的一种第一设备的结构框图。如图10所示,该实施例的第一设备8包括:
至少一个处理器801(图10中仅示出一个)处理器、存储器802、测距信号接收组件804以及存储在存储器802中并可在至少一个处理器801上运行的计算机程序803,处理器801执行计算机程序803时通过测距信号接收组件804实现上述控制方法实施例中的步骤。
第一设备8可以是手机、平板电脑、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、大屏设备、笔记本电脑、上网本、个人数字助理(personal digital assistant,PDA)等。本领域技术人员可以理解,图10仅仅是第一设备8的举例,并不构成对第一设备8的限定,可以包括比图示更多或更少的部件,或者组合某些部件, 或者不同的部件,例如还可以包括输入输出设备、网络接入设备等。
所称处理器801可以是中央处理单元(Central Processing Unit,CPU),该处理器801还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、SOC、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
存储器802在一些实施例中可以是第一设备8的内部存储单元,例如第一设备8的硬盘或内存。存储器802在另一些实施例中也可以是第一设备8的外部存储设备,例如第一设备8上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。
进一步地,存储器802还可以既包括第一设备8的内部存储单元也包括外部存储设备。存储器802用于存储操作系统、应用程序、引导装载程序(BootLoader)、数据以及其他程序等,例如计算机程序的程序代码等。存储器802还可以用于暂时地存储已经输出或者将要输出的数据。
图11为本申请实施例提供的一种第二设备的结构框图。如图11所示,该实施例的第二设备9包括:
至少一个处理器901(图11中仅示出一个)、存储器902、测距信号发射组件904以及存储在存储器902中并可在至少一个处理器901上运行的计算机程序903,处理器901执行计算机程序903时通过测距信号发射组件904实现上述控制方法实施例中的步骤。
第二设备9可以是包括测距信号发射功能的终端设备、具有测距信号发射功能的第一设备等。如,包括测距信号发射功能的终端设备可以是电子标签、包括电子标签的智能钥匙扣、蓝牙耳机等。本领域技术人员可以理解,图11仅仅是第二设备9的举例,并不构成对第二设备9的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如还可以包括输入输出设备、网络接入设备等。
所称处理器901可以是中央处理单元(Central Processing Unit,CPU),该处理器901还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、SOC、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
存储器902在一些实施例中可以是第二设备9的内部存储单元,例如第二设备9的硬盘或内存。存储器902在另一些实施例中也可以是第二设备9的外部存储设备,例如第二设备9上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。
进一步地,存储器902还可以既包括第二设备9的内部存储单元也包括外部存储设备。存储器902用于存储操作系统、应用程序、引导装载程序(BootLoader)、数据以及其他程序等,例如计算机程序的程序代码等。存储器902还可以用于暂时地存储已 经输出或者将要输出的数据。
本申请实施例提供了一种计算机可读存储介质,计算机可读存储介质存储有计算机程序。计算机程序被处理器执行时实现应用于第一设备的方法。
本申请实施例提供了一种计算机可读存储介质,计算机可读存储介质存储有计算机程序,计算机程序被处理器执行时实现应用于第二设备的方法。
本申请实施例提供了一种计算机程序产品,当计算机程序产品在第一设备上运行时,使得终端设备执行上述应用于第一设备的方法。
本申请实施例提供了一种计算机程序产品,当计算机程序产品在第二设备上运行时,使得终端设备执行上述应用于第二设备的方法。
本申请实施例提供了一种芯片系统,芯片系统包括存储器和处理器,处理器执行存储器中存储的计算机程序,以实现应用于第一设备的方法。
本申请实施例提供了一种芯片系统,芯片系统包括存储器和处理器,处理器执行存储器中存储的计算机程序,以实现应用于第二设备的方法。
本申请实施例提供了一种芯片系统,芯片系统包括处理器,处理器与第八方面提供的计算机可读存储介质耦合,处理器执行计算机可读存储介质中存储的计算机程序,以实现应用于第一设备的方法。
本申请实施例提供了一种芯片系统,芯片系统包括处理器,处理器与第九方面提供的计算机可读存储介质耦合,处理器执行计算机可读存储介质中存储的计算机程序,以实现应用于第二设备的方法。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质至少可以包括:能够将计算机程序代码携带到第一设备或第二设备的任何实体或装置、记录介质、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读介质不可以是电载波信号和电信信号。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的实施例中,应该理解到,所揭露的方法、装置、系统、第一设备或第二设备,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示 意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
最后应说明的是:以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (23)

  1. 一种测距方法,其特征在于,应用于第一设备,包括:
    获取第一偏移时间和第一时刻,所述第一偏移时间为所述第一设备系统时钟与第二设备系统时钟的时间差,所述第一时刻是所述第二设备发送测距信号的时刻,所述第一时刻是基于所述第二设备的系统时钟得到的;
    获取接收到所述测距信号时的第二时刻,所述第二时刻是根据所述第一设备开始接收所述测距信号时的第三时刻和接收间隔时间得到的,所述第三时刻是根据测距信号接收芯片开始接收所述测距信号时的第四时刻、所述第一设备的系统时钟以及所述测距信号接收芯片的芯片时钟转换得到的,所述接收间隔时间是开始接收所述测距信号与接收到所述测距信号之间的时间间隔;
    根据所述第一偏移时间、所述第一时刻和所述第二时刻获取所述第一设备与所述第二设备之间的距离。
  2. 根据权利要求1所述的方法,其特征在于,所述获取接收到所述测距信号时的第二时刻,包括:
    所述测距信号接收芯片获取所述第四时刻并将所述第四时刻发送给所述测距信号接收芯片的驱动程序;
    所述测距信号接收芯片的驱动程序将所述第四时刻修正为基于所述系统时钟的第三时刻;
    所述测距信号接收芯片的驱动程序将所述第三时刻发送至应用层,在所述应用层将所述第三时刻加上所述接收间隔时间,得到所述第二时刻。
  3. 根据权利要求2所述的方法,其特征在于,所述测距信号接收芯片的驱动程序将所述第四时刻修正为基于所述系统时钟的第三时刻,包括:
    所述测距信号接收芯片的驱动程序在接收到所述第四时刻时,将所述第四时刻修正为基于所述系统时钟的第三时刻;或,
    所述测距信号接收芯片的驱动程序响应来自应用层的参数获取指令,将所述第四时刻修正为基于所述系统时钟的第三时刻。
  4. 根据权利要求1所述的方法,其特征在于,所述获取接收到所述测距信号时的第二时刻,包括:
    所述测距信号接收芯片获取所述第四时刻;
    所述测距信号接收芯片的驱动程序响应参数获取指令,从所述测距信号接收芯片获取所述第四时刻,并将所述第四时刻修正为基于所述系统时钟的第三时刻;
    所述测距信号接收芯片的驱动程序将所述第三时刻发送至应用层,在所述应用层将所述第三时刻加上所述接收间隔时间,得到所述第二时刻。
  5. 根据权利要求2-4任一项所述的方法,其特征在于,所述将所述第四时刻修正为基于所述系统时钟的第三时刻,包括:
    通过所述测距信号接收芯片的驱动程序,同时获取基于系统时钟的第五时刻和基于所述芯片时钟的第六时刻,所述第四时刻和所述第六时刻的时间差为第二偏移时间;
    根据所述第五时刻和所述第二偏移时间得到所述第三时刻。
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述根据所述第一偏移时 间、所述第一时刻和所述第二时刻获取所述第一设备与所述第二设备之间的距离,包括:
    根据所述第一偏移时间、所述第一时刻和所述第二时刻获取所述测距信号的飞行时间;
    根据所述测距信号在介质中的传播速度和所述飞行时间,获取所述第一设备与所述第二设备之间的距离。
  7. 根据权利要求6所述的方法,其特征在于,所述根据所述第一偏移时间、所述第一时刻和所述第二时刻获取所述测距信号的飞行时间,包括:
    根据所述第一偏移时间,将所述第一时刻修正为基于所述第一设备系统时钟的第七时刻;
    将第二时刻减去所述第七时刻,得到所述测距信号的飞行时间;或,
    根据所述第一偏移时间,将所述第二时刻修正为基于所述第二设备系统时钟的第八时刻;
    将第八时刻减去所述第一时刻,得到所述测距信号的飞行时间。
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述获取第一偏移时间,包括:
    所述第一设备依次向所述第二设备发送至少一个同步指令,基于所述第一设备系统时钟记录发送每个所述同步指令时的第九时刻;
    接收来自所述第二设备的同步反馈标识,基于所述第一设备系统时钟记录接收到每个所述同步反馈标识时的第十时刻,所述同步反馈标识包括所述第二设备接收到所述同步指令的第十一时刻以及所述第二设备发送所述同步反馈标识时的第十二时刻,所述第十一时刻和所述第十二时刻是基于所述第二设备系统时钟得到的;
    根据所述第九时刻、所述第十时刻、所述第十一时刻以及所述第十二时刻,获取所述第一偏移时间。
  9. 根据权利要求1-8任一项所述的方法,其特征在于,所述获取第一时刻,包括:
    向所述第二设备发送第一时刻查询指令;
    接收所述第二设备发送的至少一个所述第一时刻。
  10. 根据权利要求1-9任一项所述的方法,其特征在于,所述获取第一时刻,包括:
    向所述第二设备发送第一时刻查询指令;
    接收所述第二设备发送的设备识别信息;
    根据所述设备识别信息,获取预先设置的至少一个所述第一时刻。
  11. 一种测距方法,其特征在于,应用于第二设备,包括:
    获取发送测距信号的第一时刻;
    向第一设备发送所述第一时刻;
    基于所述第二设备的系统时钟,在所述第一时刻时向所述第一设备发送所述测距信号。
  12. 根据权利要求11所述的方法,其特征在于,在基于所述第二设备的系统时钟,在所述第一时刻时发送所述测距信号之前,所述方法还包括:
    接收来自第一设备的至少一个同步指令,基于所述第二设备系统时钟记录接收到每个所述同步指令时的第十一时刻;
    响应每个所述同步指令,向所述第一设备发送同步反馈标识,所述同步反馈标识包括所述第十一时刻和发送所述同步反馈标识时的第十二时刻,所述第十二时刻是基于所述第二设备系统时钟记录得到的。
  13. 根据权利要求12所述的方法,其特征在于,获取发送测距信号的第一时刻,包括:
    确认与所述第一设备完成同步;
    将确认完成同步后经过预设时长的时刻作为所述第一时刻。
  14. 根据权利要求11-13任一项所述的方法,其特征在于,所述获取发送测距信号的第一时刻,包括:
    接收测距信号发送指令,获取所述测距信号发送指令中包括的至少一个所述第一时刻;或,
    根据所述第二设备的设备识别信息,获取预先设置的至少一个所述第一时刻。
  15. 根据权利要求13或14所述的方法,其特征在于,所述向第一设备发送所述第一时刻,包括:
    在获取到所述第一时刻后,将所述第一时刻发送给所述第一设备;或,
    响应来自第一设备的第一时刻查询指令,向所述第一设备发送至少一个所述第一时刻。
  16. 根据权利要求14或15所述的方法,其特征在于,所述向第一设备发送所述第一时刻,还包括:
    响应来自所述第一设备的第一时刻查询指令,向所述第一设备发送所述第二设备的设备识别信息。
  17. 一种测距系统,包括第一设备和第二设备,其特征在于,包括:
    所述第一设备获取第一偏移时间和第一时刻,所述第一偏移时间为所述第一设备系统时钟与第二设备系统时钟的时间差,所述第一时刻是所述第二设备发送测距信号的时刻,所述第一时刻是基于所述第二设备的系统时钟得到的;
    所述第二设备基于所述第二设备的系统时钟,在所述第一时刻时发送所述测距信号;
    所述第一设备获取接收到所述测距信号时的第二时刻,所述第二时刻是根据所述第一设备开始接收所述测距信号时的第三时刻和接收间隔时间得到的,所述第三时刻是根据测距信号接收芯片开始接收所述测距信号时的第四时刻、所述第一设备的系统时钟以及所述测距信号接收芯片的芯片时钟转换得到的,所述接收间隔时间是开始接收所述测距信号与接收到所述测距信号之间的时间间隔;
    所述第一设备根据所述第一偏移时间、所述第一时刻和所述第二时刻获取所述第一设备与所述第二设备之间的距离。
  18. 一种测距装置,其特征在于,应用于第一设备,包括:
    获取模块,用于获取第一偏移时间和第一时刻,所述第一偏移时间为所述第一设备系统时钟与第二设备系统时钟的时间差,所述第一时刻是所述第二设备发送测距信 号的时刻,所述第一时刻是基于所述第二设备的系统时钟得到的;
    所述获取模块,还用于获取接收到所述测距信号时的第二时刻,所述第二时刻是根据所述第一设备开始接收所述测距信号时的第三时刻和接收间隔时间得到的,所述第三时刻是根据测距信号接收芯片开始接收所述测距信号时的第四时刻、所述第一设备的系统时钟以及所述测距信号接收芯片的芯片时钟转换得到的,所述接收间隔时间是所述第四时刻与所述测距信号接收芯片接收到所述测距信号时的间隔时间;
    计算模块,用于根据所述第一偏移时间、所述第一时刻和所述第二时刻获取所述第一设备与所述第二设备之间的距离。
  19. 一种测距装置,其特征在于,应用于第二设备,包括:
    获取模块,用于获取发送测距信号的第一时刻;
    发送模块,用于向第一设备发送第一时刻;
    所述发送模块,还用于基于所述第二设备的系统时钟,在所述第一时刻时向所述第一设备发送所述测距信号。
  20. 一种电子设备,包括存储器、处理器、测距信号接收组件以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至10任一项所述的方法。
  21. 一种电子设备,包括存储器、处理器、测距信号发射组件以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求11至16任一项所述的方法。
  22. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至10任一项所述的方法。
  23. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求11至16任一项所述的方法。
PCT/CN2022/140420 2022-02-28 2022-12-20 测距方法、装置、系统及可读存储介质 WO2023160177A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2023/077349 WO2023160524A1 (zh) 2022-02-28 2023-02-21 测距方法、装置、系统及可读存储介质

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210196160.2A CN116699513A (zh) 2022-02-28 2022-02-28 测距方法、装置、系统及可读存储介质
CN202210196160.2 2022-02-28

Publications (1)

Publication Number Publication Date
WO2023160177A1 true WO2023160177A1 (zh) 2023-08-31

Family

ID=87764636

Family Applications (2)

Application Number Title Priority Date Filing Date
PCT/CN2022/140420 WO2023160177A1 (zh) 2022-02-28 2022-12-20 测距方法、装置、系统及可读存储介质
PCT/CN2023/077349 WO2023160524A1 (zh) 2022-02-28 2023-02-21 测距方法、装置、系统及可读存储介质

Family Applications After (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/077349 WO2023160524A1 (zh) 2022-02-28 2023-02-21 测距方法、装置、系统及可读存储介质

Country Status (2)

Country Link
CN (1) CN116699513A (zh)
WO (2) WO2023160177A1 (zh)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1954556A (zh) * 2004-06-09 2007-04-25 国际商业机器公司 距离测定系统、距离测定方法、信息处理装置、以及程序和记录媒体
EP2244098A1 (en) * 2009-04-20 2010-10-27 Universität Duisburg-Essen A master transceiver apparatus and a slave transceiver apparatus for determining a range information
CN104467928A (zh) * 2013-09-18 2015-03-25 华为技术有限公司 一种终端设备之间协作的方法和设备
CN110971326A (zh) * 2018-09-28 2020-04-07 华为技术有限公司 一种时间同步的方法和装置
CN111060868A (zh) * 2020-03-16 2020-04-24 南京万自联电子科技有限公司 一种宽带无线通信与测距系统及其方法
CN112291703A (zh) * 2019-07-09 2021-01-29 三星电子株式会社 建立用于交换测距信息的通信的系统和方法
CN112673339A (zh) * 2018-09-28 2021-04-16 苹果公司 移动设备之间的测距

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009198374A (ja) * 2008-02-22 2009-09-03 Sumitomo Electric Ind Ltd 位置情報生成システム、位置情報生成装置、コンピュータプログラム及び位置情報生成方法
CN112291710A (zh) * 2020-09-21 2021-01-29 宇龙计算机通信科技(深圳)有限公司 测距方法、装置、存储介质及电子设备
CN113988842A (zh) * 2021-11-10 2022-01-28 上海商米科技集团股份有限公司 一种基于收银机的服务方法、系统、终端设备和存储介质
CN113993077A (zh) * 2021-12-23 2022-01-28 荣耀终端有限公司 基于超宽带uwb通信的提示方法、装置、设备及系统

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1954556A (zh) * 2004-06-09 2007-04-25 国际商业机器公司 距离测定系统、距离测定方法、信息处理装置、以及程序和记录媒体
EP2244098A1 (en) * 2009-04-20 2010-10-27 Universität Duisburg-Essen A master transceiver apparatus and a slave transceiver apparatus for determining a range information
CN104467928A (zh) * 2013-09-18 2015-03-25 华为技术有限公司 一种终端设备之间协作的方法和设备
CN110971326A (zh) * 2018-09-28 2020-04-07 华为技术有限公司 一种时间同步的方法和装置
CN112673339A (zh) * 2018-09-28 2021-04-16 苹果公司 移动设备之间的测距
CN112291703A (zh) * 2019-07-09 2021-01-29 三星电子株式会社 建立用于交换测距信息的通信的系统和方法
CN111060868A (zh) * 2020-03-16 2020-04-24 南京万自联电子科技有限公司 一种宽带无线通信与测距系统及其方法

Also Published As

Publication number Publication date
CN116699513A (zh) 2023-09-05
WO2023160524A1 (zh) 2023-08-31

Similar Documents

Publication Publication Date Title
WO2020168965A1 (zh) 一种具有折叠屏的电子设备的控制方法及电子设备
WO2021000807A1 (zh) 一种应用程序中等待场景的处理方法和装置
WO2021023032A1 (zh) 设备解锁方法、系统和相关设备
CN111369988A (zh) 一种语音唤醒方法及电子设备
WO2021115007A1 (zh) 一种网络切换方法及电子设备
WO2021063311A1 (zh) 具有折叠屏的电子设备的显示控制方法及电子设备
WO2021185141A1 (zh) Wi-Fi Aware的建链方法、系统、电子设备和存储介质
CN113923230B (zh) 数据同步方法、电子设备和计算机可读存储介质
WO2021047567A1 (zh) 一种回调流的处理方法及设备
WO2021036898A1 (zh) 折叠屏设备中应用打开方法及相关装置
WO2022033320A1 (zh) 蓝牙通信方法、终端设备及计算机可读存储介质
WO2021052139A1 (zh) 手势输入方法及电子设备
WO2021023046A1 (zh) 一种电子设备控制方法及一种电子设备
WO2021253975A1 (zh) 应用程序的权限管理方法、装置和电子设备
WO2021213031A1 (zh) 图像合成方法及相关装置
EP4231147A1 (en) Drawing command processing method and related device therefor
CN110687998A (zh) 一种应用管理方法及装置
CN114189846B (zh) 避免漏接电话的方法、系统、电子设备及存储介质
WO2022017474A1 (zh) 任务处理方法及相关装置
WO2021175266A1 (zh) 身份验证方法、装置和电子设备
WO2022042637A1 (zh) 一种蓝牙数据传输方法及相关装置
WO2021218429A1 (zh) 应用窗口的管理方法、终端设备及计算机可读存储介质
WO2021197071A1 (zh) 无线通信系统及方法
CN115022982B (zh) 多屏协同无感接入方法、电子设备及存储介质
US20240098354A1 (en) Connection establishment method and electronic device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22928426

Country of ref document: EP

Kind code of ref document: A1