Methods, devices and equipment for determining positional relationships

By acquiring the initial threshold value and detection value of the distance sensor and dynamically calibrating the factory threshold value, the problem of inaccurate positional relationship judgment by the distance sensor during use is solved, achieving higher accuracy.

CN116465342BActive Publication Date: 2026-03-13SPREADTRUM COMMUNICATION (SHANGHAI) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-20
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

During use, the distance sensor may become inaccurate in determining the positional relationship based on the factory threshold value due to reasons such as equipment drops or dirt on the distance sensing baffle.

Method used

By acquiring the initial threshold value and detection value of the distance sensor, the factory threshold value is dynamically calibrated, the target threshold value is determined, and then the target position relationship is judged.

Benefits of technology

This improves the accuracy of the distance sensor in determining the positional relationship of the target.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116465342B_ABST
    Figure CN116465342B_ABST
Patent Text Reader

Abstract

This application provides a method, apparatus, and device for determining positional relationships, which can be applied to a terminal device. The terminal device is equipped with a distance sensor. The method includes: acquiring an initial threshold value of the distance sensor, the initial threshold value being determined at least based on the average noise floor value of the distance sensor; acquiring a detection value of the distance sensor detecting a first object; determining a target threshold value based on the initial threshold value and the detection value; and determining the target positional relationship between the first object and the distance sensor based on the target threshold value and the detection value, wherein the target positional relationship is either close or far away, thereby improving the accuracy of the distance sensor in determining the target positional relationship.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus and device for determining positional relationships. Background Technology

[0002] Terminal devices are typically equipped with proximity sensors, which determine the positional relationship of an object relative to the device. For example, when a user makes or receives a phone call, they usually bring the phone close to their ear after the call is connected. At this time, the proximity sensor in the phone determines that the positional relationship between the ear and the phone is close, and the phone will automatically turn off the screen. This not only prevents accidental screen operation but also reduces power consumption.

[0003] In related technologies, a factory threshold value is usually set for the distance sensor when it leaves the factory. During subsequent use, the positional relationship of the object relative to the terminal device can be determined by the factory threshold value.

[0004] However, during the use of the distance sensor, due to reasons such as equipment drops or dirt on the distance sensor baffle, the positional relationship determined by the distance sensor based on the factory threshold value may become inaccurate. Summary of the Invention

[0005] This application provides a method, apparatus, and device for determining positional relationships, which improves the accuracy of distance sensors in determining the positional relationships of targets.

[0006] In a first aspect, embodiments of this application provide a method for determining positional relationships, applied to a terminal device, wherein the terminal device is equipped with a distance sensor, including:

[0007] An initial threshold value for the distance sensor is obtained, wherein the initial threshold value is determined at least based on the average noise floor value of the distance sensor;

[0008] Obtain the detection value of the first object by the distance sensor;

[0009] The target threshold value is determined based on the initial threshold value and the detected value;

[0010] Based on the target threshold and the detection value, the target position relationship between the first object and the distance sensor is determined, wherein the target position relationship is either close or far.

[0011] In one possible implementation, obtaining the initial threshold value of the distance sensor includes:

[0012] Obtain the average noise floor value, current calibration status, and factory threshold value of the distance sensor;

[0013] Based on the current calibration status and the average noise floor value, determine whether to perform dynamic calibration on the factory threshold value;

[0014] If so, then obtain the preset foreign object occlusion threshold, and determine the initial threshold value based on the average noise floor value and the preset foreign object occlusion threshold;

[0015] If not, then the factory threshold value will be determined as the initial threshold value.

[0016] In one possible implementation, determining whether to dynamically calibrate the factory threshold value based on the current calibration state and the average noise floor value includes:

[0017] If the current calibration state is automatic calibration state, when the sum of the average noise floor value and the preset error value is greater than the factory threshold value, or when the average noise floor value is less than the mold noise floor value, then it is determined to perform dynamic calibration on the factory threshold value.

[0018] If the current calibration state includes manual calibration, when the sum of the average noise floor value and the preset error value is greater than the factory far-from-threshold value, or when the sum of the average noise floor value, the preset proximity increment value and the preset error value is less than the factory proximity threshold value, and the average noise floor value is greater than the preset minimum noise floor value, then it is determined to perform dynamic calibration on the factory threshold value.

[0019] If the current calibration status is no calibration status, then it is determined that the factory threshold value should be dynamically calibrated.

[0020] In one possible implementation, determining the initial threshold value based on the average noise floor value and the preset foreign object occlusion threshold includes:

[0021] If the average noise floor value is less than the preset foreign object occlusion threshold, then the preset maximum noise floor value is obtained, and the initial threshold value is determined based on the preset maximum noise floor value and the average noise floor value.

[0022] If the average noise floor value is greater than or equal to the preset foreign object occlusion threshold, then the current threshold value is determined as the initial threshold value.

[0023] In one possible implementation, determining the initial threshold value based on the preset maximum noise floor value and the average noise floor value includes:

[0024] If the average noise floor value is less than the preset maximum noise floor value, then a preset approach increment value and a preset distance increment value are obtained, and the initial threshold value is determined based on the average noise floor value, the preset approach increment value, and the preset distance increment value.

[0025] If the average noise floor value is greater than or equal to the preset maximum noise floor value, then the preset threshold value is determined as the initial threshold value.

[0026] In one possible implementation, determining the initial threshold value based on the average noise floor value, the preset proximity increment value, and the preset distance increment value includes:

[0027] The sum of the average noise floor value and the preset proximity increment value is determined as the initial proximity threshold value;

[0028] The sum of the average noise floor value and the preset distance increment value is determined as the initial distance threshold value, wherein the initial threshold value includes the initial proximity threshold value and the initial distance threshold value.

[0029] In one possible implementation, determining the target threshold value based on the initial threshold value and the detected value includes:

[0030] Based on the initial threshold value and the detected value, a first positional relationship between the first object and the distance sensor is determined;

[0031] When the first positional relationship is the proximity relationship, the foreign object occlusion state of the distance sensor is determined, and the target threshold value is determined according to the foreign object occlusion state and the detection value, wherein the foreign object occlusion state is a foreign object occlusion state or a foreign object occlusion state.

[0032] When the first positional relationship is the distance relationship, the target threshold value is determined based on the detection value.

[0033] In one possible implementation, determining the target threshold value based on the foreign object occlusion state and the detection value includes:

[0034] When the foreign object obstruction state is the non-foreign object obstruction state, the current threshold value of the distance sensor is obtained, and the current threshold value is determined as the target threshold value;

[0035] When the foreign object obstruction state is a foreign object obstruction state, the current total foreign object obstruction count and foreign object obstruction count threshold of the distance sensor are obtained, and the target threshold value is determined based on the current total foreign object obstruction count, the foreign object obstruction count threshold, the detection value, the preset approach increment value, and the preset distance increment value.

