A displacement measurement method, device, equipment and medium of a laser displacement sensor
By acquiring and processing the basic parameter information and light intensity data of the laser displacement sensor, and dynamically adjusting the laser power, the problem of measurement accuracy and linearity of the laser displacement sensor under different environments is solved, and high-precision displacement measurement is achieved.
Patent Information
- Application Number
- CN202511127437.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-13
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2045-08-13
AI Technical Summary
Existing laser displacement sensors cannot dynamically adjust laser power under different light intensities and distances, making it difficult to unify measurement accuracy and linearity. Furthermore, manual adjustment is time-consuming, laborious, and prone to errors.
By acquiring the basic parameter information of the laser displacement sensor, displacement measurement data under different light intensities and output optical powers are collected, preprocessed, the optimal output range is determined, and the laser power is adjusted in real time to adapt to environmental changes.
It enables dynamic adjustment of the accuracy and measurement precision of the laser displacement sensor under different usage scenarios, improving the accuracy and stability of measurement, reducing errors, and adapting to changes in ambient light and distance.
Smart Images

Figure CN120800206B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of laser displacement sensor technology, specifically to a displacement measurement method, device, equipment, and medium for a laser displacement sensor. Background Technology
[0002] A laser displacement sensor is a sensor that uses laser technology to achieve high-precision distance and displacement measurement. Its core principle is based on the directionality, monochromaticity and coherence of laser. With its advantages such as non-contact, high precision and fast response, it is widely used in industrial inspection, automation control and medical equipment.
[0003] Existing laser displacement sensor technology, when measuring displacement, employs either a fixed output laser power or manual adjustment of the laser's output power. However, in fixed power mode, the sensor's output light intensity is constant. Because it cannot dynamically adjust its output according to the intensity of ambient light under varying light intensities, the signal at the sensor's receiver is easily interfered with by ambient light. Under strong light, the fixed light intensity can be overwhelmed by ambient light or cause overload of the photosensitive element; under weak light, the weak signal may lead to increased measurement errors. Furthermore, when facing objects at different distances, because the laser output light intensity is constant, the laser beam experiences energy attenuation with increasing distance, causing the intensity of the light reflected back to the sensor to vary with the distance from the object. Significant fluctuations due to changes in distance can lead to jumps or deviations in measurement data. Furthermore, it makes it difficult to maintain consistent linearity and accuracy of the sensor at different measurement distances. While manual adjustment of output power can address specific scenarios to some extent, it requires repeated adjustments based on operator experience, which is not only time-consuming and labor-intensive but also cannot respond to dynamically changing measurement environments in real time. In addition, manual adjustment may lead to increased measurement errors due to insufficient adjustment precision or human error. Therefore, existing laser displacement sensor technology cannot accurately and dynamically adjust the laser power output of the laser displacement sensor according to the distance to the object being measured and the light intensity during displacement measurement, thus failing to ensure the measurement accuracy of the sensor in different usage scenarios. Summary of the Invention
[0004] This invention aims to at least partially solve one of the technical problems in the prior art. It acquires basic parameter information of a laser displacement sensor and collects displacement measurement data of the object under test under different light intensities and output light powers. A first preprocessing step is performed to obtain basic displacement measurement data of the laser displacement sensor. The optimal output range under different light intensities is obtained and recorded as reference light output data. Based on the reference light output data, the output light power of the laser displacement sensor is adjusted in real time to obtain the displacement measurement result. This addresses the problem that existing laser displacement sensor technology cannot accurately and dynamically adjust the output laser power of the laser displacement sensor according to the distance to the object under test and the light intensity during displacement measurement, thus failing to ensure the measurement accuracy of the sensor in different application scenarios.
[0005] To achieve the above objectives, in a first aspect, this application provides a displacement measurement method using a laser displacement sensor, comprising the following steps:
[0006] Acquire the basic parameter information of the laser displacement sensor, and collect the displacement measurement data of the object under test under different light intensities and different output light powers of the laser displacement sensor, which are recorded as the initial displacement measurement data;
[0007] The initial displacement measurement data is preprocessed to obtain the basic displacement measurement data of the laser displacement sensor.
[0008] The optimal output range under different illumination intensities is obtained based on the basic displacement measurement data and recorded as the reference light output data.
[0009] The output power of the laser displacement sensor is adjusted in real time based on the reference light output data, and the displacement measurement results are obtained.
[0010] Further, the basic parameter information of the laser displacement sensor is obtained, and the displacement measurement data of the object under test is collected under different light intensities and different output light powers, which are recorded as the initial displacement measurement data. This includes the following sub-steps:
[0011] Obtain the range of laser power that the laser emitting unit of the laser displacement sensor can output, denoted as the initial output optical power range [LP, UP]; obtain the minimum illumination intensity LG and the maximum illumination intensity UG of the environment in which the laser displacement sensor is used; denote [LG, UG] as the initial illumination intensity range;
[0012] Obtain the measurement range and measurement accuracy of the laser displacement sensor, denoted as displacement measurement range [LX, UX] and displacement measurement accuracy AE, respectively; and denote the object whose displacement is to be measured as the object to be measured.
[0013] Set the initial optical power interval to A1, and select multiple test optical power points evenly from the initial output optical power range according to A1, and record them as test optical power points 1-n in order of size;
[0014] Set the initial light intensity interval to A2, and select multiple test light intensity points uniformly from the initial light intensity range according to A2. Record them as test temperature points 1-m in order of size.
[0015] Furthermore, acquiring the basic parameter information of the laser displacement sensor and collecting displacement measurement data of the object under test under different light intensities and different output light powers, recorded as initial displacement measurement data, also includes the following sub-steps:
[0016] Multiple displacement magnitudes are uniformly selected within the displacement measurement range [LX, UX] and denoted as test displacements; any one test displacement is denoted as the first test displacement DX0; any one test light intensity point is denoted as the first test light intensity.
[0017] The actual displacement of the object to be measured from the laser displacement sensor is taken as the first test displacement. The object is placed in an environment with an illumination intensity of the first test light intensity. The output light power of the laser displacement sensor is adjusted sequentially to test light power points 1-n. At the same time, the displacement of the object to be measured is obtained by reading the laser displacement sensor corresponding to each test light power point. The second displacement measurement data corresponding to the first test light intensity is obtained.
[0018] Keeping the actual displacement of the object under test to the laser displacement sensor constant, repeatedly collect displacement measurement data of all test light intensity points corresponding to the first test displacement to obtain the first displacement measurement data of the first test displacement.
[0019] Repeatedly collect displacement measurement data corresponding to all test displacements to obtain initial displacement measurement data.
[0020] Further, based on the initial displacement measurement data, a first preprocessing step is performed to obtain the basic displacement measurement data of the laser displacement sensor, including the following sub-steps:
[0021] For the displacement measurement data of any test light intensity point corresponding to the first test displacement in the initial displacement measurement data, the data are arranged in ascending order according to the magnitude of the corresponding test light power points, and denoted as the first displacement measurement sequence. The displacement error between each displacement magnitude in the first displacement measurement sequence and the first test displacement DX0 is calculated according to the first formula to obtain the first displacement error sequence. The first formula is as follows: WC i WX represents the error between the magnitude of the i-th displacement in the first displacement measurement sequence and the first test displacement DX0. i This represents the magnitude of the i-th displacement in the first displacement measurement sequence;
[0022] For any error in the first displacement error sequence, let it be denoted as the first error WC. i Obtain the k1 nearest errors located on one side of the first error, and arrange them together with the first error in ascending order, denoted as the second displacement error sequence, where k1 is the set number;
[0023] Obtain the k2th and k3th percentiles of the second displacement error sequence, and denote them as WB1 and WB2 respectively; calculate QR, QR = WB2 - WB1; denote [WB1 - k4 * QR, WB2 + k4 * QR] as the first error WC. i The error anomaly range; where k2 and k3 are the set percentiles, and k4 is the set proportional coefficient; repeatedly obtain the error anomaly range of all errors in the first displacement error sequence.
[0024] Furthermore, the process of performing a first preprocessing step based on the first displacement measurement data to obtain the basic displacement measurement data of the laser displacement sensor also includes the following sub-steps:
[0025] The error difference sequence is obtained by calculating the adjacent error difference of each error in the first displacement error sequence according to the second formula. The second formula is as follows: , where CFi represents the adjacent error difference of WCi;
[0026] Extract the sign factor of each error difference in the error difference sequence and arrange them in the corresponding order as the first sign sequence, where the sign factor of the negative sign is denoted as -1, the sign factor of the positive sign is denoted as 1, and the sign factor of 0 is denoted as 0.
[0027] For any error difference in the error difference sequence, denoted as the first difference CFi, obtain the k1 nearest error differences located on one side of the first difference and arrange them together with the first difference in the corresponding order, denoted as the first difference sequence; obtain the partial first symbol sequence corresponding to the first difference sequence, denoted as the second coincidence sequence; calculate the probability distributions of -1, 1 and 0 in the second coincidence sequence respectively, and denoted as f(-1), f(1) and f(0) respectively in order.
[0028] Calculate the trend entropy CH corresponding to the first difference using the third formula. i The third formula is as follows: Repeatedly calculate the trend entropy corresponding to all error differences in the error difference sequence, and denote it as the first trend entropy set. Calculate the mean and standard deviation of the trend entropy set, and denote them as PH1 and PH2 in order. Denote [PH1-k5*PH2, PH1+k5*PH2] as the trend entropy anomaly range of the first trend entropy set, where k5 is the set proportional coefficient.
[0029] For any displacement magnitude in the first displacement measurement sequence, let it be denoted as the first displacement magnitude WX. i If the first displacement size WX i Corresponding error WC i It does not belong to the corresponding error anomaly range, or the corresponding trend entropy CH i If it does not belong to the corresponding trend entropy anomaly range, then mark the first displacement size WX. i If the data is abnormal, it is marked as normal data.
[0030] Repeatedly mark all displacement magnitudes in the initial displacement measurement data; for displacement magnitudes marked as abnormal data, re-acquire and replace them, and mark them again, until there are no abnormal data in the initial displacement measurement data. After completion, the basic displacement measurement data is obtained.
[0031] Furthermore, obtaining the optimal output range under different illumination intensities based on the basic displacement measurement data, denoted as the reference light output data, includes the following sub-steps:
[0032] For each displacement magnitude in the basic displacement measurement data, the displacement error between each displacement magnitude and the first test displacement DX0 is calculated using the first formula, and the absolute value is taken. After completion, the basic displacement error data is obtained.
[0033] For any test light intensity point corresponding to the first test displacement in the basic displacement error data, it is denoted as the first light intensity. For all displacement errors under the first light intensity, they are arranged in ascending order according to the magnitude of the corresponding test light power points and denoted as the first basic error sequence.
[0034] If the first basic error sequence has more than one minimum value, then consecutive adjacent minimum values are denoted as the minimum set, and the part of the minimum set with the most minimum values corresponding to the first basic error sequence is obtained and denoted as the minimum error sequence.
[0035] Obtain the range size of the minimum error sequence, denoted as the first error range [RA1, RA2], and calculate the second error range [RB1, RB2], where RB1 = RA1 - AE / 2 and RB1 = RA1 + AE / 2. Obtain the test optical power points corresponding to all displacement errors in [RB1, RB2] in the first basic error sequence, denoted as the first optical output set, and obtain the range size of the first optical output set, marked as the optimal output range of the first light intensity.
[0036] Furthermore, obtaining the optimal output range under different illumination intensities based on the basic displacement measurement data, denoted as the reference light output data, also includes the following sub-steps:
[0037] If the first basic error sequence has only one minimum value, then the minimum value is denoted as RA0, and the third error range [RC1, RC2] is calculated, where RC1 = RA0 - AE / 2, RC2 = RA0 + AE / 2; all test optical power points corresponding to the displacement errors in [RC1, RC2] in the first basic error sequence are taken and denoted as the first optical output set, and the size of the range of the first optical output set is obtained and marked as the optimal output range of the first light intensity;
[0038] Repeatedly acquire the optimal output range of all test light intensity points corresponding to all test displacements, and record it as the reference light output data.
[0039] Furthermore, the output optical power of the laser displacement sensor is adjusted in real time based on the reference light output data, and the displacement measurement results are obtained through the following sub-steps:
[0040] When the laser displacement sensor measures the object to be measured, the displacement magnitude from the laser displacement sensor to the object to be measured is obtained once and recorded as the coarse displacement magnitude CX0. At the same time, the ambient light intensity is obtained and recorded as the actual light intensity SL0.
[0041] Obtain the two test displacements closest to CX0, and denot them as the first reference displacement FX1 and the second reference displacement FX2 in ascending order; obtain the two test light intensity points closest to SL0, and denot them as the first reference light intensity FG1 and the second reference light intensity FG2 in ascending order.
[0042] The optimal output ranges corresponding to FX1-FG1, FX1-FG2, FX2-FG1 and FX2-FG2 are obtained from the reference light output data and are respectively denoted as the first range [AG1, BG1], the second range [AG2, BG2], the third range [AG3, BG3] and the fourth range [AG4, BG4] in order.
[0043] Calculate the first displacement weight XQ1, the second displacement weight XQ2, the first light intensity weight XG1, and the second light intensity weight XG2 respectively, where XQ1=|FX2-CX0| / |FX2-FX1|, XQ2=|FX1-CX0| / |FX2-FX1|, XG1=|FG2-SL0| / |FG2-FG1|, XG1=|FG2-SL0| / |FG2-FG1|;
[0044] If the intersection of [AG1, BG1], [AG2, BG2], [AG3, BG3] and [AG4, BG4] exists, then the intersection is recorded as the final output range.
[0045] If the intersection of [AG1, BG1], [AG2, BG2], [AG3, BG3] and [AG4, BG4] does not exist, then calculate the first output range [CB1, CB2] and the second output range [DB1, DB2], where CB1 = XG1*AG1 + XG2*AG2, CB2 = XG1*BG1 + XG2*BG2, DB1 = XG1*AG3 + XG2*AG4, and DB2 = XG1*BG3 + XG2*BG4.
[0046] If the intersection of [CB1, CB2] and [DB1, DB2] exists, then the intersection is recorded as the final output range; otherwise, the weighted output range [CD1, CD2] is calculated, where CD1 = XQ1*CB1 + XQ2*DB1 and CD1 = XQ1*CB2 + XQ2*DB2; the weighted output range [CD1, CD2] is recorded as the final output range.
[0047] Select the k6th percentile from the final output range and denote it as the optimal output power. Adjust the laser power output of the laser displacement sensor to the optimal output power and obtain the displacement magnitude from the laser displacement sensor to the object under test to obtain the displacement measurement result.
[0048] Secondly, this application provides an electronic device including a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method described above are performed.
[0049] Thirdly, this application provides a storage medium on which a computer program is stored, which, when executed by a processor, performs the steps of the method described above.
[0050] The beneficial effects of this invention are as follows: This invention acquires the basic parameter information of a laser displacement sensor and collects displacement measurement data of the object under test under different light intensities and different output light powers, which are recorded as initial displacement measurement data; based on the initial displacement measurement data, a first preprocessing is performed to obtain the basic displacement measurement data of the laser displacement sensor; based on the basic displacement measurement data, the optimal output range under different light intensities is obtained and recorded as reference light output data; based on the reference light output data, the output light power of the laser displacement sensor is adjusted in real time to obtain the displacement measurement result; during displacement measurement, the laser power output by the laser displacement sensor can be accurately and dynamically adjusted according to the distance of the object under test and the light intensity, ensuring the measurement accuracy of the sensor in different usage scenarios;
[0051] This invention determines the error anomaly range by dynamically identifying the k2 and k3 percentiles of the second displacement error sequence, which is more adaptable to data fluctuation characteristics compared to a fixed threshold. It also calculates the trend entropy using the sign frequency distribution of adjacent error differences to identify abrupt changes that violate the sequence trend, overcoming the insensitivity of traditional quantile methods to trend reversals and improving the accuracy of anomaly identification. The error range is dynamically expanded based on the displacement measurement accuracy AE, ensuring that the selected optical power range not only meets the minimum error requirement but also guarantees accuracy redundancy during actual measurement. When multiple reference ranges intersect, the intersection is directly selected as the final range, ensuring that the optical power simultaneously meets the dual constraints of displacement and illumination. If there is no intersection, a weighted calculation is used to synthesize the range, balancing the needs of different operating conditions and avoiding adjustment failures caused by extreme values. Attached Figure Description
[0052] Figure 1 This is a flowchart illustrating the steps of the method of the present invention;
[0053] Figure 2 This is a flowchart for obtaining the error anomaly range of the present invention;
[0054] Figure 3 This is a flowchart illustrating the process of obtaining the optimal output range for this invention.
[0055] Figure 4 This is a schematic diagram of the electronic device of the present invention. Detailed Implementation
[0056] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0057] Example 2, please refer to Figure 1 As shown, this application provides a displacement measurement method using a laser displacement sensor, comprising the following steps:
[0058] Step S1 involves acquiring the basic parameter information of the laser displacement sensor and collecting displacement measurement data of the object under test under different light intensities and different output light powers, which are recorded as the initial displacement measurement data. Step S1 includes the following sub-steps:
[0059] Step S101: Obtain the range of laser power that the laser emitting unit of the laser displacement sensor can output, denoted as the initial output optical power range [LP, UP]; clarify the physical boundary of the adjustable optical power of the sensor to provide a benchmark for subsequent test point selection; obtain the minimum light intensity LG and maximum light intensity UG of the environment in which the laser displacement sensor is used; denot [LG, UG] as the initial light intensity range; quantify the dynamic range of ambient light interference to make the test conditions closer to the real application scenario; for example, the ambient light in the workshop may be between 1000-10000 lux, and the test needs to cover this range.
[0060] Step S102: Obtain the measurement range and measurement accuracy of the laser displacement sensor, denoted as displacement measurement range [LX, UX] and displacement measurement accuracy AE, respectively; and denote the object to be measured as the object to be measured; clarify the range boundary and accuracy requirements of the sensor to guide the distribution density of the test displacement points;
[0061] Step S103: Set the initial optical power interval to A1. Select multiple test optical power points evenly from the initial output optical power range according to A1, and record them as test optical power points 1-n in order of size. A1 can be set according to the actual application scenario, but it should not be too large. Equal interval sampling can simplify subsequent data analysis and avoid the omission of patterns caused by sparse sampling.
[0062] Step S104: Set the initial light intensity interval to A2, and select multiple test light intensity points evenly from the initial light intensity range according to A2. Record them as test temperature points 1-m in order of size. A2 can be set according to the actual application scenario.
[0063] Step S105: Select multiple measurement displacements uniformly within the displacement measurement range [LX, UX] and record them as test displacements; record any test displacement as the first test displacement DX0; record any test light intensity point as the first test light intensity, covering the entire range to verify the measurement performance at different distances and avoid blind spots caused by testing only in the middle range; for example, take 20 points in the range 0-100mm to analyze the difference in optical power between the far field and the near field;
[0064] Step S106: Make the actual displacement of the object to be measured to the laser displacement sensor the first test displacement, and place it in an environment with a light intensity of the first test light intensity. Adjust the output light power of the laser displacement sensor to test light power points 1-n in sequence, and read the displacement of the object to be measured from the laser displacement sensor corresponding to each test light power point; obtain the second displacement measurement data corresponding to the first test light intensity.
[0065] Step S107: Keep the actual displacement of the object to be tested to the laser displacement sensor unchanged, and repeatedly collect displacement measurement data of all test light intensity points corresponding to the first test displacement to obtain the first displacement measurement data of the first test displacement.
[0066] Step S108: Repeatedly collect displacement measurement data corresponding to all test displacements to obtain initial displacement measurement data;
[0067] In practice, too low optical power will result in weak reflected signals, while too high power may saturate the detector. The superposition of ambient light and reflected light will affect the detector signal, and different displacements will lead to differences in light intensity attenuation. All of these will affect the measurement accuracy of the laser displacement sensor. Therefore, by sampling and testing at equal intervals, a complete dataset is formed to provide sufficient samples for subsequent global optimization.
[0068] Step S2 involves performing a first preprocessing step based on the initial displacement measurement data to obtain the basic displacement measurement data of the laser displacement sensor. Step S2 includes the following sub-steps:
[0069] Step S201: For the displacement measurement data of any test light intensity point corresponding to the first test displacement in the initial displacement measurement data, arrange them in ascending order according to the magnitude of the corresponding test light power point, and record them as the first displacement measurement sequence.
[0070] Step S202: Calculate the displacement error between the magnitude of each displacement in the first displacement measurement sequence and the first test displacement DX0 according to the first formula, to obtain the first displacement error sequence. The first formula is as follows: WC i WX represents the error between the magnitude of the i-th displacement in the first displacement measurement sequence and the first test displacement DX0. i This represents the magnitude of the i-th displacement in the first displacement measurement sequence; as the output optical power increases, the error usually shows a pattern of first decreasing and then increasing, for example, insufficient signal at low output power and saturation at high output power;
[0071] For step S203, please refer to... Figure 2 As shown, any error in the first displacement error sequence is denoted as the first error WC. iThe k1 nearest errors located on one side of the first error are obtained and arranged together with the first error in ascending order, denoted as the second displacement error sequence, where k1 is the set number; in this embodiment, k1 is 10. By focusing on the local correlation of errors through the nearest k1 errors, the global statistics are avoided from masking local patterns. For example, if the error at a certain point suddenly increases, but the neighboring errors are all stable, it can be determined as an isolated anomaly. The optical power is arranged in ascending order, and the error sequence naturally has directional dependence. The points taken on one side only contain historical data in the order of increasing optical power, forming a causal relationship with the current point, which can improve the accuracy of anomaly identification.
[0072] Step S204: Obtain the k2th and k3th percentiles of the second displacement error sequence, and denote them as WB1 and WB2 respectively; calculate QR, QR = WB2 - WB1; denote [WB1 - k4 * QR, WB2 + k4 * QR] as the first error WC. i The error anomaly range is defined; where k2 and k3 are set percentiles, and k4 is a set proportional coefficient; the error anomaly range of all errors in the first displacement error sequence is repeatedly obtained; in this embodiment, k2=25, k3=25, k4=2.5; the positional distance of the quantiles is used to dynamically adapt to data fluctuations, which is more robust than a fixed threshold; for example, when the noise is high, the QR increases, the anomaly range automatically expands, and the false positives are reduced; when the noise is low, the QR narrows, and the anomaly sensitivity is improved;
[0073] Step S205: Calculate the adjacent error difference of each error in the first displacement error sequence according to the second formula to obtain the error difference sequence. The second formula is as follows: Where CFi represents the adjacent error difference of WCi; for the first data in the error difference sequence, such as WC1, its corresponding WC0 does not exist, so WC0 can be set to 0 to ensure the integrity of the results; this facilitates the analysis of the error change trend when the optical power increases.
[0074] Step S206: Extract the sign factor of each error difference in the error difference sequence and arrange them in the corresponding order as the first sign sequence, where the sign factor of a negative sign is denoted as -1, the sign factor of a positive sign is denoted as 1, and the sign factor of 0 is denoted as 0; for example, if an error difference is -0.03, then the sign factor is -1.
[0075] Step S207: For any error difference in the error difference sequence, denoted as the first difference CFi, obtain the k1 nearest error differences located on one side of the first difference and arrange them together with the first difference in the corresponding order, denoted as the first difference sequence; obtain the first symbol sequence corresponding to the first difference sequence, denoted as the second coincidence sequence; calculate the probability distribution of -1, 1 and 0 in the second coincidence sequence respectively, and denoted as f(-1), f(1) and f(0) respectively in order; for example, if there are 10 data in the second coincidence sequence, of which there are 5 -1, 2 0 and 3 1, then f(-1) = 5 / 10, f(1) = 3 / 10, f(0) = 2 / 10;
[0076] Step S208: Calculate the trend entropy CH corresponding to the first difference according to the third formula. i The third formula is as follows: Repeatedly calculate the trend entropy corresponding to all error differences in the error difference sequence, and denote it as the first trend entropy set. Calculate the mean and standard deviation of the trend entropy set, and denote them as PH1 and PH2 in order. Denote [PH1-k5*PH2, PH1+k5*PH2] as the trend entropy anomaly range of the first trend entropy set, where k5 is the set proportional coefficient.
[0077] Low entropy indicates a concentrated distribution of symbols, such as all +1s, showing a regular trend; high entropy indicates chaotic symbols, such as alternating ±1s, showing an abnormal trend. For example, when optical power increases normally, the error should decrease monotonically, with the symbol sequence mostly being -1s and the entropy close to 0; if +1 symbols appear, the entropy increases, suggesting possible lag in optical power adjustment or environmental interference. This complements the error magnitude screening and can detect hidden anomalies where the absolute value of the error is not large but the trend is chaotic.
[0078] Step S209: For any displacement magnitude in the first displacement measurement sequence, denoted as the first displacement magnitude WX. i If the first displacement size WX i Corresponding error WC i It does not belong to the corresponding error anomaly range, or the corresponding trend entropy CH i If it does not belong to the corresponding trend entropy anomaly range, then mark the first displacement size WX. i If the data is abnormal, it is marked as normal data; at the same time, anomalies are filtered based on error magnitude and trend pattern to reduce missed detections from a single dimension; for example, if the error at a certain point is within the normal range but the trend entropy is extremely high, it may be a hidden anomaly caused by a temporary sensor malfunction.
[0079] Step S210: Repeatedly mark all displacement magnitudes in the initial displacement measurement data; for displacement magnitudes marked as abnormal data, re-acquire and replace them, and mark them again, until there are no abnormal data in the initial displacement measurement data. After completion, the basic displacement measurement data is obtained.
[0080] In practical implementation, the k2 and k3 percentiles of the second displacement error sequence and the dynamically determined error anomaly range are more adaptable to data fluctuation characteristics than fixed thresholds. For example, when the error distribution broadens due to changes in ambient light, QR automatically expands the threshold range to reduce misjudgments. Furthermore, by using the symbol frequency distribution of adjacent error differences to calculate trend entropy, abrupt changes that violate the sequence trend can be identified, such as a sudden jump in error when optical power increases. This compensates for the insensitivity of traditional quantile methods to trend reversals, improves the accuracy of anomaly identification, and provides accurate reference data for subsequent processing.
[0081] Step S3: Obtain the optimal output range under different illumination intensities based on the basic displacement measurement data, and record it as the reference light output data; Step S3 includes the following sub-steps:
[0082] Step S301: For each displacement magnitude of the basic displacement measurement data, calculate the displacement error between each displacement magnitude and the first test displacement DX0 using the first formula, and take the absolute value. After completion, the basic displacement error data is obtained. The measurement values under different displacements, light intensities, and light power are converted into relative errors for easy comparison later.
[0083] Step S302: For any test light intensity point corresponding to the first test displacement in the basic displacement error data, it is denoted as the first light intensity. For all displacement errors under the first light intensity, they are arranged in ascending order according to the magnitude of the corresponding test light power points and denoted as the first basic error sequence.
[0084] For step S303, please refer to [link / reference]. Figure 3 As shown, if the first basic error sequence has more than one minimum value, then consecutive adjacent minimum values are denoted as the minimum set. The part of the minimum set with the most minimum values corresponding to the first basic error sequence is obtained and denoted as the minimum error sequence. When the optical power changes continuously, the minimum error value is usually continuously distributed. The set of consecutive minimum values is more in line with the actual physical laws and avoids misjudgment of discrete minimum values caused by noise. When there is more than one minimum value, a single independent minimum value may be caused by random noise, while the reliability of multiple consecutive minimum values is higher.
[0085] Step S304: Obtain the range of the minimum error sequence, denoted as the first error range [RA1, RA2], and calculate the second error range [RB1, RB2], where RB1 = RA1 - AE / 2 and RB1 = RA1 + AE / 2; Obtain the test optical power points corresponding to all displacement errors in [RB1, RB2] in the first basic error sequence, denoted as the first optical output set, and obtain the range of the first optical output set, marked as the optimal output range of the first light intensity; Considering the random errors present in actual measurements, expand the range based on the measurement accuracy AE to ensure that the error remains within the allowable range after optical power adjustment;
[0086] Step S305: If the first basic error sequence has only one minimum value, then the minimum value is denoted as RA0, and the third error range [RC1, RC2] is calculated, where RC1 = RA0 - AE / 2, RC2 = RA0 + AE / 2; all test optical power points corresponding to the displacement errors in [RC1, RC2] in the first basic error sequence are taken and denoted as the first optical output set, and the size of the range of the first optical output set is obtained and marked as the optimal output range of the first optical intensity; having only one minimum value is generally due to the error continuously increasing or decreasing as the output optical power increases;
[0087] Step S306: Repeatedly acquire the optimal output range of all test light intensity points corresponding to all test displacements of the basic displacement measurement data, and record it as the reference light output data.
[0088] In the specific implementation process, the measurement accuracy AE defines the maximum allowable error range of the laser displacement sensor, and the first error range and RA0 are extended based on the measurement accuracy AE; a precision redundancy design is provided for optical power adjustment to ensure that sufficient buffer space is reserved on the basis of theoretical error to cope with the impact of non-ideal factors such as environmental fluctuations and hardware response delays.
[0089] Step S4 involves adjusting the output optical power of the laser displacement sensor in real time based on the reference light output data, and obtaining the displacement measurement result. Step S4 includes the following sub-steps:
[0090] Step S401: When the laser displacement sensor measures the object to be measured, the displacement magnitude from the laser displacement sensor to the object to be measured is obtained once and recorded as the coarse displacement magnitude CX0. At the same time, the ambient light intensity is obtained and recorded as the actual light intensity SL0. The core parameters we need in the current scene are obtained through rapid measurement. The coarse displacement CX0 is used to determine the displacement of the object to be measured from the sensor, and the real-time light intensity SL0 is used to evaluate the ambient light interference intensity.
[0091] Step S402: Obtain the two test displacements closest to CX0, and denot them as the first reference displacement FX1 and the second reference displacement FX2 in ascending order; obtain the two test light intensity points closest to SL0, and denot them as the first reference light intensity FG1 and the second reference light intensity FG2 in ascending order; map the current actual parameters CX0 and SL0 to the basic displacement measurement data, and ensure that the current actual working condition is covered by the test scene by selecting four neighboring reference points, so as to provide quantifiable boundary conditions for subsequent interval weighted calculation;
[0092] Step S403: Obtain the optimal output ranges corresponding to FX1-FG1, FX1-FG2, FX2-FG1 and FX2-FG2 from the reference light output data, and denot them in order as the first range [AG1, BG1], the second range [AG2, BG2], the third range [AG3, BG3] and the fourth range [AG4, BG4];
[0093] Step S404: Calculate the first displacement weight XQ1, the second displacement weight XQ2, the first light intensity weight XG1, and the second light intensity weight XG2, respectively, where XQ1 = |FX2 - CX0| / |FX2 - FX1|, XQ2 = |FX1 - CX0| / |FX2 - FX1|, XG1 = |FG2 - SL0| / |FG2 - FG1|, XG2 = |FG2 - SL0| / |FG2 - FG1|; Assign weights inversely proportional to the distance between the current operating condition and the reference point to quantify the impact of "operating condition proximity" on optical power adjustment; the weight coefficients convert geometric distance into adjustment contribution, making optical power adjustment closer to actual operating conditions;
[0094] Step S405: If the intersection of [AG1, BG1], [AG2, BG2], [AG3, BG3] and [AG4, BG4] exists, then the intersection is recorded as the final output range; the pre-stored reliable interval is used first to ensure the accuracy and reliability of the adjustment result; the existence of the intersection means that the optimal optical power intervals of multiple adjacent operating conditions coincide, reflecting that the optical power adjustment of the current operating condition has a clear solution, avoiding complex calculations;
[0095] Step S406: If the intersection of [AG1, BG1], [AG2, BG2], [AG3, BG3], and [AG4, BG4] does not exist, then calculate the first output range [CB1, CB2] and the second output range [DB1, DB2], where CB1 = XG1*AG1 + XG2*AG2, CB2 = XG1*BG1 + XG2*BG2, DB1 = XG1*AG3 + XG2*AG4, and DB2 = XG1*BG3 + XG2*BG4; the neighboring intervals of the light intensity dimension are merged according to weights to solve the interval dispersion problem caused by light intensity fluctuations and maintain the continuity of the adjustment strategy.
[0096] Step S407: If the intersection of [CB1, CB2] and [DB1, DB2] exists, then the intersection is recorded as the final output range; otherwise, the weighted output range [CD1, CD2] is calculated, where CD1 = XQ1*CB1 + XQ2*DB1 and CD1 = XQ1*CB2 + XQ2*DB2; the weighted output range [CD1, CD2] is recorded as the final output range; if the light intensity synthesis interval still has no intersection, the final interval is further synthesized through displacement weights XQ1 and XQ2 to achieve dual weight fusion of displacement and light intensity dimensions; ensuring that no matter how the operating conditions fluctuate, an effective light power interval can be generated through weighted calculation to avoid adjustment failure;
[0097] Step S408: Select the k6th percentile from the final output range and record it as the optimal output power. Adjust the laser power output of the laser displacement sensor to the optimal output power and obtain the displacement magnitude of the laser displacement sensor to the object under test to obtain the displacement measurement result; in this embodiment, k6 is 25.
[0098] In practical implementation, when selecting the optimal output power from the final output range, it is generally advisable to select a point with lower power to reduce the resource consumption of the laser displacement sensor while ensuring accuracy requirements. Selecting a smaller percentile rather than a minimum value is to balance accuracy requirements, resource consumption, and hardware adjustment resolution.
[0099] Example 2: This application also provides a displacement measurement device for a laser displacement sensor, including a displacement data acquisition module, a preprocessing module, an analysis module, and a control module; the displacement data acquisition module, preprocessing module, analysis module, and control module execute the steps of a displacement measurement method for a laser displacement sensor.
[0100] Specifically, the displacement data acquisition module is used to acquire the basic parameter information of the laser displacement sensor and collect the displacement measurement data of the object under test under different light intensities and different output light powers, which are recorded as the initial displacement measurement data.
[0101] The preprocessing module is used to perform the first preprocessing based on the initial displacement measurement data to obtain the basic displacement measurement data of the laser displacement sensor;
[0102] The analysis module is used to obtain the optimal output range under different illumination intensities based on the basic displacement measurement data, which is recorded as the reference light output data;
[0103] The control module is used to adjust the output optical power of the laser displacement sensor in real time based on the reference light output data and obtain the displacement measurement results.
[0104] Example 3, please refer to Figure 4As shown, Figure 4 A schematic diagram of an electronic device is provided, which may include a processor, a communication interface, a memory, and a communication bus. The processor, communication interface, and memory communicate with each other via the communication bus. The memory stores computer-readable instructions, and the processor can call these instructions. When the processor executes a computer-readable instruction, it performs steps as described in a displacement measurement method for a laser displacement sensor to achieve the following functions: acquiring basic parameter information of the laser displacement sensor and collecting displacement measurement data of the object under different light intensities and output light powers, recorded as initial displacement measurement data; performing a first preprocessing based on the initial displacement measurement data to obtain basic displacement measurement data of the laser displacement sensor; obtaining the optimal output range under different light intensities based on the basic displacement measurement data, recorded as reference light output data; and adjusting the output light power of the laser displacement sensor in real time based on the reference light output data to obtain the displacement measurement result.
[0105] Furthermore, when the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0106] Example 4: This application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it performs the steps of the displacement measurement method for a laser displacement sensor described above to achieve the following functions: acquiring basic parameter information of the laser displacement sensor, and collecting displacement measurement data of the object under test under different light intensities and different output light powers, which are recorded as initial displacement measurement data; performing a first preprocessing based on the initial displacement measurement data to obtain basic displacement measurement data of the laser displacement sensor; obtaining the optimal output range under different light intensities based on the basic displacement measurement data, which is recorded as reference light output data; adjusting the output light power of the laser displacement sensor in real time based on the reference light output data, and obtaining the displacement measurement result.
[0107] Based on the above description of the embodiments, the embodiments of the present invention can be provided as methods, systems, or computer program products. Based on this understanding, the above technical solutions, in essence or in terms of their contribution to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or certain parts of the embodiments.
[0108] In the embodiments provided in this application, it should be understood that the disclosed system or method can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of modules or units is only a logical functional division, and there may be other division methods in actual implementation. Furthermore, multiple modules or units may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the coupling or direct coupling or communication connection shown or discussed may be through some communication interfaces. The indirect coupling or communication connection between systems, modules, and units may be electrical, mechanical, or other forms.
[0109] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A displacement measurement method of a laser displacement sensor, characterized by, The method comprises the following steps: Obtaining basic parameter information of the laser displacement sensor, and collecting displacement measurement data of the laser displacement sensor on the object to be measured under different light intensities and different output light powers, denoted as initial displacement measurement data; Based on the initial displacement measurement data, first preprocessing is performed to obtain basic displacement measurement data of the laser displacement sensor; According to the basic displacement measurement data, the optimal output range under different light intensities is obtained, denoted as reference light output data; Based on the reference light output data, the output light power of the laser displacement sensor is adjusted in real time, and displacement measurement results are obtained; Obtaining basic parameter information of the laser displacement sensor, and collecting displacement measurement data of the laser displacement sensor on the object to be measured under different light intensities and different output light powers, denoted as initial displacement measurement data comprises the following sub-steps: Obtaining the laser power range that can be output by the laser emitting unit of the laser displacement sensor, denoted as the initial output light power range [LP, UP]; obtaining the minimum light intensity LG and the maximum light intensity UG of the environment in which the laser displacement sensor is used; and denoting [LG, UG] as the initial light intensity range; Obtaining the measurement range and the measurement accuracy of the laser displacement sensor, denoted as the displacement measurement range [LX, UX] and the displacement measurement accuracy AE respectively; and denoting the object to be measured as the object to be measured; Setting the initial light power interval as A1, and uniformly selecting a plurality of test light power points from the initial output light power range according to A1, denoted as test light power points 1-n in order of size; Setting the initial light intensity interval as A2, and uniformly selecting a plurality of test light intensity points from the initial light intensity range according to A2, denoted as test temperature points 1-m in order of size; Obtaining basic parameter information of the laser displacement sensor, and collecting displacement measurement data of the laser displacement sensor on the object to be measured under different light intensities and different output light powers, denoted as initial displacement measurement data further comprises the following sub-steps: Uniformly selecting a plurality of measurement displacements from the displacement measurement range [LX, UX], denoted as test displacements; for any one test displacement, denoted as a first test displacement DX0; and for any one test light intensity point, denoted as a first test light intensity, The real displacement size of the object to be measured to the laser displacement sensor is the first test displacement, and the object to be measured is placed in an environment with a light intensity of the first test light intensity; the output light power of the laser displacement sensor is adjusted to be the test light power points 1-n in turn, and the displacement size of the object to be measured corresponding to each test light power point is read by the laser displacement sensor; the second displacement measurement data corresponding to the first test light intensity is obtained; The real displacement size of the object to be measured to the laser displacement sensor is kept unchanged, and the displacement measurement data of all test light intensity points corresponding to the first test displacement is repeatedly collected to obtain the first displacement measurement data of the first test displacement; All test displacement measurement data is repeatedly collected to obtain the initial displacement measurement data; Based on the initial displacement measurement data, first preprocessing is performed to obtain basic displacement measurement data of the laser displacement sensor, which comprises the following sub-steps: For the displacement measurement data of any one test light intensity point corresponding to the first test displacement in the initial displacement measurement data, according to the size of the corresponding test light power point, arrange in order from small to large, and mark as the first displacement measurement sequence; calculate the displacement error of each displacement size in the first displacement measurement sequence and the first test displacement DX0 according to the first formula, obtain the first displacement error sequence, and the first formula is as follows: Wherein, WC i represents the error of the i th displacement size in the first displacement measurement sequence and the first test displacement DX0, WX i represents the i th displacement size in the first displacement measurement sequence; For any one error in the first displacement error sequence, denoted as the first error WC i , the k1 errors closest to the first error on one side are obtained and arranged in ascending order together with the first error, denoted as the second displacement error sequence, wherein k1 is the number of settings; Obtaining the k2th percentile and the k3th percentile of the second displacement error sequence, denoted as WB1 and WB2 in order; calculating QR, QR=WB2-WB1; taking [WB1-k4*QR, WB2+k4*QR] as the error abnormal range of the first error WC i ; wherein k2 and k3 are the set percentiles, and k4 is the set proportion coefficient; repeating the error abnormal range of all errors in the first displacement error sequence.
2. The displacement measurement method of a laser displacement sensor according to claim 1, wherein The first preprocessing based on the first displacement measurement data to obtain the basic displacement measurement data of the laser displacement sensor further includes the following sub-steps: The adjacent error difference of each error in the first displacement error sequence is calculated according to a second formula to obtain an error difference sequence, and the second formula is as follows: wherein CFi represents the adjacent error difference of WCi. Extract the sign factor of each error difference in the error difference sequence, and arrange them in corresponding order as a first sign sequence, wherein the sign factor of negative sign is-1, the sign factor of positive sign is 1, and the sign factor of 0 is 0; For any error difference in the error difference sequence, denoted as the first difference CFi, the k1 error differences located on the first difference side are obtained, and arranged in corresponding order together with the first difference, denoted as a first difference sequence; Obtain the part of the first sign sequence corresponding to the first difference sequence, denoted as a second sign sequence; and respectively count the probability distribution of-1, 1 and 0 in the second sign sequence, and sequentially denote them as f(-1), f(1) and f(0). According to the third formula, the trend entropy CH corresponding to the first difference is calculated i , the third formula is as follows: ; all the trend entropies corresponding to the error difference pairs in the error difference sequence are repeatedly calculated, recorded as a first trend entropy set, the average value and the standard deviation of the trend entropy set are calculated, recorded as PH1 and PH2 in sequence respectively, and [PH1-k5*PH2, PH1+k5*PH2] is recorded as the trend entropy anomaly range of the first trend entropy set, wherein k5 is a set proportion coefficient; For any displacement magnitude in the first displacement measurement sequence, let it be denoted as the first displacement magnitude WX. i If the first displacement size WX i Corresponding error WC i It does not belong to the corresponding error anomaly range, or the corresponding trend entropy CH i If it does not belong to the corresponding trend entropy anomaly range, then mark the first displacement size WX. i If the data is abnormal, it is marked as normal data. Repeat the marking of all displacement sizes in the initial displacement measurement data; for the displacement size marked as abnormal data, perform re-collection replacement and re-marking until there is no abnormal data in the initial displacement measurement data, and the basic displacement measurement data is obtained after completion.
3. The displacement measurement method of a laser displacement sensor according to claim 2, wherein According to the basic displacement measurement data, the best output range under different light intensities is obtained, denoted as reference light output data, which includes the following sub-steps: For each displacement size of the basic displacement measurement data, the displacement error of each displacement size and the first test displacement DX0 is calculated by using the first formula, and the absolute value is taken, and the basic displacement error data is obtained after completion; For any test light intensity point corresponding to the first test displacement in the basic displacement error data, denoted as the first light intensity, for all displacement errors under the first light intensity, according to the size of the corresponding test light power point, arrange them in order from small to large, denoted as a first basic error sequence; If there is more than one minimum value in the first basic error sequence, the minimum value of the continuous adjacent minimum value is denoted as a minimum set, and the part of the first basic error sequence corresponding to the minimum set with the most minimum values is denoted as a minimum error sequence; Obtain the range size of the minimum error sequence, denoted as a first error range [RA1, RA2], calculate a second error range [RB1, RB2], wherein RB1=RA1-AE / 2, RB1=RA1+AE / 2; obtain the test light power point corresponding to the displacement error in the first basic error sequence which is in [RB1, RB2], denoted as a first light output set, and obtain the range size of the first light output set, denoted as the best output range of the first light intensity.
4. The displacement measurement method of a laser displacement sensor according to claim 3, wherein According to the basic displacement measurement data, the best output range under different light intensities is obtained, denoted as reference light output data, which further includes the following sub-steps: If the first basic error sequence has only one minimum value, the minimum value is denoted as RA0, and a third error range [RC1, RC2] is calculated, wherein RC1=RA0-AE / 2, RC2=RA0+AE / 2; all test light power points corresponding to the displacement error in the first basic error sequence which is in [RC1, RC2] are taken, denoted as a first light output set, and the range size of the first light output set is obtained, denoted as the best output range of the first light intensity. The best output range of all the test light intensity points corresponding to all the test displacements of the basic displacement measurement data is repeatedly obtained, and is recorded as reference light output data.
5. The displacement measurement method of a laser displacement sensor according to claim 4, wherein The output light power of the laser displacement sensor is adjusted in real time based on the reference light output data, and a displacement measurement result is obtained, including the following sub-steps: When the laser displacement sensor measures the object to be measured, the displacement size of the laser displacement sensor to the object to be measured is obtained once, which is recorded as a rough displacement size CX0, and the light intensity of the environment is obtained, which is recorded as an actual light intensity SL0; The two test displacements closest to CX0 are obtained, which are recorded as a first reference displacement FX1 and a second reference displacement FX2 in order of small to large, respectively; and the two test light intensity points closest to SL0 are obtained, which are recorded as a first reference light intensity FG1 and a second reference light intensity FG2 in order of small to large, respectively; The best output ranges corresponding to FX1-FG1, FX1-FG2, FX2-FG1 and FX2-FG2 are obtained from the reference light output data, which are recorded as a first range [AG1, BG1], a second range [AG2, BG2], a third range [AG3, BG3] and a fourth range [AG4, BG4] in order, respectively; The first displacement weight XQ1, the second displacement weight XQ2, the first light intensity weight XG1 and the second light intensity weight XG2 are calculated, wherein XQ1=|FX2-CX0| / |FX2-FX1|, XQ2=|FX1-CX0| / |FX2-FX1|, XG1=|FG2-SL0| / |FG2-FG1|, XG1=|FG2-SL0| / |FG2-FG1|; If the intersection of [AG1, BG1], [AG2, BG2], [AG3, BG3] and [AG4, BG4] exists, the intersection is recorded as the final output range; If the intersection of [AG1, BG1], [AG2, BG2], [AG3, BG3] and [AG4, BG4] does not exist, the first output range [CB1, CB2] and the second output range [DB1, DB2] are calculated, wherein CB1=XG1*AG1+XG2*AG2, CB2=XG1*BG1+XG2*BG2, DB1=XG1*AG3+XG2*AG4, DB2=XG1*BG3+XG2*BG4; If the intersection of [CB1, CB2] and [DB1, DB2] exists, the intersection is recorded as the final output range, otherwise the weighted output range [CD1, CD2] is calculated, wherein CD1=XQ1*CB1+XQ2*DB1, CD1=XQ1*CB2+XQ2*DB2; the weighted output range [CD1, CD2] is recorded as the final output range; The k6th percentile is selected from the final output range, which is recorded as the best output power, the output laser power of the laser displacement sensor is adjusted to the best output power, and the displacement size of the laser displacement sensor to the object to be measured is obtained to obtain a displacement measurement result.
6. An electronic device, comprising: A computer program product comprising a processor and a memory storing computer readable instructions which, when executed by the processor, perform the steps of the method of any of claims 1-5.
7. A storage medium having stored thereon a computer program, characterized in that The computer program, when executed by a processor, performs the steps of the method of any of claims 1-5.
Citation Information
Patent Citations
Method and device for correcting spatial accuracy
DE102018221657A1
Automated 360-degree dense point object inspection
WO2020223594A2