Sensor automatic deviation correction method, device, equipment, medium and program product
Patent Information
- Application Number
- CN202611186258.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-06
- Publication Date
- 2026-09-04
AI Technical Summary
[0004]有鉴于此,本发明提供了一种传感器自动纠偏方法、装置、设备、介质及程序产品,以解决长期零点漂移的问题
将所述空载候选采集数据作为所述零点候选样本。
Smart Images

Figure CN122689028A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of precision measurement technology, specifically to automatic sensor correction methods, devices, equipment, media, and program products. Background Technology
[0002] During long-term use, the sensor may experience zero-point shift due to factors such as fatigue of the elastic diaphragm or aging of the reference electrode, resulting in inaccurate detection output values.
[0003] In related technologies, the analog acquisition system for load measurement in industrial continuous production lines adheres to the old zero-point data at startup. When the equipment heats up and the temperature rises or the strain gauges creep, the startup zero point and the actual no-load zero point are no longer consistent. However, the system is still using the old zero-point data, which leads to the continuous accumulation of static errors and serious long-term zero-point drift, making it completely unable to meet the requirements for long-term stable use of precision measurement. Summary of the Invention
[0004] In view of this, the present invention provides a method, apparatus, device, medium and program product for automatic sensor correction to solve the problem of long-term zero-point drift.
[0005] In a first aspect, the present invention provides an automatic sensor correction method, which involves receiving raw sampling samples from a sensor to be tested during a data acquisition period; filtering the raw sampling samples to obtain several sets of unloaded samples from the sensor to be tested under unloaded conditions; determining the current zero-point offset based on the several sets of unloaded samples; and determining a target zero-point offset based on the current zero-point offset and the pre-acquired raw zero-point offset, wherein the target zero-point offset is used to correct the data acquisition results of the sensor to be tested.
[0006] By selecting unloaded samples from the original sampling samples, the current zero-point offset is determined using these unloaded samples. Instead of relying on the original zero-point offset at the factory or when the device is powered on, the device automatically captures unloaded samples during idle intervals during operation. This enables the automatic tracking of changes in the zero point caused by temperature variations or aging of the strain gauge adhesive layer, ensuring that the zero point is always synchronized with the actual unloaded state of the physical world. This fundamentally solves the long-term baseline drift problem.
[0007] In one optional implementation, the step of filtering the original sampled samples to obtain several sets of unloaded samples in the unloaded state of the sensor to be debugged includes: The original sampled samples are screened to obtain zero-point candidate samples; The zero-point candidate samples are purified to obtain empty samples.
[0008] While ensuring the purity of the final empty sample, computational efficiency was optimized. The initial screening stage is based on single-frame amplitude features, with simple calculation logic and fast processing speed, capable of quickly filtering out the largest proportion of invalid data from massive amounts of raw data. The fine screening stage only performs calculations on the candidate samples retained after the initial screening. Since the amount of candidate sample data has been significantly reduced, even the use of computationally intensive window statistics and feature parameter comparison will not affect real-time performance. The two-stage screening provides a clear division of labor in terms of judgment granularity and computational complexity, enabling the entire screening process to run efficiently in resource-constrained embedded systems.
[0009] In one optional implementation, the step of filtering the original sampled samples to obtain zero-point candidate samples includes: The original sampled data is classified to obtain idle candidate acquisition data and the idle candidate acquisition data is used as zero-point candidate samples. The idle candidate acquisition data is sample data whose amplitude falls within the preset idle interval and whose absolute value of single-frame amplitude change is less than the preset sudden change threshold and whose amplitude fluctuation range is less than the preset steady-state fluctuation threshold. The empty candidate data is used as the zero-point candidate sample.
[0010] The continuous multi-frame condition in the impact judgment can distinguish between mechanical impacts lasting for a certain period of time and single-point random noise, avoiding overreaction to isolated noise spikes. The fixed-point shielding method in the power frequency judgment does not require complex frequency domain operations such as Fourier transforms; shielding only needs to be performed at a specific sampling time to achieve the effect of suppressing power supply crosstalk. The continuous exceedance condition in the load judgment prevents misjudgment caused by normal signal fluctuations, and the shielding of the entire sample data within a time period ensures that all data in the dynamic process are not mistakenly treated as no load, especially preventing the signal from being incorrectly adopted when it accidentally crosses zero during the rise or fall. The triple condition of the no-load judgment simultaneously constrains the samples from three time scales: absolute position of amplitude, instantaneous rate of change, and short-term fluctuation range. Only data that meets the steady-state characteristics at all three time scales can enter the candidate set, ensuring that the candidate samples have high reliability in both the amplitude domain and the time domain.
[0011] In an optional implementation, the method further includes: after determining the zero-point target offset, performing a difference operation between the detection value obtained at any time and the zero-point target offset to obtain the target detection value.
[0012] The interpolation operation allows the value of all preceding filtering, statistical, and fusion calculations to be directly reflected in the final output data. Only one subtraction operation is required per sample, resulting in extremely short computation latency and no additional overhead as the sampling rate increases, making it suitable for real-time execution in embedded systems for each sampling period. Since the zero-point target offset involved in the interpolation operation is itself a stable value that has undergone multi-level filtering to eliminate interference, averaging to suppress noise, and weighted averaging to smooth changes, the corrected target detection value will not experience abnormal fluctuations due to occasional jumps in a single sample value. This ensures that all data output by the sensor during long-term operation automatically eliminates the influence of the zero-point offset, and the user or backend receives only the corrected, accurate measurement value without any additional post-processing correction.
[0013] In one optional implementation, determining the current zero-point offset based on the plurality of sets of unloaded samples includes: The mean value was calculated for several groups of unloaded samples. The average value after mean-averaging is used as the current real-time zero offset.
[0014] When averaging using n sets of unloaded samples, the estimation accuracy increases with the square root of the number of sample sets. This means that the estimation accuracy of the zero-point offset can be continuously improved by increasing the number of effective unloaded samples within the sampling period. Furthermore, since the samples input to the averaging operation have already undergone initial screening and purification, they do not contain deterministic interferences such as shock mutations, power frequency noise, and load data. Therefore, the averaging process only deals with zero-mean random noise components, further ensuring the accuracy of the estimation results.
[0015] In one optional implementation, purifying the zero-point candidate samples to obtain empty samples includes: Obtain multiple time windows corresponding to the zero-point candidate samples obtained after purification; Target time windows that meet preset feature parameter conditions are selected from the multiple time windows; Zero-point candidate samples are extracted from the target time window as the empty samples.
[0016] The purification mechanism using time windows and feature parameters effectively prevents unqualified data from candidate samples in the time dimension from being mixed into the final zero-point offset calculation. Specifically, if the sensor signal is in a slow drift process, such as a continuous unidirectional movement of the zero point due to gradual temperature changes, although the instantaneous amplitude of each sampling point may fall within the idle amplitude range, the difference between the maximum and minimum values within the window will inevitably exceed the steady-state fluctuation threshold, or the mean amplitude within the window will deviate too much from the idle center value. These unqualified feature parameters will cause the entire window to be discarded, thus preventing data during the drift process from being mistakenly taken as stable idle samples. The division and independent evaluation of multiple time windows ensure that the finally adopted idle samples come from different target time windows and are evenly distributed on the time axis, avoiding the representativeness bias that may be caused by all samples being concentrated in a certain time window. The qualification judgment of each time window is independent; the failure of one time window does not affect the adoption of other time windows, ensuring that enough effective idle samples can still be extracted even in the presence of occasional local interference.
[0017] In one optional implementation, determining the target zero-point offset based on the current zero-point offset and the pre-acquired original zero-point offset includes: The current zero offset is averaged with the original zero offset. The weighted average value is used as the zero-point target offset.
[0018] Weighted averaging fusion achieves a unified approach to slow drift tracking and fast interference suppression. If the sensor experiences slow zero-point drift due to temperature changes or component aging, the weighted averaging result can follow this drift trend with a certain lag, ensuring that the correction amount remains synchronized with the sensor's current actual zero-point drift state, since the current zero-point offset reflects the actual offset state of the current period. If, within a certain acquisition period, occasional vibrations, electromagnetic pulses, or other instantaneous disturbances cause the current zero-point offset to be abnormally large or small, the target offset will not immediately follow the abnormal value and change drastically, ensuring the continuity and stability of the correction output, because the original zero-point offset still participates in the fusion with a weight of (1-w).
[0019] Secondly, the present invention provides an automatic sensor correction device, the device comprising: The receiving module is used to receive the raw sampling samples of the sensor to be debugged during the acquisition period; The filtering module is used to filter the original sampled samples to obtain several sets of unloaded samples in the unloaded state of the sensor to be debugged. The first determining module is used to determine the current zero-point offset based on the plurality of sets of empty samples; The second determining module is used to determine the zero-point target offset based on the current zero-point offset and the pre-acquired original zero-point offset. The zero-point target offset is used to perform correction processing on the acquisition results of the sensor to be debugged.
[0020] Thirdly, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the sensor automatic correction method of the first aspect or any corresponding embodiment described above.
[0021] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to perform the sensor automatic correction method of the first aspect or any corresponding embodiment described above.
[0022] Fifthly, the present invention provides a computer program product, including computer instructions for causing a computer to execute the sensor automatic correction method of the first aspect or any corresponding embodiment described above. Attached Figure Description
[0023] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0024] Figure 1 This is a schematic flowchart of an automatic sensor correction method according to an embodiment of the present invention; Figure 2 This is a schematic flowchart of another automatic sensor correction method according to an embodiment of the present invention; Figure 3 This is a flowchart illustrating another automatic sensor correction method according to an embodiment of the present invention; Figure 4 This is a structural block diagram of an automatic sensor correction device according to an embodiment of the present invention; Figure 5 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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, 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.
[0026] The sensors mentioned in the automatic correction method for sensors in this invention embodiment can be torque sensors, force sensors, and pressure sensors, etc. Torque sensors are commonly used in robotics, traditional industries, and the automotive and transportation sectors, and their accuracy is crucial in precision measurement.
[0027] According to an embodiment of the present invention, an embodiment of an automatic sensor correction method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0028] This embodiment provides an automatic sensor correction method, which can be used in a microprocessor built into the sensor or a host computer connected to the sensor. Figure 1 This is a flowchart of an automatic sensor correction method according to an embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps: Step S101: Receive the original sampling samples of the sensor to be debugged during the acquisition period.
[0029] Within a preset acquisition period, raw digital signals from sensors, such as torque sensors and load cells, are continuously received. These raw samples are the most direct analog-to-digital conversion values or physical dimension values from the sensors without any processing. They contain real signals but are also mixed with a large amount of unwanted noise, such as mechanical vibration, electromagnetic interference, and load fluctuations.
[0030] In practical applications, temperature drift is a slowly varying signal with a frequency typically between 0.01Hz and 0.1Hz, meaning it changes every few seconds to a few minutes. Therefore, the acquisition period used to generate the correction signal can be set between 5 seconds and 30 minutes, and can be selected according to the actual working conditions. No limitation is made here.
[0031] Step S102: Filter the original sampling samples to obtain several sets of unloaded samples in the unloaded state of the sensor to be debugged.
[0032] After filtering the original samples, several sets of data that best represent the true location of the sensor's current physical zero point are retained, namely, the unloaded samples.
[0033] Step S103: Determine the current zero-point offset based on the aforementioned sets of unloaded samples.
[0034] After screening, several sets of unloaded samples are used as the basis for calculating the current zero-point offset. In the actual calculation process, the values of all the screened unloaded samples can be added together and divided by the number of samples to obtain an average value. Other calculation methods can also be used without restriction.
[0035] Step S104: Determine the target zero-point offset based on the current zero-point offset and the pre-acquired original zero-point offset. The target zero-point offset is used to correct the acquisition results of the sensor to be debugged.
[0036] Specifically, the original zero-point offset provides the calculation baseline, while the current zero-point offset provides effective tracking of the zero-point offset trend during use. The weighted sum of the two filters out sudden spikes and keeps up with slow drifts.
[0037] The target zero-point offset is determined by combining the calculated current zero-point offset with the original zero-point offset to prevent drastic data jumps due to unexpected interference within a single acquisition cycle and to maintain stability.
[0038] During each acquisition cycle, raw sampling samples are continuously received from the sensor under test. These samples are digital signal sequences output by the sensor in normal operating condition. These raw sampling samples are filtered to extract several sets of valid samples from the sensor in an unloaded state. The unloaded state refers to the state where the sensor is not subjected to any input of the measured physical quantity. Based on the extracted sets of unloaded samples, statistical calculations are performed to determine the zero-point offset of the sensor at the current moment. The calculated current zero-point offset is combined with the pre-stored raw zero-point offset to determine the final target zero-point offset. This target zero-point offset is used to correct all subsequent detection values acquired by the sensor in real time. The entire method is executed cyclically within the acquisition cycle, enabling the sensor's zero-point calibration state to be dynamically updated according to environmental changes and device aging.
[0039] The automatic sensor correction method provided in this embodiment can automatically update the zero-point offset during continuous operation without manual intervention or periodic shutdown for calibration. The screening step effectively removes contaminated samples that affect the zero-point estimation, and the averaging process suppresses the influence of random noise on the offset calculation. The comprehensive calculation of the current value and historical values prevents sudden changes in offset caused by single occasional interference, so that the sensor can still output stable and accurate detection values under complex working conditions with temperature drift, time drift and random interference.
[0040] This embodiment provides an automatic sensor correction method, which can be used in a microprocessor built into the sensor or a host computer connected to the sensor. Figure 2 This is a flowchart of an automatic sensor correction method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps: Step S201: Receive the raw sampling samples from the sensor to be debugged during the acquisition period. For details, please refer to [link to relevant documentation]. Figure 1 Step S101 of the illustrated embodiment will not be described again here.
[0041] Step S202: The original sampled samples are screened to obtain several sets of unloaded samples in the unloaded state of the sensor to be debugged.
[0042] Specifically, step S202 includes: Step S2021: Screen the original sampled samples to obtain zero-point candidate samples.
[0043] Using all collected raw samples as input, each sampling point or continuous sampling segment is classified. During the classification process, the data is divided into four categories: invalid data due to impact mutation, power frequency noise interference data, load shielding data, and no-load candidate acquisition data. The first three categories of data are directly discarded, and only the no-load candidate acquisition data is output as zero-point candidate samples. The granularity of the initial screening stage is mainly based on the amplitude characteristics of single-frame sampling values or continuous short frames, which requires less computation and can quickly process large amounts of raw data.
[0044] Step S2022: Purify the zero-point candidate sample to obtain an empty sample.
[0045] Using the zero-point candidate samples output from the initial screening stage as input, these samples are divided into multiple consecutive time windows in chronological order. Within each time window, a set of preset feature parameter values are calculated, including but not limited to the mean amplitude, amplitude fluctuation range, maximum single-frame change, and cumulative duration of slope exceeding limits. The feature parameter values of each window are compared one by one with preset threshold conditions, and only samples from windows where all feature parameters simultaneously meet the conditions are selected as the final empty sample output. The output of the initial screening stage serves as the zero-point candidate samples, which also act as the input for the fine screening stage. These two sub-steps are executed sequentially to form a complete screening pipeline.
[0046] While ensuring the purity of the final empty sample, computational efficiency was optimized. The initial screening stage is based on single-frame or short-term amplitude features, with simple computational logic and fast processing speed, capable of quickly filtering out the three largest categories of invalid data from massive amounts of raw data. The fine screening stage only performs calculations on the candidate samples retained after the initial screening. Since the amount of candidate sample data has been significantly reduced, even the use of computationally intensive window statistics and feature parameter comparison will not affect real-time performance. The two-stage screening provides a clear division of labor in terms of judgment granularity and computational complexity, enabling the entire screening process to run efficiently in resource-constrained embedded systems.
[0047] In some optional implementations, step S2021 above includes: Step a1: The original sampled data is categorized into impact mutation invalid data, power frequency noise interference data, load shielding data, and no-load candidate acquisition data.
[0048] Step a2: Use the empty candidate data as the zero-point candidate sample.
[0049] The invalid data for shock mutations are data in which the magnitude of the mutation in a single frame or multiple consecutive frames of sampled values exceeds a preset mutation threshold. The power frequency noise interference data are sampling points at the target sampling frequency; The load shielding data refers to sample data within a period when the sampling amplitude deviates from the preset no-load range and the signal change slope continuously exceeds the preset slope threshold. The idle candidate acquisition data are sample data whose amplitude falls within the preset idle interval, whose absolute value of the amplitude change in a single frame is less than the preset mutation threshold, and whose amplitude fluctuation range is less than the preset steady-state fluctuation threshold.
[0050] The specific method for determining invalid data due to impulse mutations is as follows: The absolute value of the difference between the current amplitude and the amplitude of the previous sampling point is calculated in real time. If this difference exceeds a preset mutation threshold, the current sampling point is marked as a single-frame mutation; if multiple consecutive sampling points exceed the mutation threshold, it is marked as a continuous multi-frame mutation. Both single-frame and continuous multi-frame mutations are classified as invalid data due to impulse mutations and are removed. The specific method for determining power frequency noise interference data is as follows: The sampling point number corresponding to the power frequency and its harmonics is calculated based on the power frequency (50Hz or 60Hz) and the current sampling rate. When the sampling counter reaches these specific numbers, the sampling point is marked as a sampling point at the target sampling frequency and is removed. The specific method for determining load shielding data is as follows: First, it is determined whether the current sampling amplitude deviates from the preset no-load interval. If it does, it is further determined whether the signal change slope continuously exceeds the preset slope threshold. Continuous exceedance means that the change rate of multiple consecutive sampling points is greater than the threshold. Once the continuous exceedance condition is met, all samples within the entire time period from the first time the slope exceeds the threshold to the last time it exceeds the threshold are shielded. The specific method for determining the candidate data to be collected under no-load conditions is as follows: the sampling point is checked for three conditions at the same time. The first condition is whether the sampling amplitude falls within the preset no-load interval. The second condition is whether the absolute value of the difference between the current sampling point and the previous sampling point is less than the preset mutation threshold. The third condition is whether the difference between the maximum and minimum amplitude values within the observation window to which the current sampling point belongs is less than the preset steady-state fluctuation threshold. Only when all three conditions are met is the sampling point included in the candidate data to be collected under no-load conditions.
[0051] Specifically, in this embodiment of the invention, the preset no-load interval is an absolute numerical range used to determine whether the current sensor is under no effective load. It can typically be set to a symmetrical interval near zero. For example, for a dynamic torque sensor with a range of 50 N·m, the preset no-load interval is ±0.5 N·m. The preset abrupt change threshold represents the upper limit of the change amplitude, used to measure whether the numerical jump of the current sampling point relative to the previous sampling point is too large; it can be set to 2.5 N·m. The preset steady-state fluctuation threshold represents the upper limit of the range within a continuous time window, measuring the overall dispersion of the signal within a time window; it can be set to 0.15 N·m. In practical applications, these settings can also be adjusted according to actual working conditions; no restrictions are imposed here.
[0052] The quantization judgment rules in this embodiment enable the entire data classification process to be driven entirely by preset digital thresholds, achieving automation, standardization, and reproducibility of the screening process. The continuous multi-frame condition in the impact judgment can distinguish between mechanical impacts lasting for a certain period and single-point random noise, avoiding overreaction to isolated noise spikes. The fixed-point shielding method in the power frequency judgment does not require complex frequency domain operations such as Fourier transforms; shielding only needs to be performed at specific sampling moments to suppress power crosstalk. The continuous exceedance condition in the load judgment prevents misjudgments caused by normal signal fluctuations, and the full-segment shielding of sample data within a time period ensures that all data in the dynamic process are not mistakenly treated as unloaded, especially preventing incorrect adoption when the signal accidentally crosses zero during rise or fall. The triple condition for unloaded judgment simultaneously constrains samples at three time scales: absolute amplitude position, instantaneous rate of change, and short-term fluctuation range. Only data that meets the steady-state characteristics at all three time scales can enter the candidate set, ensuring high reliability of candidate samples in both the amplitude and time domains.
[0053] When classifying each original sample, the criteria for each category are checked sequentially according to a preset judgment order. The criteria for invalid impulse mutation data is whether the amplitude of the sampled value's mutation in a single frame exceeds a preset mutation threshold; if so, it is classified into this category. The criteria for power frequency noise interference data is whether the current sampling time falls within a preset target sampling frequency point; if so, it is classified into this category. The criteria for load shielding data are whether the sampled amplitude deviates from a preset idle amplitude range and whether the signal change slope continuously exceeds a preset slope threshold; if both conditions are met, all samples within the corresponding time period are classified into this category. When a sample or sampling segment fails to be classified after all three categories, it is further checked whether it meets the conditions for idle candidate data, namely, whether the amplitude falls within a preset idle range, whether the single-frame change is less than a preset mutation threshold, and whether the amplitude fluctuation range is less than a preset steady-state fluctuation threshold. If all three conditions are met, the sample is classified into idle candidate data. After classifying all the original samples, all samples classified as empty candidate data are output as zero-point candidate samples, while samples classified as the first three categories are discarded and do not participate in any subsequent statistical calculations.
[0054] By classifying and screening, targeted elimination can be implemented for the three main sources of zero-point contamination: impact disturbances, power frequency crosstalk, and physical loads. Compared with methods relying solely on single amplitude threshold filtering, the screening accuracy of this invention is significantly improved. Impact mutation determination effectively distinguishes between real impacts and ordinary noise spikes through a dual condition of amplitude threshold and consecutive frame count. Power frequency noise determination achieves point-to-point shielding by locking specific sampling frequency points, suppressing power frequency interference in the digital domain without additional hardware filtering circuits. Load shielding determination, through a combination of amplitude deviation and slope continuously exceeding thresholds, can identify the complete dynamic change process of the sensor from no-load to loaded and from loaded to no-load, and shield all data in this process, preventing the signal from being mistakenly judged as no-load when it accidentally passes through zero during dynamic transitions. The no-load candidate acquisition data retained after triple elimination already possesses high purity before entering the subsequent purification and statistical stages.
[0055] In some optional implementations, step S2022 above includes: Step b1: Obtain multiple time windows corresponding to the zero-point candidate samples obtained after purification.
[0056] The zero-point candidate samples obtained in the initial screening stage are divided into multiple consecutive time windows according to the sampling time. Each time window covers a continuous time interval and includes all zero-point candidate samples within that interval.
[0057] Step b2: Select the target time window that meets the preset feature parameter conditions from the multiple time windows.
[0058] Quality assessment is performed independently for each time window. Within each time window, a set of preset characteristic parameters are calculated. These preset characteristic parameters include, but are not limited to, the deviation of the mean amplitude from the center value of the no-load sample within the window, the difference between the maximum and minimum values within the window, the maximum difference between adjacent sampling points within the window, and the cumulative duration of the rate of change exceeding the threshold within the window. The calculated characteristic parameter values are compared one by one with preset qualification conditions. Only when all characteristic parameters within a time window meet the qualification conditions are the zero-point candidate samples within that time window adopted as the final no-load samples. This time window is the target time window. If any characteristic parameter fails to meet the qualification conditions, all candidate samples within that time window are discarded.
[0059] Specifically, the no-load center value represents the theoretical true zero point of the sensor output when it is completely unaffected by the measured torque. The preset no-load interval is the range of allowable fluctuations. The center value is the benchmark used to correct measurement errors. Its value must fall within the preset no-load interval. Its calculation method can be the sample mean within any time window, that is, screening out N valid candidate points within the time window and then averaging the N sample torque values. Other methods can also be used, which are not limited here.
[0060] Step b3: Extract zero-point candidate samples from the target time window as the empty samples.
[0061] The zero-point candidate sample sequence is divided into multiple continuous and non-overlapping intervals with a fixed window length L (in terms of the number of sampling points). Each interval is a time window. The window length L is a preset value, which is usually an integer multiple of the sampling frequency. For example, if the sampling frequency is 1000Hz, the window length can be set to 100 sampling points, i.e., a time span of 100 milliseconds. The window length needs to be large enough to ensure that the calculation of various statistical characteristic parameters is statistically significant, but it should not be so large as to mask any short-term fluctuations that may exist within the window. For each time window, the following characteristic parameters are calculated: the average amplitude of all sampling points within the time window, the difference between the maximum and minimum values within the time window, the maximum absolute value of the difference between any two adjacent sampling points within the time window, and the percentage of sampling points whose rate of change exceeds a preset slope threshold out of the total number of points in the window. Each of the above feature parameters is compared with its corresponding preset qualification criteria. If all criteria are met, the window is considered a qualified window, and all zero-point candidate samples within that window are marked as empty samples. If any feature parameter fails to meet the criteria, the window is considered an unqualified window, and all data within that window is discarded and not included in subsequent averaging. If multiple consecutive windows are all deemed qualified, empty samples are extracted from each qualified window. The samples extracted from all qualified windows together constitute several sets of empty samples for subsequent averaging.
[0062] Specifically, in an optional embodiment, continuing to use a dynamic torque sensor with a range of 50 N·m and a sampling rate of 1000 Hz, it is used to test the no-load torque of a car steering system. The acceptable conditions can be: average window amplitude -0.5 N·m ≤ average value ≤ 0.5 N·m; peak-to-peak value (maximum value - minimum value) ≤ 0.15 N·m; maximum adjacent difference (difference between adjacent points) ≤ 2.5 N·m; preset slope threshold of 2.5 N·m; and percentage of out-of-tolerance points within the window ≤ 5%. In practical applications, the acceptable conditions can be set according to actual engineering needs.
[0063] Step S203: Determine the current zero-point offset based on the aforementioned sets of unloaded samples.
[0064] Please see details Figure 1 Step S103 of the illustrated embodiment will not be described again here.
[0065] Step S204: Determine the target zero-point offset based on the current zero-point offset and the pre-acquired original zero-point offset. The target zero-point offset is used to correct the acquisition results of the sensor to be debugged.
[0066] Please see details Figure 1 Step S104 of the illustrated embodiment will not be described again here.
[0067] The automatic sensor correction method provided in this embodiment effectively prevents unqualified data from candidate samples in the time dimension from being mixed into the final zero-point offset calculation through a purification mechanism using time windows and feature parameters. Specifically, if the sensor signal is in a slow drift process, such as a continuous unidirectional movement of the zero point due to gradual temperature changes, although the instantaneous amplitude of each sampling point may fall within the idle amplitude range, the difference between the maximum and minimum values within the window will inevitably exceed the steady-state fluctuation threshold, or the mean amplitude within the window will deviate too much from the idle center value. These unqualified feature parameters will cause the entire window to be discarded, thus preventing data during the drift process from being mistakenly taken as stable idle samples. The division and independent evaluation of multiple time windows ensure that the finally adopted idle samples come from different time periods and are evenly distributed on the time axis, avoiding the representativeness bias that may be caused by all samples being concentrated in a specific time period. The qualification judgment of each time window is independent; the failure of one time window does not affect the adoption of other time windows, ensuring that sufficient effective idle samples can still be extracted even in the presence of occasional local interference.
[0068] This embodiment provides an automatic sensor correction method, which can be used in a microprocessor built into the sensor or a host computer connected to the sensor. Figure 3 This is a flowchart of an automatic sensor correction method according to an embodiment of the present invention, such as... Figure 3 As shown, the process includes the following steps: Step S301: Receive the original sampling samples of the sensor to be debugged during the acquisition period.
[0069] Please see details Figure 2 Step S201 of the illustrated embodiment will not be described again here.
[0070] Step S302: Filter the original sampling samples to obtain several sets of unloaded samples in the unloaded state of the sensor to be debugged.
[0071] Please see details Figure 2Step S202 of the illustrated embodiment will not be described again here.
[0072] Step S303: Determine the current zero-point offset based on the aforementioned sets of unloaded samples.
[0073] Specifically, step S303 includes: Step S3031: Average the data from several groups of unloaded samples. The system performs mean-averaging on several groups of unloaded samples obtained through the aforementioned screening and purification steps. This involves summing the amplitude values of each group and dividing by the total number of groups to calculate the arithmetic mean. This mean is directly used as the real-time zero-point offset for the current acquisition period. The statistical principle behind this mean-averaging is that the random noise component in the sensor's unloaded output signal has a statistical mean of zero over a sufficient number of samples. Therefore, the average of multiple groups of samples approximates the true zero-point offset value; the more groups of samples, the higher the estimation accuracy.
[0074] The specific method for averaging can be to count the total number of empty sample groups retained after two-stage screening and time window purification, denoted as n. For each empty sample group, its amplitude can be expressed as the average of the amplitudes of each sampling point within the group or the median value of the group within the time window. The specific value can be preset according to the sensor type. The amplitudes of the n empty sample groups are summed, and then the sum is divided by n. The quotient is the current real-time zero offset of the acquisition cycle. If the number of empty sample groups retained after screening in a certain acquisition cycle is less than the preset minimum requirement, one of the following processing methods can be adopted: use the current zero offset of the previous acquisition cycle, increase the acquisition cycle length to obtain more samples, or use existing samples to calculate the average and mark the result as having low confidence.
[0075] Step S3032: Use the average value after mean-averaging as the current real-time zero offset.
[0076] Mean averaging is one of the mature and computationally minimal random noise suppression techniques in engineering. It requires no complex digital filtering algorithms, is easy to implement, and offers good real-time performance. When averaging using n sets of unloaded samples, the estimation accuracy increases with the square root of the number of sample sets. This means that the estimation accuracy of the zero-point offset can be continuously improved by increasing the number of effective unloaded samples within the sampling period. Furthermore, since the samples input to the mean averaging operation have already undergone initial screening and purification, they do not contain deterministic interferences such as shock mutations, power frequency noise, and load data. Therefore, the mean averaging process only deals with zero-mean random noise components, further ensuring the accuracy of the estimation results.
[0077] Step S304: determining a target zero offset according to the current zero offset and a pre-acquired original zero offset, where the target zero offset is used for correcting the collection result of the sensor to be debugged.
[0078] The above step S304 comprises: Step S3041: performing weighted averaging on the current zero offset and the original zero offset; weighted average fusion is performed on the current real-time original zero offset and the original zero offset pre-stored in a non-volatile memory, the fusion result is output and stored as the target zero offset of the current acquisition cycle. The weighted average adjusts the relative proportion of the current value and the historical value in the fusion result through a preset weight coefficient. When the weight coefficient favors the current value, the system responds faster but is easily interfered; when the weight coefficient favors the historical value, the system is smoother but tracks slower. The specific value of the preset weight coefficient can be determined according to the drift rate, noise level of the sensor and the stability requirements of the application scenario.
[0079] The specific calculation formula of weighted average is: Otarget =w×Ocurrent + (1-w) ×Ooriginal, wherein Otarget is the target zero offset output in the current acquisition cycle, w is a preset weight coefficient and the value range is 0<w<1, Ocurrent is the calculated current zero offset, and Ooriginal is the pre-stored original zero offset. The original zero offset is stored in the non-volatile memory. After the calculation of new Otarget is completed in each acquisition cycle, the value of Otarget can be selected to be written into the memory as Ooriginal of the next acquisition cycle, so as to realize recursive update of the offset; alternatively, Ooriginal can be kept as a fixed factory calibration value, and Otarget is only adjusted by the fluctuation of Ocurrent. The specific value of the preset weight coefficient w can be configured according to the application requirements of the sensor. When the working environment of the sensor changes drastically and the zero drift is fast, w can be set to a large value (such as 0.5 to 0.8) to enhance the tracking capability of the current state; when the working environment of the sensor is stable but there is occasional strong interference, w can be set to a small value (such as 0.1 to 0.3) to enhance the anti-interference and smoothing capability. During the first operation, if there is no valid original zero offset in the non-volatile memory, the Ocurrent calculated for the first time can be directly used as Otarget and stored in the memory as the initial reference value. The weighted average operation is executed once in each acquisition cycle, and the output result Otarget is used for difference calculation and as the historical reference of the next cycle at the same time.
[0080] Weighted averaging fusion achieves a unified approach to slow drift tracking and fast interference suppression. If the sensor experiences slow zero-point drift due to temperature changes or component aging, the weighted average result can follow this drift trend with a certain lag, ensuring that the correction amount remains synchronized with the sensor's current actual zero-drift state, since Ocurrent reflects the actual offset state of the current period. If Ocurrent is abnormally large or small due to occasional vibrations, electromagnetic pulses, or other instantaneous disturbances within a certain acquisition period, the target offset will not immediately follow the abnormal value and change drastically, ensuring the continuity and stability of the correction output, because Ooriginal still participates in the fusion with a weight of (1-w).
[0081] Step S3042: The weighted average value is used as the zero-point target offset.
[0082] Step S305: Perform a difference calculation between the detection value obtained at any time and the zero-point target offset to obtain the target detection value.
[0083] After calculating the zero-point target offset, this offset is applied to every subsequent measurement output of the sensor. Specifically, for the raw detection value acquired by the sensor at any sampling time, a difference operation is performed between it and the zero-point target offset; that is, the zero-point target offset is subtracted from the raw detection value, and the result is the corrected target detection value. This difference operation is performed in real time for each newly arrived detection value in each sampling period, ensuring that all sensor output data is presented to the user or subsequent processing stages only after the zero-point offset has been eliminated.
[0084] The automatic sensor correction method provided in this embodiment uses difference calculations to directly reflect the value of all preceding screening, statistical, and fusion calculations in the final output data. Only one subtraction operation is required per sampling, resulting in extremely short computation latency and no additional overhead as the sampling rate increases, making it suitable for real-time execution in embedded systems for each sampling period. Since the zero-point target offset involved in the difference calculation is itself a stable value that has undergone multi-level screening to eliminate interference, averaging to suppress noise, and weighted averaging to smooth changes, the corrected target detection value will not fluctuate abnormally due to occasional jumps in a single sampling value. This ensures that all data output by the sensor during long-term operation automatically eliminates the influence of zero-point offset, and the user or backend receives only the corrected and accurate measurement value without any additional post-processing correction.
[0085] This embodiment also provides an automatic sensor correction device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0086] This embodiment provides an automatic sensor correction device, such as... Figure 4 As shown, it includes: The receiving module 401 is used to receive the raw sampling samples of the sensor to be debugged during the acquisition period.
[0087] The filtering module 402 is used to filter the original sampling samples to obtain several sets of unloaded samples in the unloaded state of the sensor to be debugged.
[0088] The first determining module 403 is used to determine the current zero-point offset based on the plurality of sets of empty samples.
[0089] The second determining module 404 is used to determine the zero-point target offset based on the current zero-point offset and the pre-acquired original zero-point offset, wherein the zero-point target offset is used to perform correction processing on the acquisition results of the sensor to be debugged.
[0090] In some alternative implementations, the filtering module 402 includes: The filtering unit is used to classify the original sampled data to obtain idle candidate acquisition data and use the idle candidate acquisition data as zero-point candidate samples. The idle candidate acquisition data is sample data whose amplitude falls within a preset idle interval and whose absolute value of single-frame amplitude change is less than a preset mutation threshold and whose amplitude fluctuation range is less than a preset steady-state fluctuation threshold.
[0091] A purification unit is used to purify the zero-point candidate samples to obtain empty samples.
[0092] The purification unit includes: The sub-unit is used to obtain multiple time windows corresponding to the zero-point candidate samples obtained after purification. A filtering subunit is used to filter out target time windows that meet preset feature parameter conditions from the plurality of time windows; The selection sub-unit is used to extract zero-point candidate samples from the target time window as the empty samples.
[0093] In some alternative implementations, the first determining module 403 includes: The calculation unit is used to average several sets of unloaded samples; As a unit, it is used to take the average value after mean-averaging as the current real-time zero offset.
[0094] In some alternative implementations, the second determining module 404 includes: The weighted average unit is used to perform a weighted average of the current zero-point offset and the original zero-point offset using a preset weighting coefficient. The target determination unit is used to take the weighted average value as the zero-point target offset.
[0095] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.
[0096] In this embodiment, the automatic sensor correction device is presented in the form of a functional unit. Here, a unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0097] This invention also provides a computer device having the above-described features. Figure 4 The sensor automatic correction device shown is shown.
[0098] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 5 As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system).
[0099] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GPA), or any combination thereof.
[0100] The memory 20 stores instructions executable by at least one processor 10 to cause the at least one processor 10 to perform the method shown in the above embodiments.
[0101] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0102] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.
[0103] The computer device also includes an input device 30 and an output device 40. The processor 10, memory 20, input device 30, and output device 40 can be connected via a bus or other means. Figure 5 Taking the example of a connection between China and Israel via a bus.
[0104] Input device 30 can receive input numerical or character information, and generate key signal inputs related to user settings and function control of the computer device, such as a touchscreen, keypad, mouse, trackpad, touchpad, joystick, one or more mouse buttons, trackball, joystick, etc. Output device 40 may include display devices, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibration motors). The aforementioned display devices include, but are not limited to, liquid crystal displays, light-emitting diodes, displays, and plasma displays. In some alternative embodiments, the display device may be a touchscreen.
[0105] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.
[0106] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0107] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A method for automatic sensor correction, characterized in that, The method includes: During the acquisition period, receive the raw sampling samples from the sensor to be debugged; The original sampled samples are filtered to obtain several sets of unloaded samples of the sensor to be debugged under unloaded state; The current zero-point offset is determined based on the aforementioned sets of unloaded samples; The zero-point target offset is determined based on the current zero-point offset and the pre-acquired original zero-point offset. The zero-point target offset is used to correct the acquisition results of the sensor to be debugged.
2. The method according to claim 1, characterized in that, The process of filtering the original sampled samples to obtain several sets of unloaded samples of the sensor to be debugged under unloaded conditions includes: The original sampled data is classified to obtain idle candidate acquisition data and the idle candidate acquisition data is used as zero-point candidate samples. The idle candidate acquisition data is sample data whose amplitude falls within the preset idle interval and whose absolute value of single-frame amplitude change is less than the preset sudden change threshold and whose amplitude fluctuation range is less than the preset steady-state fluctuation threshold. The zero-point candidate samples are purified to obtain empty samples.
3. The method according to claim 1 or 2, characterized in that, Also includes: After determining the zero-point target offset, the difference between the detection value obtained at any time and the zero-point target offset is calculated to obtain the target detection value.
4. The method according to claim 1, characterized in that, The step of determining the current zero-point offset based on the plurality of sets of idle samples includes: The mean value was calculated for several groups of unloaded samples. Use the average value after mean-averaging as the current zero-point offset.
5. The method according to claim 2, characterized in that, The purification of the zero-point candidate samples to obtain empty samples includes: Obtain multiple time windows corresponding to the zero-point candidate samples obtained after purification; Target time windows that meet preset feature parameter conditions are selected from the multiple time windows; Zero-point candidate samples are extracted from the target time window as the empty samples.
6. The method according to claim 1, characterized in that, The step of determining the target zero-point offset based on the current zero-point offset and the pre-acquired original zero-point offset includes: The current zero offset is averaged with the original zero offset. The weighted average value is used as the zero-point target offset.
7. An automatic sensor correction device, characterized in that, The device includes: The receiving module is used to receive the raw sampling samples of the sensor to be debugged during the acquisition period; The filtering module is used to filter the original sampled samples to obtain several sets of unloaded samples in the unloaded state of the sensor to be debugged. The first determining module is used to determine the current zero-point offset based on the plurality of sets of empty samples; The second determining module is used to determine the zero-point target offset based on the current zero-point offset and the pre-acquired original zero-point offset. The zero-point target offset is used to perform correction processing on the acquisition results of the sensor to be debugged.
8. A computer device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the computer instructions to perform the sensor automatic correction method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the sensor automatic correction method according to any one of claims 1 to 6.
10. A computer program product, characterized in that, Includes computer instructions for causing a computer to perform the sensor automatic correction method according to any one of claims 1 to 6.