[0036] In one possible implementation, the target threshold value is determined based on the current total foreign object obstruction count, the foreign object obstruction count threshold, the detected value, the preset proximity increment value, and the preset distance increment value, including:

[0037] If the current total number of foreign object obstructions is greater than the foreign object obstruction count threshold, then the dynamic noise floor value is updated according to the detection value, and the target threshold value is determined according to the detection value, the preset approach increment value, and the preset distance increment value.

[0038] If the current total number of foreign object obstruction counts is less than or equal to the foreign object obstruction count threshold, the current threshold value of the distance sensor is obtained, and the current threshold value is determined as the target threshold value.

[0039] In one possible implementation, determining the target threshold value based on the detected value includes:

[0040] Obtain a preset error count update condition for the distance sensor. The preset error count update condition is that the detected value is greater than a preset minimum noise floor value, and the sum of the detected value and a preset near-increment value is less than the current dynamic noise floor value.

[0041] The total error count of the distance sensor is updated based on the detected value and the preset error count update condition.

[0042] If the updated total error count is greater than the error count threshold and the detected value is less than the preset maximum noise floor value, then the dynamic noise floor value is updated according to the detected value, and the target threshold value is determined according to the detected value, the preset approach increment value, and the preset distance increment value.

[0043] If the updated total error count is less than or equal to the error count threshold, or if the detected value is greater than or equal to the preset maximum noise floor value, then the current threshold value of the distance sensor is obtained, and the current threshold value is determined as the target threshold value.

[0044] Secondly, embodiments of this application provide a positional relationship determination device, including an acquisition module and a determination module, wherein:

[0045] The acquisition module is used to acquire an initial threshold value of the distance sensor, the initial threshold value being determined at least based on the average noise floor value of the distance sensor;

[0046] The acquisition module is further configured to acquire the detection value of the distance sensor detecting the first object;

[0047] The determining module is used to determine the target threshold value based on the initial threshold value and the detected value;

[0048] The determining module is further configured to determine the target position relationship between the first object and the distance sensor based on the target threshold value and the detection value, wherein the target position relationship is either close or far.

[0049] In one possible implementation, the acquisition module is specifically used for:

[0050] Obtain the average noise floor value, current calibration status, and factory threshold value of the distance sensor;

[0051] Based on the current calibration status and the average noise floor value, determine whether to perform dynamic calibration on the factory threshold value;

[0052] If so, then obtain the preset foreign object occlusion threshold, and determine the initial threshold value based on the average noise floor value and the preset foreign object occlusion threshold;

[0053] If not, the factory threshold value shall be determined as the initial threshold value.

[0054] In one possible implementation, the acquisition module is further specifically used for:

[0055] If the current calibration state is automatic calibration state, when the sum of the average noise floor value and the preset error value is greater than the factory threshold value, or when the average noise floor value is less than the mold noise floor value, then it is determined to perform dynamic calibration on the factory threshold value.

[0056] If the current calibration state includes manual calibration, when the sum of the average noise floor value and the preset error value is greater than the factory far-from-threshold value, or when the sum of the average noise floor value, the preset proximity increment value and the preset error value is less than the factory proximity threshold value, and the average noise floor value is greater than the preset minimum noise floor value, then it is determined to perform dynamic calibration on the factory threshold value.

[0057] If the current calibration status is no calibration status, then it is determined that the factory threshold value should be dynamically calibrated.

[0058] In one possible implementation, the acquisition module is further specifically used for:

[0059] If the average noise floor value is less than the preset foreign object occlusion threshold, then the preset maximum noise floor value is obtained, and the initial threshold value is determined based on the preset maximum noise floor value and the average noise floor value.

[0060] If the average noise floor value is greater than or equal to the preset foreign object occlusion threshold, then the current threshold value is determined as the initial threshold value.

[0061] In one possible implementation, the acquisition module is further specifically used for:

[0062] If the average noise floor value is less than the preset maximum noise floor value, then a preset approach increment value and a preset distance increment value are obtained, and the initial threshold value is determined based on the average noise floor value, the preset approach increment value, and the preset distance increment value.

[0063] If the average noise floor value is greater than or equal to the preset maximum noise floor value, then the preset threshold value is determined as the initial threshold value.

[0064] In one possible implementation, the acquisition module is further configured to:

[0065] The sum of the average noise floor value and the preset proximity increment value is determined as the initial proximity threshold value;

[0066] The sum of the average noise floor value and the preset distance increment value is determined as the initial distance threshold value, wherein the initial threshold value includes the initial proximity threshold value and the initial distance threshold value.

[0067] In one possible implementation, the determining module is specifically used for:

[0068] Based on the initial threshold value and the detected value, a first positional relationship between the first object and the distance sensor is determined;

[0069] When the first positional relationship is the proximity relationship, the foreign object occlusion state of the distance sensor is determined, and the target threshold value is determined according to the foreign object occlusion state and the detection value, wherein the foreign object occlusion state is a foreign object occlusion state or a foreign object occlusion state.

[0070] When the first positional relationship is the distance relationship, the target threshold value is determined based on the detection value.

[0071] In one possible implementation, the determining module is further configured to:

[0072] When the foreign object obstruction state is the non-foreign object obstruction state, the current threshold value of the distance sensor is obtained, and the current threshold value is determined as the target threshold value;

[0073] When the foreign object obstruction state is a foreign object obstruction state, the current total foreign object obstruction count and foreign object obstruction count threshold of the distance sensor are obtained, and the target threshold value is determined based on the current total foreign object obstruction count, the foreign object obstruction count threshold, the detection value, the preset approach increment value, and the preset distance increment value.

[0074] In one possible implementation, the determining module is further configured to:

[0075] If the current total number of foreign object obstructions is greater than the foreign object obstruction count threshold, then the dynamic noise floor value is updated according to the detection value, and the target threshold value is determined according to the detection value, the preset approach increment value, and the preset distance increment value.

[0076] If the current total number of foreign object obstruction counts is less than or equal to the foreign object obstruction count threshold, the current threshold value of the distance sensor is obtained, and the current threshold value is determined as the target threshold value.

[0077] In one possible implementation, the determining module is further configured to:

[0078] Obtain a preset error count update condition for the distance sensor. The preset error count update condition is that the detected value is greater than a preset minimum noise floor value, and the sum of the detected value and a preset near-increment value is less than the current dynamic noise floor value.

[0079] The total error count of the distance sensor is updated based on the detected value and the preset error count update condition.

[0080] If the updated total error count is greater than the error count threshold and the detected value is less than the preset maximum noise floor value, then the dynamic noise floor value is updated according to the detected value, and the target threshold value is determined according to the detected value, the preset approach increment value, and the preset distance increment value.

[0081] If the updated total error count is less than or equal to the error count threshold, or if the detected value is greater than or equal to the preset maximum noise floor value, then the current threshold value of the distance sensor is obtained, and the current threshold value is determined as the target threshold value.

