Angle error detection method and system based on photoelectric encoder
By actively simulating vibration conditions, synchronously acquiring signals and establishing an error model, and compensating for the angle error of the photoelectric encoder in real time, the problems of measurement reliability and repeatability under vibration environment are solved, and the measurement accuracy of the photoelectric encoder is improved.
Patent Information
- Application Number
- CN202511839089.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-08
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies are insufficient to effectively address the random or systematic errors caused by vibration sources in photoelectric encoders under vibration environments, leading to reduced measurement repeatability and reliability, which has become a bottleneck for improving the accuracy of high-end equipment.
By actively simulating real vibration conditions, the system synchronously collects the original angle signal, standard angle signal, and vibration signal from the photoelectric encoder, establishes an error model, acquires the current angle signal and vibration signal in real time, determines and compensates for real-time angle errors, and outputs accurate angle values.
This improved the repeatability and reliability of photoelectric encoder measurements in vibration environments, enabled online real-time error compensation, and enhanced measurement accuracy.
Smart Images

Figure CN121954081A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of encoder error detection technology, and in particular to a method and system for detecting angle error based on a photoelectric encoder. Background Technology
[0002] Optical encoders are critical angle and position sensors in industrial automation, robotics, aerospace, and other fields. While their static accuracy is typically high, in practical applications, vibrations from sources such as motors and gearboxes are transmitted to the encoder through the mechanical structure. This causes relative micro-motion between the internal code disk and the read head, changes in bearing stress, and electronic signal interference, resulting in random or systematic errors in the output angle signal. These dynamic errors severely reduce the repeatability and reliability of measurements, representing a bottleneck in improving the accuracy of high-end equipment.
[0003] Therefore, there is an urgent need in this field for a method that can actively simulate real vibration conditions to improve the repeatability and reliability of measurements. Summary of the Invention
[0004] To address the aforementioned issues, this application provides a method and system for detecting angle errors based on a photoelectric encoder.
[0005] On the one hand, the angle error detection method for a photoelectric encoder provided in this application adopts the following technical solution: A method for detecting angle error of a photoelectric encoder includes the following steps: Acquire the original angle signal, standard angle signal, and vibration signal of the photoelectric encoder synchronously under vibration conditions; The instantaneous angle error is determined based on the standard angle signal and the original angle signal; Based on the vibration signal and the instantaneous angle error, an error model describing the mapping relationship from vibration to angle error is established; The current angle signal and current vibration signal of the photoelectric encoder are acquired in real time. Based on the current vibration signal and the error model, determine the real-time angle error compensation value; The current angle signal is compensated using the real-time angle error compensation value to output an accurate angle value.
[0006] Optionally, it also includes a step for updating the error model: Obtain a validation dataset synchronously acquired under the new vibration environment; Based on the validation dataset, calculate the residual after compensation by the error model; If the residual exceeds a preset threshold, the error model is updated using the validation dataset. Optionally, the conditions for triggering the online model update phase are: The time since the last model update has reached a preset duration; and / or, The difference between the spectral characteristics of the current vibration signal and the spectral characteristics of the vibration signal used in the model training phase exceeds a preset range; and / or, When performing periodic verification using the aforementioned angle reference unit, it was found that the residual continuously increased.
[0007] Optionally, the step of establishing the error model includes: Feature extraction is performed on the vibration signal to obtain a multidimensional feature vector; Based on the multidimensional feature vector and the instantaneous angle error, a machine learning model is trained to form the error model.
[0008] Optionally, determining the real-time angle error compensation value based on the current vibration signal and the error model includes: Based on the multidimensional feature vector, pattern recognition is performed on the vibration environment to classify various typical working conditions. A dedicated error sub-model is established and stored for each of the typical operating conditions described. The current typical working condition is identified based on the real-time acquired vibration signal, and the corresponding error sub-model is called to determine the real-time angle error compensation value.
[0009] Optionally, the step of compensating the current angle signal using the real-time angle error compensation value adopts the following formula: θ comp =θ raw +α*Δθ; Where, θ comp For the precise angle value, θ raw Δθ is the current angle signal, Δθ is the real-time angle error compensation value, and α is the adaptive weighting coefficient dynamically adjusted based on the current vibration signal.
[0010] Optionally, the adaptive weighting coefficient α is determined by the following rule: when the amplitude of the current vibration signal is greater than a preset threshold or the signal-to-noise ratio is lower than a preset threshold, α is 1.0; otherwise, α is a value between 0.5 and 1.0.
[0011] Secondly, the photoelectric encoder angle error detection system provided in this application adopts the following technical solution: A photoelectric encoder angle error detection system, comprising: The signal acquisition module is used to acquire the original angle signal, standard angle signal and vibration signal of the photoelectric encoder synchronously collected under vibration conditions; An error calculation module is used to determine the instantaneous angle error based on the standard angle signal and the original angle signal; The model building module is used to build an error model describing the mapping relationship from vibration to angle error based on the vibration signal and the instantaneous angle error. The real-time signal acquisition module is used to acquire the current angle signal and current vibration signal of the photoelectric encoder in real time. The compensation value determination module is used to determine the real-time angle error compensation value based on the current vibration signal and the error model. The compensation module is used to compensate the current angle signal using the real-time angle error compensation value and output an accurate angle value.
[0012] Optionally, it also includes a model update module, the model update module comprising: The verification data acquisition unit is used to acquire the verification dataset synchronously collected under the new vibration environment; The residual calculation unit is used to calculate the residual after compensation by the error model based on the validation dataset; The model update unit is used to update the error model using the validation dataset when the residual exceeds a preset threshold.
[0013] Optionally, the model building module includes: The feature extraction unit is used to extract features from the vibration signal to obtain a multidimensional feature vector; The model training unit is used to train a machine learning model based on the multidimensional feature vector and the instantaneous angle error to form the error model.
[0014] In summary, this application includes at least one of the following beneficial technical effects: This application first acquires the original angle signal, standard angle signal, and vibration signal of the photoelectric encoder synchronously under vibration conditions; then, based on the standard angle signal and the original angle signal, it determines the instantaneous angle error; and based on the vibration signal and the instantaneous angle error, it establishes an error model describing the mapping relationship from vibration to angle error; it acquires the current angle signal and current vibration signal of the photoelectric encoder in real time; then, based on the current vibration signal and the error model, it determines the real-time angle error compensation value; finally, it uses the real-time angle error compensation value to compensate the current angle signal and outputs an accurate angle value. By actively introducing controllable vibration and simultaneously analyzing it to construct a dynamic error model, it actively simulates real vibration conditions, improving the repeatability and reliability of measurements. Attached Figure Description
[0015] Figure 1This is a flowchart illustrating an angle error detection method for an optical encoder according to Embodiment 1 of this application. Figure 2 This is a schematic diagram of the process of updating the error model in Embodiment 1 of this application; Figure 3 This is a structural block diagram of an angle error detection system for an optical encoder according to Embodiment 2 of this application. Detailed Implementation
[0016] 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 a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0017] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indication will also change accordingly.
[0018] In this invention, unless otherwise explicitly specified and limited, the terms "connection," "fixed," etc., should be interpreted broadly. For example, "fixed" can mean a fixed connection, a detachable connection, or an integral part; it can mean a mechanical connection or an electrical connection; it can mean a direct connection or an indirect connection through an intermediate medium; it can mean the internal communication of two components or the interaction between two components, unless otherwise explicitly limited. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0019] Furthermore, if the embodiments of this invention involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the meaning of "and / or" throughout the text includes three parallel solutions; for example, "A and / or B" includes solution A, solution B, or a solution where both A and B are satisfied simultaneously. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
[0020] Optical encoders are critical angle and position sensors in industrial automation, robotics, aerospace, and other fields. While their static accuracy is typically high, in practical applications, vibrations from sources such as motors and gearboxes are transmitted to the encoder through the mechanical structure. This causes relative micro-motion between the internal code disk and the read head, changes in bearing stress, and electronic signal interference, resulting in random or systematic errors in the output angle signal. These dynamic errors severely reduce the repeatability and reliability of measurements, representing a bottleneck in improving the accuracy of high-end equipment.
[0021] Current technologies for error compensation in photoelectric encoders primarily focus on static or quasi-static errors, such as subdivision errors and installation eccentricity errors. These methods are typically calibrated under vibration-free or minimal vibration conditions, making them ineffective in handling complex, time-varying dynamic vibration disturbances. While some studies have attempted to test encoder performance under vibration environments, these are mostly passive observations, lacking active and precise control of vibration conditions, as well as precise synchronous correlation analysis between vibration signals and angular error signals. Consequently, it is difficult to establish accurate causal models, resulting in limited compensation effects and weak universality.
[0022] Therefore, this application provides a technical solution that can actively simulate real vibration conditions, accurately establish the mapping relationship between vibration and angle error, and achieve online real-time compensation.
[0023] Example 1 This application discloses a method for detecting the angle error of an optical encoder.
[0024] Reference Figure 1 A method for detecting angle error of a photoelectric encoder, comprising the following steps: S101. Acquire the original angle signal, standard angle signal, and vibration signal of the photoelectric encoder synchronously collected under vibration conditions.
[0025] First, the signal acquisition module synchronously acquires three signals from the photoelectric encoder under vibration conditions: raw angle signal, standard angle signal, and vibration signal. The raw angle signal refers to the angle signal synchronously acquired when the photoelectric encoder under test is rotating and under controlled vibration. The standard angle signal is provided by an angle reference unit, which can be a high-precision circular grating, a laser angle interferometer, or a capacitive angle encoder. The vibration signal can be detected and acquired by a vibration sensing unit, which can be an accelerometer.
[0026] Vibration can be generated by a vibration excitation device installed in the system, which applies controllable mechanical vibration to the photoelectric encoder under test, and the drive mechanism in the system drives the photoelectric encoder under test to rotate. This puts the photoelectric encoder under test in a state of rotation and controlled vibration, and collects three types of signals.
[0027] Before installing and testing the photoelectric encoder, it should first be placed in a preset vibration environment. This vibration environment is typically generated by a vibration test bench or actual working equipment, simulating vibration conditions that may occur during actual operation. The vibration frequency, amplitude, and vibration mode (such as sine wave, pulse wave, or random vibration) of the vibration bench are set according to the actual application requirements. Generally, the vibration frequency range is 0.5 Hz to 100 Hz, and the vibration amplitude range is 0.1 g to 10 g, with the specific settings determined based on the working environment of the photoelectric encoder used.
[0028] To ensure signal synchronization, high-precision data acquisition equipment such as data acquisition cards, oscilloscopes, or high-speed acquisition modules are used, and the following steps are performed: The clock synchronization function of the data acquisition system ensures that the raw angle signal, standard angle signal, and vibration signal from the photoelectric encoder are acquired simultaneously and have a consistent time reference. The time accuracy of synchronous acquisition is typically required to be at the microsecond level to ensure time alignment between different signal sources. The acquisition frequency of each signal source should ensure accurate capture of the characteristics of the vibration signal while responding to changes in the raw angle of the photoelectric encoder. In a vibration environment, the acquisition system continuously or periodically collects these signal data, generating signal data streams. Each signal data stream includes a timestamp, acquired value, and relevant status information such as the angle of the photoelectric encoder and the amplitude of the vibration signal.
[0029] To ensure the quality and consistency of the acquired data, the data needs to be preprocessed after signal acquisition. A filter is used to denoise the vibration signals, and all acquired signal data are aligned by timestamps to ensure that each signal corresponds to the same vibration state at the same point in time. For data that is not fully synchronized, interpolation methods are used for time alignment to ensure that the original angle signal, standard angle signal, and vibration signal effectively correspond to the same time reference. Synchronously acquired signal data will be stored in a database or storage medium as the original data source for subsequent angle error calculation, error model establishment, and error compensation.
[0030] S102. Determine the instantaneous angle error based on the standard angle signal and the original angle signal.
[0031] The signal acquired in real time by the photoelectric encoder reflects the actual angle value of the encoder under vibration. This signal is affected by factors such as vibration, noise, and error. The angle signal provided by a known standard device or system is usually an ideal angle value, representing the accurate angle under conditions of no error or vibration. Then, by performing preprocessing such as noise reduction and time alignment on the acquired signal, the instantaneous angle error is obtained by calculating the difference between the standard angle signal and the original angle signal at the same moment.
[0032] S103. Based on the vibration signal and the instantaneous angle error, establish an error model describing the mapping relationship from vibration to angle error.
[0033] Optionally, the step of establishing the error model includes: Feature extraction is performed on the vibration signal to obtain a multidimensional feature vector; Based on the multidimensional feature vector and the instantaneous angle error, a machine learning model is trained to form the error model.
[0034] Specifically, a data window of fixed time length, such as length L, corresponding to N sampling points, is slid across the time series to extract multidimensional features from the vibration signal within the window, generating a feature vector F. The extracted features can include time-domain features, frequency-domain features, and time-frequency-domain features. Ultimately, for a given data window, a multidimensional feature vector F = [f1, f2, ..., f...] is obtained. d ]^T.
[0035] Then, data alignment is performed to ensure that each eigenvector F(t) is aligned with the average or a specific value Δθ of the instantaneous angle error within the same time window. error(t) Correspondingly, this constitutes a complete training sample (F(t), Δθ) error(t) ).
[0036] In one embodiment, the machine learning model can be a linear regression model or a random forest regression model. This embodiment uses a random forest regression model for training, and the model formula is as follows:
[0037] Where, Δθ error This indicates the predicted angle error. ) represents the output of the i-th tree model under input F.
[0038] The training process includes: randomly selecting T subsets of samples with replacement from the total training set. Then, constructing decision trees and training one decision tree for each subset. At each node of the tree, when splitting, a subset is randomly selected from the d features of the feature vector F, and the optimal splitting feature and split point are chosen to maximize the data purity (i.e., minimize the variance) of the child node. This process is repeated to build T decision trees, which together form the random forest model.
[0039] S104. Real-time acquisition of the current angle signal and current vibration signal of the photoelectric encoder.
[0040] The photoelectric encoder reads the current angle value, and the sensor of the photoelectric encoder generates a corresponding electrical signal according to the rotation angle. The vibration sensor is activated to monitor the vibration related to the photoelectric encoder. The vibration sensor detects the vibration changes of the equipment in real time through an accelerometer or other adapter, and converts the collected signal into a corresponding electrical signal.
[0041] S105. Determine the real-time angle error compensation value based on the current vibration signal and the error model; Optionally, determining the real-time angle error compensation value based on the current vibration signal and the error model includes: Based on the multidimensional feature vector, pattern recognition is performed on the vibration environment to classify various typical working conditions. A dedicated error sub-model is established and stored for each of the typical operating conditions described. The current typical working condition is identified based on the real-time acquired vibration signal, and the corresponding error sub-model is called to determine the real-time angle error compensation value.
[0042] In one specific embodiment, all vibration feature vectors collected during the training phase under extensive vibration conditions are first gathered. Unsupervised clustering algorithms, such as the K-means algorithm, are then used to cluster these feature vectors. The number of clusters K can be determined based on the actual data distribution, such as using the elbow method, for example, clustering into 3 classes.
[0043] Algorithm objective:
[0044] Sk is the set of the k-th cluster, and μk is the centroid of the k-th cluster, which is the average value of all eigenvectors Fi in the cluster.
[0045] After clustering, each cluster is defined as a typical working condition, such as: Cluster_1: high-frequency micro-vibration working condition, Cluster_2: low-frequency swaying working condition, Cluster_3: instantaneous impact working condition.
[0046] The steps for establishing the dedicated error sub-model include: The original training dataset is divided into K sub-datasets according to the cluster categories to which its vibration feature vectors belong.
[0047] For each subset of data, a dedicated error sub-model (SubModel_1, SubModel_2, ..., SubModel_K) is trained according to the method in Example 2. In this way, each sub-model specifically learns the mapping relationship between vibration and angular error under a specific vibration mode, making it more specialized.
[0048] All sub-models and their corresponding cluster centroids {μ1, μ2, ..., μ} K Store them to form a working condition-sub-model mapping library.
[0049] After the error sub-model is established, the real-time feature vector F is calculated. current Cluster centroid μ for each working condition k Euclidean distance: D k = ||F current - μ k ||. Select the working condition category k with the smallest distance as the current typical working condition. Then, based on the identified working condition k, call the corresponding dedicated error sub-model from the working condition-sub-model mapping library. When determining the real-time compensation value: F current The input is fed into a dedicated error sub-model, which then outputs the final real-time angle error compensation value Δθ. comp This value is a more accurate error compensation based on the prediction of the most relevant vibration mode.
[0050] This solution employs a collaborative approach, tailoring specific sub-models for each typical operating condition. This allows each sub-model to more deeply and accurately characterize the complex relationship between specific vibration characteristics and errors, thereby providing prediction accuracy far exceeding that of a single model within its respective area of expertise. This enhances the system's adaptability and robustness to complex time-varying vibration environments.
[0051] S106. The current angle signal is compensated using the real-time angle error compensation value, and an accurate angle value is output.
[0052] Optionally, the step of compensating the current angle signal using the real-time angle error compensation value adopts the following formula: θ comp =θ raw +α*Δθ; Where, θ comp For the precise angle value, θ raw Δθ is the current angle signal, Δθ is the real-time angle error compensation value, and α is the adaptive weighting coefficient dynamically adjusted based on the current vibration signal.
[0053] In one specific embodiment, the adaptive weighting coefficient α is determined by the following rule: when the amplitude of the current vibration signal is greater than a preset threshold or the signal-to-noise ratio is lower than a preset threshold, α is 1.0; otherwise, α is a value between 0.5 and 1.0.
[0054] This embodiment achieves intelligent compensation strategy by introducing a dynamically adjusted adaptive weight coefficient α, realizing intelligent on-demand allocation of compensation "strength" and achieving the best balance between accuracy and stability.
[0055] Optionally, refer to Figure 2 The method further includes a step for updating the error model: S201. Obtain the verification dataset synchronously collected under the new vibration environment; The system controls the vibration source or directly utilizes the new vibration environment to simultaneously acquire a new set of data within a short time window, such as 30 seconds. This dataset includes: the new raw angle signal θ. rawnew The new standard angle signal θ stdnew And the new vibration signal A new(t) This set of data constitutes the validation dataset.
[0056] S202. Based on the verification dataset, calculate the residual after compensation by the error model; Using the current error model, θ in the validation dataset is tested. raw_new Compensation is performed to obtain the angle after preliminary compensation; the residual sequence after compensation is calculated, and then the root mean square error (RMSE) of the residual sequence is calculated as a quantitative indicator to evaluate the model performance.
[0057] S203. If the residual exceeds a preset threshold, the error model is updated using the verification dataset.
[0058] The calculated residual RMSE is compared with a preset threshold (e.g., 1.5 times the initial model test residual, or an absolute accuracy threshold set according to the application scenario).
[0059] Decision: If RMSE > preset threshold, the current model is determined to no longer meet the accuracy requirements and needs to be updated.
[0060] Update operation: Use the newly collected validation dataset as new training samples to perform incremental learning or fine-tuning on the existing error model.
[0061] For linear models: new data can be combined with some old data, and the least squares problem can be solved again.
[0062] For random forest models: new data can be used to further train existing trees or grow new trees.
[0063] For neural network models: the network weights can be iteratively updated several times with new data using a small learning rate.
[0064] After the update is completed, the old model is replaced with the new model, and the triggering conditions (such as timers) are reset. The system continues to perform real-time compensation with the new model that has higher precision.
[0065] Optionally, the conditions for triggering the online model update phase are: The time since the last model update has reached a preset duration; and / or, The difference between the spectral characteristics of the current vibration signal and the spectral characteristics of the vibration signal used in the model training phase exceeds a preset range; and / or, When performing periodic verification using the aforementioned angle reference unit, it was found that the residual continuously increased.
[0066] In one embodiment, the system includes a timer. When the timer records that the time since the last successful model update has reached a preset duration (e.g., 24 hours, one week, or one work cycle), the update process is automatically triggered. Alternatively, the system calculates the spectral characteristics of the current vibration signal in real time and compares them with a benchmark template of the vibration signal spectral characteristics used during model training. The difference between the two is calculated, for example, the Euclidean distance or cosine similarity of the energy distribution of the main frequency bands. If the difference exceeds a preset range, for example, the Euclidean distance is greater than a threshold, it is determined that the current vibration environment has undergone a fundamental change, and the existing model may no longer be applicable, thus triggering an update. Alternatively, if permissible, for example, during periodic self-checks or when the equipment is idle, the angle reference unit can be reconnected for periodic verification. The system acquires a short segment of the new standard angle signal and the original angle signal and observes the residual after compensation by the current model. If the mean or variance of the residual is found to be continuously increasing, such as the residual increasing by more than 10% for three consecutive verification cycles compared to the previous one, it directly proves that the model performance is degrading, and an update is immediately triggered.
[0067] By employing multimodal intelligent triggering conditions, the system optimizes update timing while balancing efficiency and resource consumption. This update mechanism also reduces the stringent requirements for the completeness of initial training data. Even if the user initially fails to cover all vibration modes, the system can automatically discover new operating conditions and supplement its learning in subsequent use.
[0068] Example 2 Reference Figure 3 This application also discloses a photoelectric encoder angle error detection system, the system comprising hardware infrastructure and software modules, the hardware system comprising: The drive mechanism is used to drive the photoelectric encoder under test to rotate. A vibration excitation device is used to apply controllable mechanical vibration to the photoelectric encoder under test, and can be a vibration test bench.
[0069] An angle reference unit is used to provide a standard angle signal with a higher accuracy than the photoelectric encoder under test. The angle reference unit is a high-precision circular grating, a laser angle interferometer, or a capacitive angle encoder.
[0070] A vibration sensing unit is used to detect the vibration signal received by the photoelectric encoder under test; the vibration sensing unit is a triaxial accelerometer installed near the housing or bearing of the photoelectric encoder under test.
[0071] A synchronous data acquisition unit is connected to the photoelectric encoder under test, the angle reference unit, and the vibration sensing unit for synchronously acquiring the original angle signal, the standard angle signal, and the vibration signal of the photoelectric encoder under test. The synchronous data acquisition unit is a data acquisition card with multi-channel synchronous sampling function and a sampling rate of not less than 50 kS / s.
[0072] The software module includes: The signal acquisition module is used to acquire the original angle signal, standard angle signal and vibration signal of the photoelectric encoder synchronously collected under vibration conditions; An error calculation module is used to determine the instantaneous angle error based on the standard angle signal and the original angle signal; The model building module is used to build an error model describing the mapping relationship from vibration to angle error based on the vibration signal and the instantaneous angle error. The real-time signal acquisition module is used to acquire the current angle signal and current vibration signal of the photoelectric encoder in real time. The compensation value determination module is used to determine the real-time angle error compensation value based on the current vibration signal and the error model. The compensation module is used to compensate the current angle signal using the real-time angle error compensation value and output an accurate angle value.
[0073] Optionally, the model update module includes: The verification data acquisition unit is used to acquire the verification dataset synchronously collected under the new vibration environment; The residual calculation unit is used to calculate the residual after compensation by the error model based on the validation dataset; The model update unit is used to update the error model using the validation dataset when the residual exceeds a preset threshold.
[0074] Optionally, the model building module includes: The feature extraction unit is used to extract features from the vibration signal to obtain a multidimensional feature vector; The model training unit is used to train a machine learning model based on the multidimensional feature vector and the instantaneous angle error to form the error model.
[0075] Through the collaborative work of the above modules, this system achieves: high-precision dynamic error compensation: improving the angle measurement accuracy by an order of magnitude in vibration environments, and enhancing adaptive learning capabilities by adapting to performance changes over long-term use through the model update module.
[0076] Example 3 This application also discloses a computer device, including one or more processors and a memory; One or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs being configured to perform the methods described above.
[0077] Example 4 This application also discloses a computer-readable storage medium storing a computer program that can be loaded by a processor and execute the method.
[0078] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a device including one or any combination of the above-mentioned memories. The computer may be a variety of computing devices, including smart terminals and servers.
[0079] In the above embodiments of this disclosure, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0080] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0081] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0082] Furthermore, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0083] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable non-volatile storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a non-volatile 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 disclosure. The aforementioned non-volatile storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0084] The above are all preferred embodiments of this application, and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.
Claims
1. A method for detecting the angle error of a photoelectric encoder, characterized in that, Includes the following steps: Acquire the original angle signal, standard angle signal, and vibration signal of the photoelectric encoder synchronously under vibration conditions; The instantaneous angle error is determined based on the standard angle signal and the original angle signal; Based on the vibration signal and the instantaneous angle error, an error model describing the mapping relationship from vibration to angle error is established; The current angle signal and current vibration signal of the photoelectric encoder are acquired in real time. Based on the current vibration signal and the error model, determine the real-time angle error compensation value; The current angle signal is compensated using the real-time angle error compensation value to output an accurate angle value.
2. The method according to claim 1, characterized in that, It also includes a step for updating the error model: Obtain a validation dataset synchronously acquired under the new vibration environment; Based on the validation dataset, calculate the residual after compensation by the error model; If the residual exceeds a preset threshold, the error model is updated using the validation dataset.
3. The method according to claim 2, characterized in that, The conditions that trigger the online update phase of the model are: The time since the last model update has reached a preset duration; and / or, The difference between the spectral characteristics of the current vibration signal and the spectral characteristics of the vibration signal used in the model training phase exceeds a preset range; and / or, When performing periodic verification using the aforementioned angle reference unit, it was found that the residual continuously increased.
4. The method according to claim 1, characterized in that, The steps for establishing the error model include: Feature extraction is performed on the vibration signal to obtain a multidimensional feature vector; Based on the multidimensional feature vector and the instantaneous angle error, a machine learning model is trained to form the error model.
5. The method according to claim 4, characterized in that, The step of determining the real-time angle error compensation value based on the current vibration signal and the error model includes: Based on the multidimensional feature vector, pattern recognition is performed on the vibration environment to classify various typical working conditions. A dedicated error sub-model is established and stored for each of the typical operating conditions described. The current typical working condition is identified based on the real-time acquired vibration signal, and the corresponding error sub-model is called to determine the real-time angle error compensation value.
6. The method according to claim 1, characterized in that, The step of compensating the current angle signal using the real-time angle error compensation value employs the following formula: i comp =θ raw +a*Δθ; Where, θ comp For the precise angle value, θ raw Δθ is the current angle signal, Δθ is the real-time angle error compensation value, and α is the adaptive weighting coefficient dynamically adjusted based on the current vibration signal.
7. The method according to claim 6, characterized in that, The adaptive weighting coefficient α is determined by the following rule: when the amplitude of the current vibration signal is greater than a preset threshold or the signal-to-noise ratio is lower than a preset threshold, α is set to 1.0; otherwise, α is set to a value between 0.5 and 1.
0.
8. A photoelectric encoder angle error detection system, characterized in that, include: The signal acquisition module is used to acquire the original angle signal, standard angle signal and vibration signal of the photoelectric encoder synchronously collected under vibration conditions; An error calculation module is used to determine the instantaneous angle error based on the standard angle signal and the original angle signal; The model building module is used to build an error model describing the mapping relationship from vibration to angle error based on the vibration signal and the instantaneous angle error. The real-time signal acquisition module is used to acquire the current angle signal and current vibration signal of the photoelectric encoder in real time. The compensation value determination module is used to determine the real-time angle error compensation value based on the current vibration signal and the error model; The compensation module is used to compensate the current angle signal using the real-time angle error compensation value and output an accurate angle value.
9. The system according to claim 8, characterized in that, It also includes a model update module, which includes: The verification data acquisition unit is used to acquire the verification dataset synchronously collected under the new vibration environment; The residual calculation unit is used to calculate the residual after compensation by the error model based on the validation dataset; The model update unit is used to update the error model using the validation dataset when the residual exceeds a preset threshold.
10. The system according to claim 8, characterized in that, The model building module includes: The feature extraction unit is used to extract features from the vibration signal to obtain a multidimensional feature vector; The model training unit is used to train a machine learning model based on the multidimensional feature vector and the instantaneous angle error to form the error model.