[0082] Thirdly, this application provides a chip on which a computer program is stored, and when the computer program is executed by the chip, it implements the method as described in any of the first aspects.

[0083] Fourthly, this application provides a chip module on which a computer program is stored, and when the computer program is executed by the chip module, it implements the method described in any of the first aspects.

[0084] Fifthly, embodiments of this application provide a terminal device, including: a processor and a memory;

[0085] The memory is used to store computer programs;

[0086] The processor is configured to execute a computer program stored in the memory to implement the method as described in any of the first aspects.

[0087] In a sixth aspect, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method described in any of the first aspects.

[0088] In a seventh aspect, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the method described in any of the first aspects.

[0089] The positional relationship determination method, apparatus, and device provided in this application can be applied to a terminal device equipped with a distance sensor. They can acquire an initial threshold value from the distance sensor and the detection value of the distance sensor when detecting a first object. Based on the initial threshold value and the detection value, a target threshold value is determined, and the target positional relationship between the first object and the distance sensor is determined based on the target threshold value and the detection value. In this process, the target threshold value can be obtained based on the initial threshold value and the detection value, and the target positional relationship can be obtained based on the target threshold value, thus improving the accuracy of the distance sensor in determining the target positional relationship. Attached Figure Description

[0090] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0091] Figure 1 A schematic diagram illustrating the application scenarios provided in the embodiments of this application;

[0092] Figure 2 A flowchart illustrating a method for determining positional relationships provided in an embodiment of this application;

[0093] Figure 3 A schematic diagram illustrating a method for obtaining an initial threshold value provided in an embodiment of this application;

[0094] Figure 4 This is a schematic diagram illustrating a method for determining a target threshold value based on proximity relationships, as provided in an embodiment of this application.

[0095] Figure 5 This is a schematic diagram illustrating a method for determining a target threshold value under a distance relationship, as provided in an embodiment of this application.

[0096] Figure 6 A flowchart illustrating another method for determining positional relationships provided in an embodiment of this application;

[0097] Figure 7 A schematic diagram of the positional relationship determination device provided in the embodiments of this application;

[0098] Figure 8This is a schematic diagram of the hardware structure of the terminal device provided in the embodiments of this application.

[0099] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0100] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0101] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0102] Figure 1 This is a schematic diagram illustrating an application scenario provided in an embodiment of this application. Please refer to [link / reference]. Figure 1 This includes terminal devices. The terminal devices may be equipped with a distance sensor, which can be used to determine the target position relationship between the first object and the distance sensor.

[0103] In related technologies, a factory threshold value is typically set for distance sensors at the time of manufacture. During subsequent use, this threshold value is used to determine the positional relationship of an object relative to the terminal device. However, during the use of distance sensors, factors such as device drops or dirt on the sensing baffle can cause the distance sensor to inaccurately determine the positional relationship based on the factory threshold value.

[0104] In this embodiment of the application, the initial threshold value of the distance sensor and the detection value of the distance sensor detecting the first object can be obtained. Based on the initial threshold value and the detection value, the target threshold value can be determined, and the target position relationship between the first object and the distance sensor can be determined based on the target threshold value and the detection value, thereby improving the accuracy of the distance sensor in judging the target position relationship.

[0105] The method described in this application will now be illustrated through specific embodiments. It should be noted that the following embodiments may exist independently or in combination with each other; identical or similar content will not be repeated in different embodiments.

[0106] Figure 2 This is a flowchart illustrating a method for determining positional relationships provided in an embodiment of this application. Please refer to... Figure 2 The method may include:

[0107] S201. Obtain the initial threshold value of the distance sensor.

[0108] The execution entity of this application embodiment can be a terminal device, or a chip, chip module, or position relationship determination device disposed in the terminal device. The position relationship determination device can be implemented by software or by a combination of software and hardware. For example, the position management determination device can be a distance sensor.

[0109] Optionally, the terminal device can be a smartphone, smartwatch, tablet, laptop, smart in-vehicle device, desktop computer, laptop computer, or virtual reality / augmented reality / mixed reality device, etc.

[0110] Optionally, the distance sensor can be, but is not limited to, an infrared distance sensor and a laser sensor.

[0111] The initial threshold value is determined at least based on the average noise floor value of the distance sensor. In practical applications, step S201 can be performed when the distance sensor is powered on or enabled to calibrate the distance sensor.

[0112] It should be noted that the method for obtaining the initial threshold value of the distance sensor will be discussed later. Figure 3 The embodiments shown are described in detail.

[0113] S202. Obtain the detection value of the distance sensor for the first object.

[0114] For example, when a distance sensor is installed in a mobile phone or smartwatch, the first object can be the user's hand or face; when a distance sensor is installed in a large artificial intelligence (AI) device, the first object can also be the user or a vehicle.

[0115] Optionally, the detection value corresponding to the distance sensor can be the light intensity absorbed by the distance sensor. The greater the light intensity, the closer the distance sensor is to the first object; conversely, the smaller the light intensity, the farther the distance sensor is from the first object. When the detection value is the light intensity absorbed by the distance sensor, the distance sensor can be an infrared distance sensor, or other distance sensors used to detect light intensity; this application does not limit this.

[0116] Optionally, when the detection value corresponding to the distance sensor can be the distance between the distance sensor and the first object, the shorter the distance, the closer the distance sensor is to the first object; the longer the distance, the farther the distance sensor is from the first object. When the detection value is the distance between the distance sensor and the first object, the distance sensor can be a laser distance sensor, an ultrasonic distance sensor, a radar distance sensor, etc., or other distance sensors used for distance detection; this application does not limit this.

[0117] S203. Determine the target threshold value based on the initial threshold value and the detected value.

[0118] Optionally, the target threshold can be determined as follows: based on the initial threshold and the detection value, determine the first positional relationship between the first object and the distance sensor; when the first positional relationship is close, determine the foreign object occlusion state of the distance sensor, and determine the target threshold based on the foreign object occlusion state and the detection value; when the first positional relationship is far away, determine the target threshold based on the detection value.

[0119] The first positional relationship is either close or distant.

[0120] The foreign object obstruction state can be either a state with foreign object obstruction or a state without foreign object obstruction. For example, the foreign object obstruction state can be a state with oil stains obstructing the view.

[0121] S204. Determine the target position relationship between the first object and the distance sensor based on the target threshold value and the detection value.

[0122] The target location relationship is either close or far.

[0123] The target threshold includes the target approach threshold and the target distance threshold.

[0124] Optionally, if the detected value is the light intensity absorbed by the distance sensor, when the detected value is greater than the target approach threshold, the target position relationship is close; when the detected value is less than the target distance threshold, the target position relationship is far away.

[0125] Optionally, if the detected value is the distance between the distance sensor and the first object, when the detected value is less than the target proximity threshold, the target position relationship is a proximity relationship; when the detected value is greater than the target distance threshold, the target position relationship is a distance relationship.

[0126] Optionally, after determining the target positional relationship, the positional relationship determination device can also send the target positional relationship to the terminal device, so that the terminal device can perform control based on the target positional relationship. For example, if the terminal device is a smartwatch and the first object is a face, the proximity sensor in the smartwatch can send the proximity relationship to the smartwatch when it detects that the target positional relationship is close. Based on the proximity relationship, the smartwatch determines that a person's face is close to the smartwatch and turns on the smartwatch screen so that the user can check the time, etc.

[0127] The position relationship determination method provided in this application embodiment can obtain the initial threshold value of the distance sensor and the detection value of the distance sensor detecting the first object, determine the target threshold value based on the initial threshold value and the detection value, and determine the target position relationship between the first object and the distance sensor based on the target threshold value and the detection value, thereby improving the accuracy of the distance sensor in determining the target position relationship.

[0128] Below, in conjunction with Figure 3 The process of obtaining the initial threshold value is explained.

[0129] Figure 3 This is a schematic diagram illustrating a method for obtaining an initial threshold value provided in an embodiment of this application. Please refer to... Figure 3 The method includes:

[0130] S301. Obtain the average noise floor value, current calibration status, and factory threshold value of the distance sensor.

[0131] Each time the distance sensor is activated, multiple detection values ​​can be obtained from the distance sensor, and the average value of the multiple detection values ​​is determined as the average noise floor value.

[0132] Optionally, the current calibration status information and factory threshold value of the distance sensor can be obtained based on the setting parameters corresponding to the distance sensor (e.g., in the driver code of the distance sensor).

[0133] Factory threshold values ​​include near-factory threshold values ​​and far-factory threshold values.

[0134] The current calibration status can include four situations:

[0135] Scenario 1: The current calibration status is automatic calibration, indicating that the distance sensor underwent automatic calibration at the factory. The automatic calibration process is as follows: Turn on the distance sensor, acquire multiple blank detection values, and determine the average of the multiple blank detection values ​​as the mold noise floor value. The sum of the mold noise floor value and the preset proximity increment value is determined as the factory proximity threshold value, and the sum of the mold noise floor value and the preset distance increment value is determined as the factory distance threshold value.

[0136] Scenario 2: The current calibration status is manual calibration, indicating that the distance sensor underwent manual calibration at the factory. The manual calibration process is as follows: Select two typical heights, usually 3cm and 5cm, and place the standard gray card at heights of 3cm and 5cm above the distance sensor, respectively. Obtain multiple first detection values ​​of the standard gray card at a distance of 3cm from the sensor, and determine the average of these multiple first detection values ​​as the factory approach threshold. Obtain multiple second detection values ​​of the standard gray card at a distance of 5cm from the sensor, and determine the average of these multiple second detection values ​​as the factory away threshold.

[0137] Case 3: The current calibration status includes both manual and automatic calibration, indicating that the distance sensor underwent both automatic and manual calibration at the factory. Typically, the factory threshold value obtained from manual calibration is more accurate than the factory threshold value obtained from automatic calibration. Therefore, in this embodiment, if the current calibration status is Case 3, the factory threshold value of the distance sensor is selected from the factory threshold value obtained from manual calibration.

[0138] Case 4: If the current calibration status is no calibration status, it indicates that the distance sensor did not undergo the mold calibration process when it left the factory. The initial threshold value of the distance sensor can be obtained by the initial threshold value acquisition method provided in the embodiments of this application.

[0139] S302. Based on the current calibration status and average noise floor value, determine whether to calibrate the factory threshold value.

[0140] If not, it indicates that the factory threshold value is valid under this calibration state, and S303 is executed; if yes, it indicates that the factory threshold value is invalid under this calibration state, and S304 is executed to calibrate the factory threshold value.

[0141] Optionally, if the current calibration status is automatic calibration, when the sum of the average noise floor value and the preset error value is greater than the factory threshold value, or when the average noise floor value is less than the mold noise floor value, then it is determined to perform dynamic calibration on the factory threshold value.

[0142] Optionally, if the current calibration status includes manual calibration, when the sum of the average noise floor value and the preset error value is greater than the factory far-from-the-threshold value, or when the sum of the average noise floor value, the preset proximity increment value and the preset error value is less than the factory proximity threshold value, and the average noise floor value is greater than the preset minimum noise floor value, then it is determined to perform dynamic calibration on the factory threshold value.

[0143] Optionally, if the current calibration status is no calibration, then the factory threshold value will be calibrated.

[0144] Optionally, the preset error value, preset foreign object obstruction threshold, preset maximum noise floor value, and preset minimum noise floor value of the distance sensor can be determined based on the manufacturer's test results of the same batch of distance sensors under multiple test conditions.

[0145] The preset error value can be the maximum fluctuation value of the distance sensor in a short period of time.

[0146] Determining whether the factory threshold needs to be calibrated based on the current calibration status of the distance sensor allows for a more flexible calibration process.

[0147] S303. Set the factory threshold value as the initial threshold value.

[0148] S304. Obtain the preset foreign object occlusion threshold.

[0149] The initial threshold value can be determined based on the average noise floor value and the preset foreign object occlusion threshold. Specifically:

[0150] If the average noise floor value is greater than or equal to the preset foreign object occlusion threshold, then further execute S305 to obtain the initial threshold value;

[0151] If the average noise floor value is less than the preset foreign object occlusion threshold, then further execute S306 to S308 to obtain the initial threshold value.

[0152] S305. Set the current threshold value as the initial threshold value.

[0153] S306. Obtain the preset maximum noise floor value.

[0154] The initial threshold value can be determined based on the average noise floor value and the preset maximum noise floor value. Specifically:

[0155] If the average noise floor value is greater than or equal to the preset maximum noise floor value, then further execute S307 to obtain the initial threshold value;

[0156] If the average noise floor value is less than the preset maximum noise floor value, then further execute S308 to obtain the initial threshold value.

[0157] S307. Set the preset threshold value as the initial threshold value.

[0158] Optionally, in practical applications, preset threshold values ​​can be set based on the calibration results of a batch of distance sensor prototypes or actual business needs.

[0159] S308. Obtain the preset approach increment value and the preset distance increment value, and determine the initial threshold value based on the average noise floor value, the preset approach increment value and the preset distance increment value.

[0160] Optionally, manufacturers can set the same preset proximity increment and preset distance increment values ​​for the same batch of distance sensors based on the test results of each batch. Alternatively, in manual calibration mode, the proximity increment and preset distance increment values ​​can be calculated using the following formula.

[0161] Preset proximity increment value = factory proximity threshold value - blank noise floor value;

[0162] Preset distance increment value = factory distance threshold value - blank noise floor value.

[0163] Among them, the factory approach threshold value is the average of multiple first detection values ​​obtained by a batch of distance sensors detecting a standard gray card at 3cm; the factory distance threshold value is the average of multiple second detection values ​​obtained by a batch of distance sensors detecting a standard gray card at 5cm; and the blank noise floor value is the average of multiple detection values ​​obtained by a batch of distance sensors under the condition of no foreign object obstruction.

[0164] In one possible implementation: the sum of the average noise floor value and the preset proximity increment value can be determined as the initial proximity threshold value; the sum of the average noise floor value and the preset distance increment value can be determined as the initial distance threshold value. The initial threshold value includes the initial proximity threshold value and the initial distance threshold value.

[0165] Optionally, after determining the initial threshold value, the initial threshold value can be set as a preset threshold value without foreign object obstruction, that is, the initial approach threshold value is the preset initial approach threshold value without foreign object obstruction, and the initial distance threshold value is the preset initial distance threshold value without foreign object obstruction.

[0166] The initial threshold value acquisition method provided in this application can acquire the average noise floor value, current calibration status, and factory threshold value of the distance sensor; and determine whether the factory threshold value needs to be calibrated based on the current calibration status; and when calibration is determined to be required, a preset foreign object occlusion threshold can be acquired, and the initial threshold value can be determined based on the preset foreign object occlusion threshold and the average noise floor value; when calibration is determined not to be required, the factory threshold value is determined as the initial threshold value. In the above process, by calibrating the factory threshold value of the distance sensor in conjunction with the current calibration status of the distance sensor, the obtained initial threshold value can be more accurate.

[0167] The method for determining the target threshold differs when the first object's positional relationship with the distance sensor is different. Below, we will combine... Figure 4 The method for determining the target threshold when the first positional relationship is a proximity relationship is explained; combined with Figure 5 The method for determining the target threshold value when the first positional relationship is a distance relationship is explained.

[0168] Figure 4 This is a schematic diagram illustrating a method for determining a target threshold value based on proximity relationships, as provided in an embodiment of this application.

[0169] Please see Figure 4 The method includes:

[0170] S401. Determine the obstruction status of the distance sensor by foreign objects.

[0171] When the foreign object obstruction state is the state of foreign object obstruction, execute S402~S404;

[0172] If the foreign object obstruction state is the state without foreign object obstruction, then S405 is executed.

[0173] Optionally, the foreign object obstruction status of the distance sensor can be determined based on whether the foreign object obstruction flag is set. When the foreign object obstruction flag is detected to be set, S402 to S404 are executed; otherwise, S405 is executed.

[0174] Optionally, the foreign object obstruction flag can be set based on the detected value and a preset foreign object obstruction threshold. If the detected value is greater than the preset foreign object obstruction threshold, the foreign object obstruction flag is set; if the detected value is less than or equal to the preset foreign object obstruction threshold, the foreign object obstruction flag does not need to be set.

[0175] Optionally, a preset foreign object obstruction threshold can be set based on the actual product's factory testing results. For example, the preset foreign object obstruction threshold can be the detection value of the obstruction at a distance of 0.1 cm from the sensor.

[0176] S402. Obtain the current total number of foreign object obstruction counts and the foreign object obstruction count threshold of the distance sensor.

[0177] In one possible implementation, the current total foreign object obstruction count of the distance sensor can be obtained by: obtaining a preset foreign object obstruction count update condition for the distance sensor; updating the total foreign object obstruction count of the distance sensor according to the detected value and the preset foreign object obstruction count update condition; and determining the updated total foreign object obstruction count as the current total foreign object obstruction count.

[0178] Optionally, the preset foreign object obstruction count update conditions may include: the detected value is less than the no-foreign-object-obstruction proximity threshold, the detected value is less than the preset maximum noise floor value, the detected value is greater than the no-foreign-object-obstruction distance threshold, and the difference between the detected value and the previous detected value of the distance sensor is less than the preset error value.

[0179] Optionally, when the detected value meets the above-mentioned preset foreign object obstruction count update conditions, the total foreign object obstruction count can be incremented by 1; when the detected value does not meet the preset foreign object obstruction count update conditions, the total foreign object obstruction count can be reset to zero.

[0180] S403. Determine whether the current total number of foreign object obstruction counts is greater than the foreign object obstruction count threshold.

[0181] If so, it indicates that the current total number of foreign object obstruction counts is greater than the foreign object obstruction count threshold, then execute S404;

[0182] If not, it indicates that the current total foreign object obstruction count is less than or equal to the foreign object obstruction count threshold, then execute S405.

[0183] Optionally, a foreign object obstruction counting threshold can be preset based on experience or actual usage needs. For example, the foreign object obstruction counting threshold can be 5.

[0184] S405. Determine the target threshold value based on the detected value, the preset near increment value, and the preset far increment value.

[0185] If the current total number of foreign object obstruction counts is greater than the foreign object obstruction count threshold, it indicates that the distance sensor has detected the detection value under the condition of foreign object obstruction multiple times in a row. At this time, it is necessary to calibrate the current threshold value to obtain the target threshold value.

[0186] The target threshold can include a target approach threshold and a target distance threshold. The sum of the detected value and the target approach increment value can be determined as the target approach threshold, and the sum of the detected value and the target distance increment value can be determined as the target distance threshold.

[0187] S405. Obtain the current threshold value of the distance sensor and determine the current threshold value as the target threshold value.

[0188] Optionally, if the current total number of foreign object obstruction counts is less than or equal to the foreign object obstruction count threshold, the target position relationship between the first object and the distance sensor can be determined based on the current threshold value and the detection value.

[0189] The current threshold value can be the initial threshold value or the target threshold value last obtained by the distance sensor during use.

[0190] The method for determining a target threshold value under proximity conditions provided in this application embodiment determines the target threshold value based on the current total number of foreign object obstructions, the foreign object obstruction count threshold, the detected value, a preset proximity increment value, and a preset distance increment value when the distance sensor is in a foreign object obstruction detection state. When the distance sensor is in a non-obstruction state, the current threshold value is determined as the target threshold value. When the distance sensor is obstructed by a foreign object, the overall detected value of the distance sensor will be too high. Using the above method, the target threshold value can be updated in a timely manner to avoid errors in judging the target position relationship and improve the accuracy of the distance sensor in judging the target position relationship.

[0191] Figure 5 This is a schematic diagram illustrating a method for determining a target threshold value under a distance relationship, as provided in an embodiment of this application.

[0192] Please see Figure 5 The method includes:

[0193] S501. Obtain the preset error count update conditions of the distance sensor.

[0194] The preset error count update condition is that the detected value is greater than the preset minimum noise floor value, and the sum of the detected value and the preset near-increment value is less than the current dynamic noise floor value.

[0195] It is understandable that when the distance sensor is started, the current dynamic noise floor value can be the average noise floor value; while the distance sensor is running, the current dynamic noise floor value can be updated in a timely manner based on the detected value.

[0196] S502. Update the total error count of the distance sensor based on the detected value and the preset error count update conditions.

[0197] Optionally, when the detected value meets the above-mentioned preset error count update conditions, the total error count can be incremented by 1; when the detected value does not meet the preset error count update conditions, the total error count can be cleared to zero.

[0198] S503. If the updated total error count is greater than the error count threshold and the detected value is less than the preset maximum noise floor value, update the dynamic noise floor value according to the detected value, and determine the target threshold value according to the detected value, the preset approach increment value, and the preset distance increment value.

[0199] During the operation of the distance sensor, the dynamic noise floor value can be updated in a timely manner based on the detected value. For example, if the error count threshold is 5, and the updated total error count corresponding to the current detection value of the distance sensor is 6, the dynamic noise floor value can be updated to the current detection value.

[0200] If the updated total error count is greater than the error count threshold, it indicates that the distance sensor has detected the value under error conditions multiple times in a row. At this time, the current threshold value needs to be calibrated to obtain the target threshold value.

[0201] Optionally, after determining that the updated total error count is greater than the error count threshold and the detected value is less than the preset maximum noise floor value, the updated total error count can be cleared.

[0202] Optionally, after determining the target threshold, the preset no-obstacle threshold can be updated based on the target threshold. The specific update process is as follows:

[0203] If the preset no-obstacle approach threshold is greater than the target approach threshold, the preset no-obstacle approach threshold will be updated to the target approach threshold; if the preset no-obstacle approach threshold is less than or equal to the target approach threshold, the preset no-obstacle approach threshold will be retained.

[0204] If the preset threshold value for distance from foreign objects is greater than the target threshold value, the preset threshold value will be updated to the target threshold value; if the preset threshold value for distance from foreign objects is less than or equal to the target threshold value, the preset threshold value will be retained.

[0205] It should be noted that the specific execution process for determining the target threshold value in S503 can refer to the specific execution process for determining the target threshold value in S405, and will not be repeated here.

[0206] S504. If the updated total error count is less than or equal to the error count threshold, or if the detected value is greater than or equal to the preset maximum noise floor value, obtain the current threshold value of the distance sensor and determine the current threshold value as the target threshold value.

[0207] The method for determining a target threshold value under a distance relationship provided in this application can update the total error count of the distance sensor based on preset error counting conditions and detection values. If the updated total error count is greater than the error counting threshold and the detection value is less than the preset maximum noise floor value, then the target threshold value is determined based on the detection value, preset proximity increment value, and distance increment value. If the updated total error count is less than or equal to the error counting threshold, or if the detection value is greater than or equal to the preset maximum noise floor value, then the current threshold value is determined as the target threshold value. In the above process, excessively large initial threshold values ​​or dynamic noise floor values ​​can be corrected, improving the accuracy of the distance sensor in judging the target position relationship.

[0208] Figure 6 This is a flowchart illustrating another method for determining positional relationships provided in an embodiment of this application. Please refer to... Figure 6 The method includes:

[0209] S601: Obtain the average noise floor value, current calibration status, and factory threshold value of the distance sensor.

[0210] S602. Based on the current calibration status and average noise floor value, determine whether to calibrate the factory threshold value.

[0211] If yes, then execute S603; otherwise, execute S604.

[0212] S603. Obtain the preset foreign object occlusion threshold, and determine the initial threshold value based on the average noise floor value and the preset foreign object occlusion threshold.

[0213] S604. Set the factory threshold value as the initial threshold value.

[0214] It should be noted that the specific execution process of S601 to S604 can be the same as the specific execution process of S301 to S308, which will not be elaborated here.

[0215] S605. Obtain the detection value of the first object by the distance sensor.

[0216] S606. Determine the first positional relationship between the first object and the distance sensor based on the initial threshold value and the detection value.

[0217] S607. When the first positional relationship is a proximity relationship, determine the foreign object occlusion state of the distance sensor, and determine the target threshold value based on the foreign object occlusion state and the detection value.

[0218] It should be noted that the specific execution process of S607 can be found by referring to... Figure 4 The implementation examples will be carried out in detail here.

[0219] S608. When the first positional relationship is a distant relationship, the target threshold value is determined based on the detection value.

[0220] Optionally, after determining that the first positional relationship is a distance relationship, the previously set foreign object occlusion variables can be cleared. The foreign object occlusion variables may include: foreign object occlusion flag, total foreign object occlusion count, and the last detection value of the distance sensor.

[0221] It should be noted that the specific execution process of S608 can be found by referring to... Figure 5 The implementation examples will be carried out in detail here.

[0222] S609. Determine the target position relationship between the first object and the distance sensor based on the target threshold value and the detection value.

[0223] Optionally, after the distance sensor determines the target position relationship, it can report the target position relationship to the terminal device. After each time the distance sensor reports the target position relationship, it can also determine whether the distance sensor is turned off. If it is turned off, the process ends; if it is not turned off, the S605 to S609 processes can be repeated.

[0224] It is understood that the method for determining the positional relationship of the distance sensor provided in this application embodiment can be applied to various scenarios:

[0225] Scenario 1: When the distance sensor has not been factory calibrated, i.e. there is no factory threshold value, the distance sensor can be dynamically calibrated by executing S603 to obtain the initial threshold value, and then the target threshold value can be obtained. The target position relationship can be determined by the target threshold value and the detection value.

[0226] Scenario 2: If the distance sensor has been factory calibrated but the factory threshold value fails, the distance sensor can be dynamically calibrated by executing S603 to obtain the initial threshold value, and then the target threshold value can be obtained. The target position relationship can be determined by the target threshold value and the detection value.

[0227] Scenario 3: When the initial threshold value of the distance sensor fails due to obstruction by foreign objects or dropping of the equipment, S606 to S608 can be executed to obtain the target threshold value, and the target position relationship can be determined by the target threshold value and the detection value.

[0228] It should be noted that the above scenarios are for the purpose of illustrating some application scenarios of the positional relationship determination method shown in the embodiments of this application. In some embodiments, other application scenarios may also be included. The above scenarios do not constitute a limitation on the application scenarios of the positional relationship determination method shown in the embodiments of this application.

[0229] The position relationship determination method provided in this application embodiment can obtain the initial threshold value of the distance sensor and the detection value of the distance sensor detecting the first object, determine the target threshold value based on the initial threshold value and the detection value, and determine the target position relationship between the first object and the distance sensor based on the target threshold value and the detection value, thereby improving the accuracy of the distance sensor in determining the target position relationship.

[0230] Figure 7 This is a schematic diagram of a positional relationship determination device provided in an embodiment of this application. The positional relationship determination device can be a chip or a chip module. Please refer to... Figure 7 The position relationship determination device 10 includes an acquisition module 11 and a determination module 12, wherein:

[0231] The acquisition module 11 is used to acquire an initial threshold value of the distance sensor, wherein the initial threshold value is determined at least based on the average noise floor value of the distance sensor;

[0232] The acquisition module 11 is further configured to acquire the detection value of the distance sensor detecting the first object;

[0233] The determining module 12 is used to determine the target threshold value based on the initial threshold value and the detected value;

[0234] The determining module 12 is further configured to determine the target position relationship between the first object and the distance sensor based on the target threshold value and the detection value, wherein the target position relationship is either close or far.

[0235] The positional relationship determination device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be repeated here.

[0236] In one possible implementation, the acquisition module 11 is specifically used for:

[0237] Obtain the average noise floor value, current calibration status, and factory threshold value of the distance sensor;

[0238] Based on the current calibration status and the average noise floor value, determine whether to perform dynamic calibration on the factory threshold value;

[0239] If so, then obtain the preset foreign object occlusion threshold, and determine the initial threshold value based on the average noise floor value and the preset foreign object occlusion threshold;

[0240] If not, the factory threshold value shall be determined as the initial threshold value.

[0241] In one possible implementation, the acquisition module 11 is further specifically used for:

[0242] If the current calibration state is automatic calibration state, when the sum of the average noise floor value and the preset error value is greater than the factory threshold value, or when the average noise floor value is less than the mold noise floor value, then it is determined to perform dynamic calibration on the factory threshold value.

[0243] If the current calibration state includes manual calibration, when the sum of the average noise floor value and the preset error value is greater than the factory far-from-threshold value, or when the sum of the average noise floor value, the preset proximity increment value and the preset error value is less than the factory proximity threshold value, and the average noise floor value is greater than the preset minimum noise floor value, then it is determined to perform dynamic calibration on the factory threshold value.

[0244] If the current calibration status is no calibration status, then it is determined that the factory threshold value should be dynamically calibrated.

[0245] In one possible implementation, the acquisition module 11 is further specifically used for:

[0246] If the average noise floor value is less than the preset foreign object occlusion threshold, then the preset maximum noise floor value is obtained, and the initial threshold value is determined based on the preset maximum noise floor value and the average noise floor value.

[0247] If the average noise floor value is greater than or equal to the preset foreign object occlusion threshold, then the current threshold value is determined as the initial threshold value.

[0248] In one possible implementation, the acquisition module 11 is further specifically used for:

[0249] If the average noise floor value is less than the preset maximum noise floor value, then a preset approach increment value and a preset distance increment value are obtained, and the initial threshold value is determined based on the average noise floor value, the preset approach increment value, and the preset distance increment value.

[0250] If the average noise floor value is greater than or equal to the preset maximum noise floor value, then the preset threshold value is determined as the initial threshold value.

[0251] In one possible implementation, the acquisition module 11 is further configured to:

[0252] The sum of the average noise floor value and the preset proximity increment value is determined as the initial proximity threshold value;

[0253] The sum of the average noise floor value and the preset distance increment value is determined as the initial distance threshold value, wherein the initial threshold value includes the initial proximity threshold value and the initial distance threshold value.

[0254] In one possible implementation, the determining module 12 is specifically used for:

[0255] Based on the initial threshold value and the detected value, a first positional relationship between the first object and the distance sensor is determined;

[0256] When the first positional relationship is the proximity relationship, the foreign object occlusion state of the distance sensor is determined, and the target threshold value is determined according to the foreign object occlusion state and the detection value, wherein the foreign object occlusion state is a foreign object occlusion state or a foreign object occlusion state.

[0257] When the first positional relationship is the distance relationship, the target threshold value is determined based on the detection value.

[0258] In one possible implementation, the determining module 12 is further configured to:

[0259] When the foreign object obstruction state is the non-foreign object obstruction state, the current threshold value of the distance sensor is obtained, and the current threshold value is determined as the target threshold value;

[0260] When the foreign object obstruction state is a foreign object obstruction state, the current total foreign object obstruction count and foreign object obstruction count threshold of the distance sensor are obtained, and the target threshold value is determined based on the current total foreign object obstruction count, the foreign object obstruction count threshold, the detection value, the preset approach increment value, and the preset distance increment value.

[0261] In one possible implementation, the determining module 12 is further configured to:

[0262] If the current total number of foreign object obstructions is greater than the foreign object obstruction count threshold, then the dynamic noise floor value is updated according to the detection value, and the target threshold value is determined according to the detection value, the preset approach increment value, and the preset distance increment value.

[0263] If the current total number of foreign object obstruction counts is less than or equal to the foreign object obstruction count threshold, the current threshold value of the distance sensor is obtained, and the current threshold value is determined as the target threshold value.

[0264] In one possible implementation, the determining module 12 is further configured to:

[0265] Obtain a preset error count update condition for the distance sensor. The preset error count update condition is that the detected value is greater than a preset minimum noise floor value, and the sum of the detected value and a preset near-increment value is less than the current dynamic noise floor value.

[0266] The total error count of the distance sensor is updated based on the detected value and the preset error count update condition.

[0267] If the updated total error count is greater than the error count threshold and the detected value is less than the preset maximum noise floor value, then the dynamic noise floor value is updated according to the detected value, and the target threshold value is determined according to the detected value, the preset approach increment value, and the preset distance increment value.

[0268] If the updated total error count is less than or equal to the error count threshold, or if the detected value is greater than or equal to the preset maximum noise floor value, then the current threshold value of the distance sensor is obtained, and the current threshold value is determined as the target threshold value.

[0269] The positional relationship determination device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be repeated here.

[0270] Figure 8 This is a schematic diagram of the hardware structure of the terminal device provided in an embodiment of this application. Please refer to... Figure 8 The terminal device 20 may include a processor 21 and a memory 22. The processor 21 and the memory 22 can communicate; for example, the processor 21 and the memory 22 communicate via a communication bus 23.

[0271] The memory 22 is used to store computer-executed instructions;

[0272] The processor 21 is used to execute computer execution instructions stored in the memory 22, so that the processor 21 executes the position relationship determination method as shown in the above method embodiment.

[0273] Optionally, the terminal device 20 may also include a communication interface, which may include a transmitter and / or a receiver.

[0274] Optionally, the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.

[0275] The terminal device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0276] This application provides a computer-readable storage medium storing computer-executable instructions; when executed by a processor, the computer-executable instructions are used to implement the positional relationship determination method as described in any of the above embodiments.

[0277] This application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it causes the computer to perform the above-described positional relationship determination method.

[0278] All or part of the steps in the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, it performs the steps of the above method embodiments; and the aforementioned memory (storage medium) includes: read-only memory (ROM), RAM, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disk, and any combination thereof.

[0279] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0280] It is understood that the various numerical designations used in the embodiments of this application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this application.

[0281] In this application, the term "comprising" and its variations can refer to non-limiting inclusion; the term "or" and its variations can refer to "and / or". The terms "first", "second", etc., in this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. In this application, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0282] Obviously, those skilled in the art can make various modifications and variations to the embodiments of this application without departing from the spirit and scope of this application. Therefore, if these modifications and variations to the embodiments of this application fall within the scope of the claims of this application and their equivalents, this application also intends to include these modifications and variations.

Claims

1. A position relationship determination method characterized by comprising: Applied to a terminal device side, a distance sensor is arranged in the terminal device, comprising: an initial threshold value of the distance sensor is acquired, the initial threshold value being determined at least according to an average noise floor value of the distance sensor; a detection value of the distance sensor detecting a first object is acquired; a target threshold value is determined according to the initial threshold value and the detection value; a target position relationship between the first object and the distance sensor is determined according to the target threshold value and the detection value, the target position relationship being a close relationship or a far-away relationship; the initial threshold value of the distance sensor is acquired, comprising: an average noise floor value, a current calibration state and a factory threshold value of the distance sensor are acquired; whether to dynamically calibrate the factory threshold value is judged according to the current calibration state and the average noise floor value; if yes, a preset foreign matter shielding threshold value is acquired, and the initial threshold value is determined according to the average noise floor value and the preset foreign matter shielding threshold value; if no, the factory threshold value is determined as the initial threshold value.

2. The method of claim 1, wherein, whether to dynamically calibrate the factory threshold value is judged according to the current calibration state and the average noise floor value, comprising: if the current calibration state is an automatic calibration state, when a sum of the average noise floor value and a preset error value is greater than a factory far-away threshold value, or when the average noise floor value is less than a work model noise floor value, it is determined that the factory threshold value is dynamically calibrated; if the current calibration state comprises a manual calibration state, when the sum of the average noise floor value and the preset error value is greater than the factory far-away threshold value, or when a sum of the average noise floor value, a preset close increment value and the preset error value is less than a factory close threshold value, and the average noise floor value is greater than a preset minimum noise floor value, it is determined that the factory threshold value is dynamically calibrated; if the current calibration state is a no-calibration state, it is determined that the factory threshold value is dynamically calibrated.

3. The method of claim 1, wherein, the initial threshold value is determined according to the average noise floor value and the preset foreign matter shielding threshold value, comprising: if the average noise floor value is less than the preset foreign matter shielding threshold value, a preset maximum noise floor value is acquired, and the initial threshold value is determined according to the preset maximum noise floor value and the average noise floor value; if the average noise floor value is greater than or equal to the preset foreign matter shielding threshold value, a current threshold value is determined as the initial threshold value.

4. The method of claim 3, wherein, the initial threshold value is determined according to the preset maximum noise floor value and the average noise floor value, comprising: if the average noise floor value is less than the preset maximum noise floor value, a preset close increment value and a preset far-away increment value are acquired, and the initial threshold value is determined according to the average noise floor value, the preset close increment value and the preset far-away increment value; if the average noise floor value is greater than or equal to the preset maximum noise floor value, a preset threshold value is determined as the initial threshold value.

5. The method of claim 4, wherein, the initial threshold value is determined according to the average noise floor value, the preset close increment value and the preset far-away increment value, comprising: a sum of the average noise floor value and the preset close increment value is determined as an initial close threshold value; The sum of the average noise floor value and the preset far-away increment value is determined as an initial far-away threshold value, wherein the initial threshold value includes the initial close-in threshold value and the initial far-away threshold value.

6. The method according to any one of claims 1 to 5, characterized in that, According to the initial threshold value and the detection value, a target threshold value is determined, including: According to the initial threshold value and the detection value, a first positional relationship between the first object and the distance sensor is determined; When the first positional relationship is the close-in relationship, a foreign matter shielding state of the distance sensor is determined, and the target threshold value is determined according to the foreign matter shielding state and the detection value, wherein the foreign matter shielding state is a foreign matter shielding state or a non-foreign matter shielding state; When the first positional relationship is the far-away relationship, the target threshold value is determined according to the detection value.

7. The method of claim 6, wherein, According to the foreign matter shielding state and the detection value, the target threshold value is determined, including: When the foreign matter shielding state is the non-foreign matter shielding state, a current threshold value of the distance sensor is obtained, and the current threshold value is determined as the target threshold value; When the foreign matter shielding state is the foreign matter shielding state, a current foreign matter shielding count total amount and a foreign matter shielding count threshold value of the distance sensor are obtained, and the target threshold value is determined according to the current foreign matter shielding count total amount, the foreign matter shielding count threshold value, the detection value, a preset close-in increment value and a preset far-away increment value.

8. The method of claim 7, wherein, According to the current foreign matter shielding count total amount, the foreign matter shielding count threshold value, the detection value, the preset close-in increment value and the preset far-away increment value, the target threshold value is determined, including: If the current foreign matter shielding count total amount is greater than the foreign matter shielding count threshold value, a dynamic noise floor value is updated according to the detection value, and the target threshold value is determined according to the detection value, the preset close-in increment value and the preset far-away increment value; If the current foreign matter shielding count total amount is less than or equal to the foreign matter shielding count threshold value, a current threshold value of the distance sensor is obtained, and the current threshold value is determined as the target threshold value.

9. The method of claim 6, wherein, According to the detection value, the target threshold value is determined, including: A preset error count update condition of the distance sensor is obtained, and the preset error count update condition is that the detection value is greater than a preset minimum noise floor value, and a sum of the detection value and a preset close-in increment value is less than a current dynamic noise floor value; According to the detection value and the preset error count update condition, an error count total amount of the distance sensor is updated; If the updated error count total amount is greater than an error count threshold value and the detection value is less than a preset maximum noise floor value, a dynamic noise floor value is updated according to the detection value, and the target threshold value is determined according to the detection value, the preset close-in increment value and a preset far-away increment value; If the updated error count total amount is less than or equal to the error count threshold value, or the detection value is greater than or equal to the preset maximum noise floor value, a current threshold value of the distance sensor is obtained, and the current threshold value is determined as the target threshold value.

10. A positional relationship determination device, characterized in that, The method comprises an obtaining module and a determining module, wherein: The acquisition module is configured to acquire an initial threshold value of the distance sensor, the initial threshold value being determined according to at least an average noise floor value of the distance sensor; The acquisition module is further configured to acquire a detection value of the distance sensor detecting a first object; The determination module is configured to determine a target threshold value according to the initial threshold value and the detection value; The determination module is further configured to determine a target positional relationship between the first object and the distance sensor according to the target threshold value and the detection value, the target positional relationship being a close relationship or a far-away relationship; The acquisition module is specifically configured to: acquire an average noise floor value, a current calibration state, and a factory threshold value of the distance sensor; determine whether to dynamically calibrate the factory threshold value according to the current calibration state and the average noise floor value; if yes, acquire a preset foreign matter shielding threshold value, and determine the initial threshold value according to the average noise floor value and the preset foreign matter shielding threshold value; if no, determine the factory threshold value as the initial threshold value.

11. A terminal device, comprising: comprise: a processor and a memory; the memory is configured to store a computer program; the processor is configured to execute the computer program stored in the memory to implement the method in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and when the computer execution instructions are executed by the processor, the computer execution instructions are configured to implement the method in any one of claims 1 to 9.

13. A computer program product, characterised in that, comprise a computer program, and when the computer program is executed by the processor, the computer program is configured to implement the method in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Distance calibration method and terminal

    CN106443639A