Error compensation method for photoelectric encoder
By employing frequency domain analysis and non-uniform sampling strategies, the photoelectric encoder error compensation method solves the balance problem between sampling density and storage resources, achieving efficient error compensation, improving the positioning accuracy and dynamic response performance of the servo system, and reducing system costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-06
- Publication Date
- 2026-04-03
AI Technical Summary
Existing photoelectric encoder error compensation methods struggle to balance sampling density and storage resources, making it difficult to reliably achieve high-precision compensation in resource-constrained industrial settings. Furthermore, the high computational complexity negatively impacts the positioning accuracy and dynamic response performance of servo systems.
By accurately locating regions of drastic error changes through frequency domain analysis and implementing non-uniform sampling, an error compensation table is constructed. High-density sampling is used in regions of severe error and low-density sampling is used in regions of moderate error. Interpolation is then used to obtain error compensation values, thereby optimizing storage efficiency and compensation accuracy.
This achieves efficient retention of key error features with limited storage resources, reduces computational complexity, improves the positioning accuracy and dynamic response performance of the servo system, and reduces system cost.
Smart Images

Figure CN121783232A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of photoelectric encoder technology, and in particular to a photoelectric encoder error compensation method. Background Technology
[0002] Optical encoders are precision sensors that convert angular or linear displacement into digital pulse signals. They are widely used in servo control systems of high-end equipment such as industrial robots, CNC machine tools, and aerospace. Due to factors such as code disk marking errors, installation eccentricity, bearing wobble, photoelectric signal crosstalk, and temperature drift, the encoder output signal inevitably contains complex systematic and random errors. These errors directly affect the positioning accuracy and dynamic response performance of the servo system.
[0003] Most error compensation methods rely on establishing a complete error curve model or using polynomial fitting, global lookup tables, or other methods to correct the encoder output readings. The error signal itself often contains a superposition of multiple frequency components, including low-frequency systematic deviations, as well as mid-to-high-frequency periodic fluctuations and random noise. This makes it difficult for the compensation model to maintain a consistent correction effect under different speeds and load conditions. Furthermore, to cover all error characteristics, the number of parameters in the compensation table or model is usually enormous, consuming significant storage resources. In real-time calculations within embedded controllers, this places a heavy computational burden, easily leading to delays or accuracy losses.
[0004] The deeper technical contradiction lies in the fundamental conflict between the continuously changing characteristics of encoder errors and the discrete processing method of digital systems. The error curve exhibits non-linear fluctuations within a 360-degree range. If continuous errors are directly sampled and compensated, too few sampling points will result in the loss of critical details and create compensation blind spots; too many sampling points will cause a surge in data volume, which not only overwhelms storage space but also requires frequent interpolation calculations during real-time calls, further amplifying computational complexity. Summary of the Invention
[0005] Therefore, the purpose of this invention is to overcome the shortcomings of existing error compensation methods, which struggle to balance sampling density and storage resources, resulting in the inability to reliably achieve high-precision compensation in resource-constrained industrial settings. This invention provides an error compensation method for photoelectric encoders that accurately locates regions of drastic error changes through frequency domain analysis and implements non-uniform sampling. This method compresses the amount of data in the compensation table while fully preserving key error characteristics, thereby achieving synergistic optimization of storage efficiency and compensation accuracy.
[0006] To solve the above-mentioned technical problems, the present invention provides a photoelectric encoder error compensation method, comprising: Obtain the original position set of the photoelectric encoder in operation and calculate the error sequence between its actual position and theoretical position; The error sequence is subjected to a Fourier transform to obtain the error spectrum distribution, which includes the amplitude and phase interval of each frequency component; Analyze the error spectrum distribution to determine the high-frequency component interval; the high-frequency component interval is the phase interval corresponding to the frequency component whose amplitude exceeds the threshold. Based on the analysis results of the error spectrum distribution, the error sequence is non-uniformly segmented for sampling to obtain a set of sampling points; the high-frequency component interval is the first sampling density; the other intervals outside the high-frequency component interval are the second sampling density, and the first sampling density is greater than the second sampling density; Construct an error compensation table of the original position and error compensation value of the sampling point set; query the error compensation table to obtain the error compensation value of the current position of the photoelectric encoder.
[0007] Preferably, the error sequence is non-uniformly segmented for sampling based on the analysis results of the error spectrum distribution, including: extending from the boundary of the high-frequency component interval to the inner and outer sides of the high-frequency component interval, respectively, to form a first transition interval and a second transition interval; within the first transition interval and the second transition interval, sampling is performed using a third sampling density between the first sampling density and the second sampling density; the third sampling density gradually decreases from the boundary of the high-frequency component interval towards the other intervals to the second sampling density, so that the sampling point density transitions smoothly at the interval boundaries.
[0008] Preferably, the first sampling density is 4.5~5.5 points / degree; the second sampling density is 0.5~1 points / degree; and so on.
[0009] Preferably, the non-uniform segmented sampling of the error sequence based on the analysis results of the error spectrum distribution further includes: obtaining the spectral amplitude corresponding to each phase point within the high-frequency component interval; dividing the high-frequency component interval into at least two sub-intervals based on the distribution of the spectral amplitude within the high-frequency component interval; including a first sub-interval and a second sub-interval, wherein the average spectral amplitude in the first sub-interval is higher than the average spectral amplitude in the second sub-interval; sampling is performed in the first sub-interval using a fourth sampling density higher than the first sampling density; and sampling is performed in the second sub-interval using a fifth sampling density lower than the fourth sampling density but higher than the second sampling density.
[0010] Preferably, querying the error compensation table to obtain the error compensation value of the current position of the photoelectric encoder includes: if the current position does not match the index value in the error compensation table, locating two sampling points adjacent to the current position in the error compensation table, obtaining the original positions of the two sampling points and their corresponding error compensation values, and calculating the error compensation value of the current position based on interpolation.
[0011] Preferably, calculating the error compensation value of the current position based on interpolation includes: obtaining the angular distance between two sampling points adjacent to the current position; if the angular distance exceeds a threshold, obtaining the error change rate at the two sampling points; and calculating the error compensation value of the current position using a piecewise cubic interpolation algorithm based on the original positions of the two sampling points, the error compensation value, and the error change rate.
[0012] Preferably, obtaining the original position set of the photoelectric encoder in operation includes: controlling the photoelectric encoder to rotate at a constant speed, and collecting the original position readings output by the photoelectric encoder at fixed time intervals during the rotation to generate the original position set; performing coarse error detection and elimination on the original position set to obtain the purified actual position; and simultaneously acquiring the reference position readings synchronously output by the reference measuring device to generate the theoretical position.
[0013] Preferably, analyzing the error spectrum distribution to determine the high-frequency component interval includes: performing bandpass filtering on each frequency component in the error spectrum distribution to extract the spectral peaks of frequency components whose amplitudes exceed a threshold, with each spectral peak corresponding to a frequency band; performing an inverse Fourier transform on each frequency band to obtain the time-domain component signal corresponding to that frequency band; calculating the instantaneous amplitude envelope of each time-domain component signal to obtain the energy distribution curve of that frequency band in the phase domain; and performing threshold segmentation on the energy distribution curve to determine the continuous phase intervals where the energy amplitude exceeds the energy threshold as the high-frequency energy concentration intervals corresponding to that frequency band.
[0014] Preferably, after determining the high-frequency energy concentration interval corresponding to each frequency band, the method further includes: superimposing the high-frequency energy concentration intervals of all frequency bands in the phase domain to generate a superimposed energy distribution map, wherein the superimposed energy distribution map reflects the number of layers covered by the high-frequency energy concentration intervals of different frequency bands for each phase interval; dividing the phase domain into at least two different levels of composite high-frequency intervals according to the number of superimposed layers, including a first-level composite high-frequency interval and a second-level composite high-frequency interval, wherein the number of superimposed layers of the first-level composite high-frequency interval is higher than the number of superimposed layers of the second-level composite high-frequency interval; sampling is performed using a sixth sampling density higher than the first sampling density in the first-level composite high-frequency interval; and sampling is performed using a seventh sampling density between the first sampling density and the sixth sampling density in the second-level composite high-frequency interval.
[0015] Preferably, the sixth sampling density is 3 to 4 times the first sampling density; and the seventh sampling density is 2 to 3 times the first sampling density.
[0016] Compared with the prior art, the above-described technical solution of the present invention has the following advantages: The photoelectric encoder error compensation method described in this invention accurately locates regions of drastic error changes through frequency domain analysis and implements non-uniform sampling. While compressing the amount of data in the compensation table, it fully preserves key error characteristics, thereby achieving synergistic optimization of storage efficiency and compensation accuracy. Attached Figure Description
[0017] To make the content of this invention easier to understand, the invention will be further described in detail below with reference to specific embodiments and accompanying drawings.
[0018] Figure 1 This is a flowchart of the photoelectric encoder error compensation method in a preferred embodiment of the present invention; Figure 2 This is a flowchart of non-uniform segmented sampling of the error sequence in a preferred embodiment of the present invention; Figure 3 This is a flowchart of non-uniform segmented sampling of the error sequence in another embodiment of the present invention; Figure 4 This is a flowchart illustrating the process of obtaining the current position error compensation value of the photoelectric encoder in a preferred embodiment of the present invention; Figure 5 This is a flowchart for determining the high-frequency component range in a preferred embodiment of the present invention. Detailed Implementation
[0019] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments described are not intended to limit the present invention.
[0020] Reference Figure 1 As shown, this invention discloses an error compensation method for a photoelectric encoder, aiming to solve the problem of balancing sampling density and storage resources in error compensation. In practical implementation, the primary challenge of this method is how to retain the key features of various frequency components in the error signal while avoiding the compensation process from becoming bogged down in highly complex real-time calculations, given limited storage resources. To address this issue, this invention employs frequency domain analysis to accurately locate regions of drastic error changes and implements a non-uniform sampling strategy. This compresses the amount of data in the compensation table while fully preserving key error features, thereby achieving a synergistic optimization of storage efficiency and compensation accuracy.
[0021] The technical solution of the embodiments of the present invention will be described in detail below with reference to specific implementation steps: Step 1: Obtain the original location set and calculate the error sequence:
[0022] First, the photoelectric encoder to be compensated is mounted on a high-precision turntable, and the turntable is controlled to drive the photoelectric encoder to rotate at a constant speed. During the rotation, the raw position readings output by the photoelectric encoder are collected at fixed time intervals. These raw readings, without any compensation processing, constitute the raw position set. To ensure comprehensive data coverage, the encoder can be rotated continuously for multiple revolutions, collecting position data for multiple cycles.
[0023] At the same time, the reference position readings output by the reference measuring device are acquired synchronously. The accuracy of the reference measuring device should be at least one order of magnitude higher than that of the photoelectric encoder under test, so as to ensure that its readings can be used as a reliable reference for the theoretical position; the synchronously acquired reference position readings are used as the theoretical position set.
[0024] After obtaining the original position set and the theoretical position set, the error value for each original position reading in the original position set is obtained by subtracting the reference position reading at the same moment. The error values of all positions are arranged in phase order to form an error sequence. This error sequence truly reflects the error distribution characteristics of the photoelectric encoder across its entire range.
[0025] Step 2: Obtain the error spectrum distribution using Fourier transform: Perform a Fourier transform on the error sequence obtained in step one to convert the time-domain error signal to the frequency domain, obtaining the error spectrum distribution. The error spectrum distribution contains the amplitude and phase interval information of each frequency component. The amplitude reflects the energy of the frequency component in the error signal; the larger the amplitude, the greater the contribution of the frequency component to the total error. The phase interval indicates the starting position of the frequency component in the time domain.
[0026] The Fourier transform decomposes complex time-domain error curves into a superposition of a series of sine waves, enabling technicians to clearly identify the composition of the error signal: which are low-frequency systematic deviations, which are mid- to high-frequency periodic fluctuations, and their respective amplitude and phase distribution.
[0027] Step 3: Determine the high-frequency component range: Analyze the error spectrum distribution obtained in step two and set an amplitude threshold. The amplitude threshold can be determined according to the system accuracy requirements or empirical values. For example, it can be set as a multiple of the average amplitude of all frequency components, or the minimum amplitude corresponding to the frequency components with the highest energy percentage can be taken according to the Pareto principle.
[0028] Identify all frequency components in the error spectrum distribution whose amplitude exceeds an amplitude threshold. For each frequency component exceeding the amplitude threshold, its corresponding periodic fluctuation in the phase domain is the entire 360-degree range. To locate the local phase interval where the energy of this frequency component is concentrated, further processing is required: perform bandpass filtering on the frequency component to extract its spectral peak; perform inverse Fourier transform on the spectral peak to obtain the time-domain component signal corresponding to the frequency band; calculate the instantaneous amplitude envelope of the time-domain component signal to obtain the energy distribution curve of the frequency band in the phase domain; and perform threshold segmentation on the energy distribution curve to determine the continuous phase interval where the energy amplitude exceeds the energy threshold as the high-frequency energy concentration interval corresponding to the frequency band.
[0029] Repeat the above process for all frequency components exceeding the amplitude threshold to obtain multiple high-frequency energy concentration intervals across multiple frequency bands. These high-frequency energy concentration intervals are then merged and deduplicated in the phase domain to generate the final high-frequency component intervals.
[0030] Step 4: Obtain the sampling point set through non-uniform segmentation sampling: Based on the high-frequency component intervals determined in step three, the error sequence obtained in step one is subjected to non-uniform segmentation sampling; the specific sampling strategy is as follows: Within the high-frequency component range, sampling is performed using a first sampling density; outside the high-frequency component range, sampling is performed using a second sampling density lower than the first sampling density.
[0031] At the boundary between the high-frequency component interval and other intervals, a transition interval is set to avoid discontinuities in compensation values caused by abrupt changes in sampling density. Specifically, a first transition interval and a second transition interval are formed by extending a certain angle range from the boundary of the high-frequency component interval inward and outward, respectively. Within the first and second transition intervals, a third sampling density, between the first and second sampling densities, is used for sampling. The third sampling density gradually decreases from the boundary of the high-frequency component interval towards other intervals to the second sampling density, ensuring a smooth transition of sampling point density at the interval boundaries.
[0032] Within the high-frequency component interval, a second round of refined sampling is performed based on the distribution of spectral amplitude. The spectral amplitude corresponding to each phase point within the high-frequency component interval is obtained. Based on the distribution of spectral amplitude within this interval, the high-frequency component interval is further divided into at least two sub-intervals, including a first sub-interval and a second sub-interval. The average spectral amplitude in the first sub-interval is higher than the average spectral amplitude in the second sub-interval. Within the first sub-interval, a fourth sampling density, higher than the first sampling density, is used for sampling; within the second sub-interval, a fifth sampling density, lower than the fourth sampling density but higher than the second sampling density, is used for sampling.
[0033] By employing the aforementioned non-uniform segmented sampling strategy, a set of sampling points consisting of several sampling points is obtained, with each sampling point containing its original position and corresponding error compensation value.
[0034] Step 5: Construct the error compensation table: Using the original positions of the sampling point set obtained in step four as indices, and the error compensation values corresponding to these original positions as data items, an error compensation table is constructed that maps each original position to its corresponding error compensation value. During the construction of the error compensation table, the data can be further compressed to save storage space. For example, differential encoding can be used to store the difference in error compensation values between adjacent sampling points, while simultaneously storing the original position of the first sampling point and its error compensation value as a reference value. This method leverages the small variation in error compensation values between adjacent points, reducing storage requirements by 50% to 70%. The completed error compensation table is stored in non-volatile memory and loaded into a cache during each power-on initialization of the photoelectric encoder for real-time lookup.
[0035] Step Six: Query the compensation table to obtain the error compensation value for the current position: During the real-time operation of the photoelectric encoder, the raw position reading of the current output of the photoelectric encoder is acquired. The error compensation table is then queried using this current position as an index; two situations may occur during the query: If the current position exactly matches an index value in the error compensation table, the error compensation value corresponding to that index is directly read as the error compensation value for the current position.
[0036] If the current position does not match the index value in the error compensation table, the two adjacent sampling points in the error compensation table are located, and their original positions and corresponding error compensation values are obtained. Then, interpolation is performed based on these two adjacent sampling points to calculate the error compensation value for the current position. The interpolation can use linear interpolation or piecewise cubic interpolation algorithms. When using piecewise cubic interpolation, the error change rate at the two sampling points also needs to be obtained. The error change rate is obtained by differentiating the error sequence. Piecewise cubic interpolation based on the original position, error compensation value, and error change rate yields a more accurate interpolation result.
[0037] Finally, the calculated error compensation value is superimposed on the original position reading currently output by the photoelectric encoder to output a corrected high-precision position signal.
[0038] Implementing the above six steps of the photoelectric encoder error compensation method has the following beneficial effects: First, the Fourier transform decomposes the complex time-domain error sequence into quantifiable frequency components. The spectral analysis results provide the amplitude and phase information of each frequency component. Frequency components with amplitudes exceeding the threshold correspond to regions with severe error fluctuations. The energy concentration ranges of these regions are accurately located through subsequent time-frequency analysis.
[0039] A non-uniform segmented sampling strategy based on spectral analysis results optimizes the allocation of sampling resources. High-density sampling is used in the high-frequency component range to ensure that key features such as peaks, valleys, and inflection points in the error curve are fully captured; low-density sampling is used in the low-frequency range to avoid unnecessary data redundancy in gently changing regions. While maintaining compensation accuracy, the total number of sampling points is controlled to a level far lower than that of uniform high-density sampling. Taking typical industrial applications as an example, the total number of points in non-uniform sampling is typically only one-third to one-half that of uniform high-density sampling, corresponding to a reduction in storage requirements from tens of KB to over ten KB. For embedded systems with limited storage resources, this means that a complete compensation table that was previously impossible to accommodate can now be stored, and designs that previously required external storage chips can be integrated into the main control MCU, thereby reducing system costs and improving reliability.
[0040] The transition interval setting addresses the discontinuity of compensation values caused by abrupt changes in sampling density. At the boundary between the high-frequency and low-frequency ranges, sampling is performed using a third sampling density with a gradually varying density, ensuring a smooth transition in sampling point density. This avoids abrupt changes in interpolation results caused by density abruptness and eliminates minor torque fluctuations or positional jitters that may occur when the photoelectric encoder rotor passes through the boundary, making it particularly suitable for applications requiring extremely high low-speed stability.
[0041] Secondary partitioning sampling within the high-frequency component range further optimizes the allocation of sampling resources. Within the high-frequency range, regions with high spectral amplitudes correspond to the peaks within the peaks where error fluctuations are most severe, and thus employ a higher fourth sampling density; regions with relatively lower spectral amplitudes employ a moderate fifth sampling density. This hierarchical and progressive sampling strategy precisely matches the sampling density to the severity of error fluctuations. Under the same total number of points constraint, the sampling density in the most volatile regions can be increased by 30% to 50%, or equivalently, the total number of points can be further compressed while maintaining peak accuracy.
[0042] The error compensation table is constructed using a key-value pair structure with the original position as the index and the error compensation value as the data item. The query time complexity can be controlled to the order of O(log n) or even O(1). Combined with lightweight interpolation operations, the entire real-time compensation process is completed in microseconds, meeting the update rate requirements of servo control at tens of kHz or even hundreds of kHz.
[0043] In the above embodiments, when a non-uniform sampling strategy of high-density sampling in the high-frequency component range and low-density sampling in other ranges is adopted, a step change in sampling density will occur at the boundary between the high-frequency and low-frequency ranges. When the photoelectric encoder rotor passes through this boundary, due to the large difference in sampling point density on both sides, the set of adjacent sampling points used for interpolation calculation will suddenly change, causing the compensation value curve to jump at the boundary. This jump is reflected in motor control as a slight torque fluctuation or position jitter, which is particularly noticeable in low-speed operation or high-precision positioning scenarios, directly affecting the surface finish and repeatability of the machined surface.
[0044] To address the issue of abrupt changes in sampling density affecting the surface finish and repeatability accuracy of machined surfaces, this invention provides a solution that achieves a smooth transition in sampling density by setting a transition interval. The following is a detailed explanation... Figure 2 The preferred solution is described in detail with specific implementation steps: Step 1: Determine the basic sampling density:
[0045] First, based on the analysis results of the error spectrum distribution, the basic sampling density of the high-frequency component interval and the basic sampling density of other intervals are determined. Specifically, the sampling density within the high-frequency component interval is set as the first sampling density, and the sampling density in other intervals outside the high-frequency component interval is set as the second sampling density. The numerical relationship between the first and second sampling densities is that the first sampling density is greater than the second sampling density, to ensure that the error characteristics within the high-frequency component interval are fully captured.
[0046] The specific values of the first and second sampling densities should be determined based on the system's accuracy requirements and available storage resources. For example, for a standard application of a 17-bit photoelectric encoder with an accuracy requirement of ±20 arcseconds, a first sampling density of 5 sampling points per degree and a second sampling density of 1 sampling point per degree can be used. At the first sampling density, one sampling point per 0.2 degrees can reconstruct mid-to-high frequency errors with a period greater than or equal to 72 degrees; at the second sampling density, one sampling point per degree is sufficient to track low-frequency, slowly changing errors with a period greater than 360 degrees.
[0047] Step two, determine the range and location of the transition zone: At the boundary between the high-frequency component interval and other intervals, a transition interval is set to achieve a smooth transition in sampling density. Specifically, from each boundary of the high-frequency component interval, a preset angle range is extended inward and outward from the high-frequency component interval, respectively, to form a first transition interval and a second transition interval.
[0048] The first transition interval is located inside the high-frequency component interval, immediately adjacent to its boundary, and extends from the boundary of the high-frequency component interval inward by a first preset angle. The second transition interval is located outside the high-frequency component interval, immediately adjacent to its boundary, and extends from the boundary of the high-frequency component interval inward by a second preset angle to other intervals outside the high-frequency component interval.
[0049] The preset angle range should be determined based on the rate of change of the error curve and the system's dynamic response requirements. Generally, the length of the transition interval can be taken as 5% to 20% of the total length of the high-frequency component interval, or set as a fixed angle value based on experience, such as 1 to 3 degrees. If the transition interval is too short, the smoothing effect will be insufficient; if the transition interval is too long, it will consume too many sampling resources.
[0050] Step 3: Determine the sampling density of the transition interval: Within the first and second transition intervals, sampling is performed using a third sampling density that falls between the first and second sampling densities. This third sampling density is not a fixed value, but rather a function that gradually varies from the boundary of the high-frequency component interval towards other intervals.
[0051] Specifically, starting from the boundary of the high-frequency component interval, the sampling density gradually changes as it extends into the transition interval further away from the boundary. Within the first transition interval, the sampling density gradually decreases from a first sampling density at the boundary to an intermediate value at the end of the first transition interval; within the second transition interval, the sampling density gradually decreases from an intermediate value at the boundary to a second sampling density at the end of the second transition interval. This gradual change in sampling density gives the sampling point distribution throughout the transition interval a gradual characteristic, avoiding abrupt changes in sampling density.
[0052] One way to achieve gradual changes in sampling density is through linear gradients. In a linear gradient method, the sampling density changes linearly with the distance from the boundary, and the calculation formula is as follows: d(θ)=d2-(d2-d1)×(θ-θ*) / L; θ is the absolute angular position of the rotor on the circumference, d(θ) is the sampling density at the angular position θ, d2 is the sampling density at the boundary, d1 is the sampling density at the end of the transition interval, θ* is the boundary position, and L is the length of the transition interval.
[0053] Step 4: Implement non-uniform segmented sampling: Following the sampling strategy determined above, the original error sequence is subjected to non-uniform segmentation sampling; the sampling process can be performed in the following order: First, the core region within the high-frequency component range (i.e., the part excluding the first transition range) is sampled using the first sampling density; this part is the region with the most severe error fluctuations and requires the densest sampling points to accurately characterize the shape of the error curve.
[0054] Secondly, the core region within other intervals (i.e., the part excluding the second transition interval) is sampled using the second sampling density; this part is a region where the error changes gradually, and sparse sampling can meet the requirements.
[0055] Next, a gradually decreasing third sampling density is applied to the first and second transition intervals. Within the first transition interval, the sampling density gradually decreases from the end closer to the core region to the end closer to the boundary; similarly, within the second transition interval, the sampling density gradually decreases from the end closer to the boundary to the end farther from the boundary. The specific locations of the sampling points can be determined using equal angular intervals or equal density intervals.
[0056] Finally, all sampling points are arranged in phase order to form a complete sampling point set. This sampling point set includes high-density sampling points in the core region of the high-frequency component interval, low-density sampling points in the core regions of other intervals, and gradually decreasing density sampling points in the transition interval, together forming a sampling point set with smooth density distribution and complete preservation of key features.
[0057] This preferred solution, through the implementation of the above steps, fundamentally solves the problem of discontinuous compensation values caused by abrupt changes in sampling density in the transition interval. Furthermore, the use of a gradually increasing density transition interval achieves a smooth transition at the boundary while avoiding an excessive increase in sampling points. Taking a typical transition interval length of 3 degrees as an example, if a simple widening method is used, the high-frequency interval needs to be extended by 3 degrees on each side, adding a 6-degree high-density sampling area, which, calculated at a first sampling density of 5 points / degree, would add 30 sampling points. However, the gradually increasing density transition interval of this solution has an average density of approximately 3 points / degree, and the 6-degree transition interval only adds 18 sampling points, saving 40% of the sampling points compared to the simple widening method.
[0058] In the above embodiment, after determining the high-frequency component interval through spectrum analysis, the degree of error fluctuation at each phase point within the high-frequency component interval is not uniform. The spectrum analysis results show that the high-frequency component interval is a continuous phase range formed by the superposition of multiple frequency components. Some phase points may be regions where multiple frequency components are superimposed in phase, resulting in extremely drastic error fluctuations; while other phase points may be regions where frequency components are phase-shifted and cancel each other out, resulting in relatively gentle error fluctuations. If a uniform first sampling density is used to sample the entire identified high-frequency component interval, ignoring the non-uniformity within the high-frequency component interval, it will lead to oversampling in relatively gentle fluctuation regions, wasting storage resources, while the sampling density in the most drastic fluctuation regions will be relatively insufficient, failing to fully capture the fine features of the error curve.
[0059] To address this problem, a preferred embodiment of the present invention also provides a solution for secondary partitioning and differential sampling within the high-frequency component range, which will be discussed below. Figure 3 The preferred solution is described in detail with specific implementation steps: Step 1: Obtain the spectral amplitude corresponding to each phase point within the high-frequency component interval: First, based on the acquired error spectrum distribution, spectral information related to the high-frequency component interval is extracted. The high-frequency component interval is a continuous phase range jointly contributed by multiple frequency components with amplitudes exceeding a threshold, and each frequency component has a different degree of contribution at different phase points within this interval. To quantify this difference in contribution, it is necessary to obtain the spectral amplitude corresponding to each phase point within the high-frequency component interval.
[0060] The specific implementation is as follows: Perform an inverse Fourier transform on all frequency components constituting the high-frequency component interval to reconstruct the time-domain signal after the superposition of these frequency components. This time-domain signal is the reconstruction result of the error waveform within the high-frequency component interval. Then, calculate the instantaneous amplitude envelope of the reconstructed signal to obtain the instantaneous amplitude corresponding to each phase point. The instantaneous amplitude reflects the overall energy of the superposition of multiple frequency components at that phase point; a higher instantaneous amplitude indicates more severe error fluctuation at that point. Alternatively, a more direct approach can be adopted: extract the amplitude of each frequency component constituting the high-frequency component interval, and then superimpose or weightedly superimpose the amplitudes of all frequency components at the same phase point to obtain the synthetic spectral amplitude of that phase point. Regardless of the method used, the final result is a sequence of spectral amplitudes corresponding to each phase point within the high-frequency component interval, which reflects the distribution of the severity of error fluctuation within the interval.
[0061] Step 2: Divide the high-frequency component range into secondary partitions based on the spectral amplitude distribution: After obtaining the spectral amplitude sequence of each phase point in the high-frequency component interval, the high-frequency component interval is divided into at least two sub-intervals based on its distribution characteristics, including the first sub-interval and the second sub-interval.
[0062] The partitioning method employs either threshold segmentation or cluster analysis. Threshold segmentation is suitable for scenarios where the spectral amplitude distribution has a clear high-low boundary: a threshold amplitude is set, and continuous phase regions with spectral amplitudes above the threshold are divided into the first sub-interval, while continuous phase regions with spectral amplitudes below the threshold are divided into the second sub-interval. Cluster analysis is suitable for scenarios with more complex spectral amplitude distributions: K-means clustering is used to automatically cluster phase points within the high-frequency component intervals into several classes according to the magnitude of the spectral amplitude, and the continuous phase region corresponding to each class is a sub-interval.
[0063] Regardless of the partitioning method used, the common characteristic of the partitioning results is that the average spectral amplitude in the first sub-interval is higher than that in the second sub-interval. In other words, the first sub-interval is the core region with the most severe error fluctuations within the high-frequency component range, while the second sub-interval is a secondary region with relatively milder error fluctuations within the high-frequency component range. As needed, third, fourth, and so on sub-intervals can be further subdivided to form a multi-level internal sub-interval structure.
[0064] Step 3: Determine the sampling density for each sub-interval: Differentiated sampling densities are assigned based on the severity of error fluctuations within each sub-interval; specifically:
[0065] Within the first sub-interval, a fourth sampling density, higher than the first sampling density, is used for sampling. This fourth sampling density should adequately meet the sampling requirements for drastic fluctuations in the first sub-interval, ensuring accurate capture of sharp peaks and troughs and rapidly changing characteristics in the error curve. The specific value of the fourth sampling density can be determined based on the maximum or average spectral amplitude within the first sub-interval; for example, it can be 2 to 3 times the first sampling density.
[0066] Within the second sub-interval, a fifth sampling density is used, which is lower than the fourth sampling density but higher than the second sampling density. The fifth sampling density lies between the first and fourth sampling densities; it is higher than the baseline first sampling density to reflect the fact that this region is still in the high-frequency range, but lower than the fourth sampling density to avoid oversampling of relatively flat areas. The specific value of the fifth sampling density can be determined based on the distribution characteristics of the spectral amplitude within the second sub-interval; for example, it can be 1.2 to 1.5 times the first sampling density.
[0067] If a third sub-interval or a fourth sub-interval exists, the sampling density can be allocated from high to low according to the order of the spectral amplitude, forming a sampling density gradient that matches the spectral amplitude distribution.
[0068] Step 4: Perform layered sampling within the high-frequency component range: Based on the aforementioned sub-interval division and differentiated sampling density, fine-grained stratified sampling is performed on the high-frequency component intervals; the sampling process is executed sequentially according to the sub-intervals: First, locate the start and end phases of the first sub-interval; within the first sub-interval, uniformly set sampling points at the fourth sampling density. The specific locations of the sampling points can be determined at equal angular intervals. For example, when the fourth sampling density is 12 points / degree, one sampling point is set every 1 / 12 degree, or approximately 0.0833 degrees.
[0069] Next, determine the start and end phases of the second sub-interval. Within the second sub-interval, uniformly distribute sampling points at the fifth sampling density. For example, when the fifth sampling density is 8 points / degree, set one sampling point every 1 / 8 degree, or 0.125 degrees.
[0070] If there are more sub-intervals, the same principle applies, setting sampling points within each sub-interval according to its corresponding sampling density.
[0071] Finally, the sampling points within each sub-interval are merged in phase order to form a complete set of sampling points within the high-frequency component interval. This set of sampling points, together with the sampling points in the transition region and the sampling points in other intervals, constitutes the final overall set of sampling points.
[0072] This preferred solution addresses the problem of wasted sampling resources caused by the non-uniform distribution of error fluctuations within the high-frequency component range by acquiring the spectral amplitude distribution within the high-frequency component range, performing secondary partitioning, and allocating differentiated sampling densities. The allocation of differentiated sampling densities achieves a secondary optimization of sampling resources within the high-frequency component range. In the first sub-interval, a fourth sampling density, higher than the first sampling density, is used to ensure that the core region with the most severe error fluctuations receives the densest sampling points, accurately capturing sharp peaks and valleys and rapidly changing characteristics in the error curve. In the second sub-interval, a fifth sampling density, lower than the fourth sampling density but higher than the second sampling density, is used. This addresses the essential requirement that this region still belongs to the high-frequency range while avoiding resource waste caused by uniform high-density sampling. This gradient sampling density allocation achieves a secondary improvement in sampling efficiency.
[0073] In the above embodiment, after constructing the error compensation table of the original position-error compensation value, the table only stores the error compensation values of a limited number of sampling points. However, during real-time operation, the current position output by the photoelectric encoder can be any angle value, and these continuously distributed position readings are highly unlikely to be exactly equal to a certain sampling point position pre-stored in the compensation table. The preferred embodiment of this invention also provides a solution for obtaining accurate compensation values by locating adjacent sampling points and performing interpolation calculations, which is described below in conjunction with... Figure 4The preferred solution is described in detail with specific implementation steps: Step 1: Obtain the current location and query the compensation table:
[0074] During the real-time operation of the photoelectric encoder, the system acquires the current raw position reading output by the photoelectric encoder at a fixed sampling period, denoted as θ. current The current position θ current It is a continuously changing angle value, which can be any real number.
[0075] With θ current Using the index value, query the pre-built and stored error compensation table in memory. The error compensation table can be structured as an ordered array, storing all sampling points in ascending order of their original positions. Each entry contains two fields: an index field storing the original position of the sampling point, and a data field storing the error compensation value corresponding to that original position.
[0076] The query process uses a binary search algorithm: first, θ current Compare the value with the index value at the middle position of the compensation table, and determine θ based on the comparison result. current Whether it's located in the first or second half of the compensation table, continue the binary search within the corresponding half-zone until a match is found. current Matching index value, or determining θ current Not included in the compensation table.
[0077] Step 2: Analyze the query results and handle matching cases: Based on the result of the binary search, two possible scenarios may occur: First case: If θ current If the error compensation value matches an index value in the error compensation table, the error compensation value corresponding to that index value is directly read and used as the error compensation value for the current position. This occurs when the encoder's current position happens to fall on a specific sampling point; in this case, no additional calculation is required, and the accurate compensation value can be obtained directly.
[0078] The second case: if θ current If the index value is not equal to the value in the error compensation table, then determine θ. current Between which two adjacent sampling points in the compensation table is it located? At the end of the binary search, it will locate two adjacent sampling points: one is less than θ. current The sampling point corresponding to the maximum index value is denoted as P. left Its original position is θ left The error compensation value is e left The other is greater than θ. current The sampling point corresponding to the smallest index value is denoted as P. right Its original position is θ right The error compensation value is eright These two sampling points are the two sampling points adjacent to the current position.
[0079] Step 3: Obtain complete information from adjacent sampling points: Get P left and P right The original locations of the two sampling points and their corresponding error compensation values; this information is read directly from the corresponding entries in the compensation table.
[0080] In some implementations, the error compensation table also stores derivative information at the sampling points, i.e., the rate of change of error, and obtains P together. left The rate of change of the error at a point is e' left P right The rate of change of the error at a point is e' right The error rate of change can be obtained by performing differential operations on the error sequence during the offline calibration stage and stored in advance in the compensation table.
[0081] Step 4: Calculate the error compensation value for the current position based on interpolation: After obtaining information from adjacent sampling points, interpolation is used to calculate the current position θ. current Error compensation value e current The interpolation method can be selected based on the accuracy requirements and computing resources: If linear interpolation is used, the calculation formula is: e current =e left +(e right -e left )×(θ current -θ left ) / (θ right -θ left ); Linear interpolation assumes that the error curve between two sampling points is a straight line. It requires very little computation, only one subtraction, one division, one multiplication, and one addition. It is suitable for areas with high sampling point density.
[0082] If a piecewise cubic interpolation algorithm is used, the error compensation value e current The calculation formula is: e current =h00(t)×e left +h10(t)×(θ right -θ left )×e' left +h01(t)×e right +h11(t)×(θ right -θ left )×e' right : Where t=(θ)current -θ left ) / (θ right -θ left ), indicating the relative position of the current location between two adjacent sampling points; h00(t) = 2t 3 -3t 2 +1; h10(t)=t 3 -2t 2 +t; h01(t) -2t 3 +3t 2 ; h11(t)=t 3 -t 2 .
[0083] Piecewise cubic interpolation not only utilizes the location and compensation value of the sampling points, but also the derivative information at the sampling points. It can maintain the first-order continuity of the error curve at the sampling points, and the interpolation accuracy is higher than that of linear interpolation. It is suitable for regions where the sampling points are relatively sparse or the curvature of the error curve is large.
[0084] The choice of interpolation method can be dynamically determined based on the length of the interval where the current position is located; if θ right -θ left If the distance between the two sampling points is less than the preset threshold, it means that the distance between the two sampling points is relatively close, and linear interpolation can obtain sufficient accuracy; if the distance is greater than the preset threshold, it means that the sampling points are relatively sparse, and piecewise cubic interpolation algorithm is required to ensure accuracy.
[0085] Step 5: Output the compensated position signal. The error compensation value e calculated in step four current The original position reading θ of the current output of the photoelectric encoder tcurrent Algebraic superposition is performed to obtain a corrected high-precision position signal, which is used as the final output of the photoelectric encoder for subsequent control or measurement systems.
[0086] In the above embodiments, high-frequency component intervals are determined through spectral analysis. Error signals often contain multiple frequency components with amplitudes exceeding a threshold, each corresponding to a different frequency band. Each frequency band has a specific energy concentration interval in the phase domain, and these intervals may overlap or intersect. When the energy of multiple frequency bands is simultaneously concentrated in adjacent phase intervals, a composite high-frequency region is formed. Within these composite regions, the combined energy of multiple high-frequency components causes error fluctuations far exceeding those caused by a single frequency band acting alone. If the difference in the number of superposition layers within the composite region is ignored, and the high-frequency energy concentration intervals of each frequency band are simply merged to form a larger continuous interval, and then a uniform first sampling density is applied to the entire merged interval, it will lead to underestimation of the sampling density in regions with a high number of superposition layers, while oversampling occurs in regions with a low number of superposition layers.
[0087] To address this problem, another embodiment of the present invention provides a solution for identifying composite high-frequency regions and hierarchically allocating sampling densities through stacking layer analysis. The following is a detailed explanation... Figure 5 The preferred solution is described in detail with specific implementation steps: Step 1: Perform bandpass filtering on each frequency band to extract spectral peaks:
[0088] For each frequency component exceeding the threshold, its energy is typically not concentrated at an isolated single frequency point, but rather distributed across a continuous frequency band centered on that frequency, forming a spectral peak. A bandpass filter is used to extract each spectral peak, with each peak corresponding to a frequency band. The passband range of the bandpass filter is determined based on the half-power point width of the spectral peak, ensuring that frequency components belonging to the same physical source are fully extracted while filtering out interference from other frequency components.
[0089] Through the above processing, several frequency bands are obtained, denoted as FB1, FB2, ..., FB. k ..., FB n Each frequency band represents a set of related frequency components in the error signal, which together correspond to a specific source of error, such as installation eccentricity, code disk marking error, bearing periodic vibration, etc.
[0090] Step 2: Perform inverse Fourier transform on each frequency band to obtain the time-domain component signal: For each frequency band obtained in step one, perform an inverse Fourier transform; the inverse Fourier transform restores the frequency domain information to the time domain information, and obtains the time domain component signal corresponding to each frequency band.
[0091] Specifically, for frequency band FB kThe frequency domain data (including the amplitude and phase of each frequency component within the frequency band) is taken as input, and an inverse Fourier transform is performed. The output is the time domain signal sk(θ1) corresponding to the frequency band, where θ1 represents the phase angle. Sk(θ1) reflects the waveform of the error component represented by the frequency band as the phase angle changes.
[0092] Since each frequency band contains only frequency components with a limited bandwidth, its corresponding time-domain component signal sk(θ1) is a relatively pure signal, mainly reflecting the contribution of the error source corresponding to that frequency band, while filtering out the interference of other frequency components; this processing is equivalent to decomposing the composite error signal into several single-source components with clear physical meaning.
[0093] Step 3: Calculate the instantaneous amplitude envelope of each time-domain component signal to obtain the energy distribution curve: After obtaining the time-domain component signal sk(θ1) for each frequency band, it is necessary to further analyze the energy distribution of the signal in the phase domain. Since sk(θ1) is an oscillating signal, its instantaneous amplitude changes with the phase, and it is difficult to intuitively reflect the energy concentration area using the original waveform directly.
[0094] The instantaneous amplitude envelope of each time-domain component signal is calculated using the Hilbert transform method. The specific steps are as follows: Perform a Hilbert transform on sk(θ1) to obtain its orthogonal components. Constructing analytic signals Taking the modulus of the analytic signal, we obtain the instantaneous amplitude envelope Ak(θ) = |zk(θ1)|. The instantaneous amplitude envelope Ak(θ) reflects the instantaneous energy magnitude of the error component corresponding to that frequency band at different phase points. The higher the amplitude, the greater the contribution of that frequency component at that phase point.
[0095] The instantaneous amplitude envelope is smoothed and filtered to remove high-frequency fluctuations, resulting in the energy distribution curve Ek(θ1) of this frequency band in the phase domain. The energy distribution curve Ek(θ1) is a non-negative function whose value varies with the phase, and the peak region corresponds to the phase interval where the error energy is concentrated.
[0096] Step four: Perform threshold segmentation on the energy distribution curve to determine the high-frequency energy concentration range: For each frequency band's energy distribution curve Ek(θ1), an energy threshold Tk is set. The energy threshold is determined based on the characteristics of the energy distribution in that frequency band; for example, it can be taken as 50% of the maximum value of Ek(θ1).
[0097] On the Ek(θ1) curve, identify all continuous phase intervals where the amplitude exceeds the energy threshold Tk. These continuous phase intervals are defined as the high-frequency energy concentration intervals corresponding to that frequency band. Each frequency band may correspond to one or more discontinuous high-frequency energy concentration intervals, denoted as Hk1, Hk2, Hk3, ...
[0098] Through the above processing, all high-frequency energy concentration intervals of all frequency bands are obtained, forming a set. Each element is a continuous phase interval, indicating that the energy of a certain frequency band is highly concentrated within a certain phase range.
[0099] Step 5: Superimpose all high-frequency energy concentration zones to generate a superimposed energy distribution map: All high-frequency energy concentration intervals obtained in step four are superimposed and analyzed in the phase domain. Specifically, the entire phase domain [0°, 360°) is discretized into N equally spaced phase points. At each phase point θ-i, the number of high-frequency energy concentration intervals covering that point is counted.
[0100] By connecting the superimposed layers of all phase points in phase order, a superimposed energy distribution map is obtained. This distribution map reflects the number of layers covered by high-frequency energy concentration zones of different frequency bands in each phase interval. The higher the number of layers, the more high-frequency energy from more frequency bands the phase interval is affected by at the same time, and the more complex and severe the error fluctuations are.
[0101] For example, if a phase interval is covered by the high-frequency energy concentration intervals of frequency bands A, B, and C, the number of superposition layers is 3; if it is only covered by frequency band A, the number of superposition layers is 1; if it is not covered by any frequency band, the number of superposition layers is 0.
[0102] Step 6: Divide the composite high-frequency range into different levels according to the number of stacking layers: Based on the number of superposition layers in the superposition energy distribution map, the phase domain is divided into composite high-frequency regions of different levels. The specific division method is as follows: Set a first layer threshold and a second layer threshold, where the first layer threshold is higher than the second layer threshold. For example, the first layer threshold can be set to 3, and the second layer threshold to 2. Then: All continuous phase intervals with a stacking number of ≥3 are defined as the first-level composite high-frequency intervals; All continuous phase intervals with 2 ≤ number of stacking layers < 3 are defined as the second-level composite high-frequency intervals; All continuous phase intervals with 1 ≤ number of superposition layers < 2 are defined as the third-level composite high-frequency intervals (if necessary).
[0103] All phase intervals with a stacking layer number of 0 are defined as non-high frequency intervals (i.e., the other intervals mentioned above).
[0104] Step 7: Assign differentiated sampling densities to different levels of composite high-frequency intervals: Differentiated sampling densities are allocated based on the number of stacking layers in each level of composite high-frequency range: Within the first-level composite high-frequency range, a sixth sampling density, higher than the first sampling density, is used for sampling. This sixth sampling density should adequately meet the complex waveform sampling requirements of the multi-frequency superposition region, ensuring accurate capture of the fine features generated by the interaction of multiple frequency components. The specific value of the sixth sampling density can be determined based on the number of superposition layers; for example, it can be 3 to 4 times the first sampling density.
[0105] Within the second-level composite high-frequency range, a seventh sampling density, between the first and sixth sampling densities, is used. The seventh sampling density must be higher than the first sampling density to reflect the multi-frequency superposition nature of this region, while being lower than the sixth sampling density to reflect the relatively low number of superposition layers. The specific value of the seventh sampling density can be determined based on the number of superposition layers; for example, it can be 2 to 3 times the first sampling density.
[0106] If a third-level composite high-frequency range exists, an eighth sampling density, which is between the first and seventh sampling densities, can be used for sampling, and so on, to form a sampling density gradient that matches the number of stacked layers.
[0107] Step 8: Implement layered sampling in the composite high-frequency range: Based on the aforementioned defined composite high-frequency interval division and differentiated sampling density, the phase domain is sampled in layers, with the sampling process executed sequentially according to the interval hierarchy: First, locate all first-level composite high-frequency intervals; within each first-level composite high-frequency interval, uniformly set sampling points at the sixth sampling density.
[0108] Secondly, locate all second-level composite high-frequency intervals. Within each second-level composite high-frequency interval, uniformly set sampling points at a seventh sampling density.
[0109] Next, locate all third-level composite high-frequency ranges (if any) and set sampling points with the corresponding sampling density.
[0110] Finally, for the non-high frequency range (the region with 0 stacking layers), the second sampling density is still used for sampling.
[0111] All sampling points at all levels are merged in phase order to form a complete set of sampling points.
[0112] This preferred solution identifies composite high-frequency regions through layer number analysis and allocates sampling density in a hierarchical manner, solving the problems of difficulty in identifying multi-frequency component superposition regions and differentiated sampling requirements. This solution precisely matches the distribution of sampling points with the complexity of multi-frequency superposition, further enhancing the adaptability of non-uniform sampling strategies to complex error characteristics. It is particularly suitable for high-end encoder applications with complex error sources and rich harmonic components, such as high-precision machine tool spindles, robot joints, and spacecraft pointing mechanisms.
[0113] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.
Claims
1. A photoelectric encoder error compensation method, characterized in that... ,include: Obtain the original position set of the photoelectric encoder in operation and calculate the error sequence between its actual position and theoretical position; The error sequence is subjected to a Fourier transform to obtain the error spectrum distribution, which includes the amplitude and phase interval of each frequency component; Analyze the error spectrum distribution to determine the high-frequency component interval; the high-frequency component interval is the phase interval corresponding to the frequency component whose amplitude exceeds the threshold. Based on the analysis results of the error spectrum distribution, the error sequence is non-uniformly segmented for sampling to obtain a set of sampling points; the high-frequency component interval is the first sampling density; the other intervals outside the high-frequency component interval are the second sampling density, and the first sampling density is greater than the second sampling density; Construct an error compensation table of the original position and error compensation value of the sampling point set; query the error compensation table to obtain the error compensation value of the current position of the photoelectric encoder.
2. The photoelectric encoder error compensation method according to claim 1, characterized in that... Based on the analysis results of the error spectrum distribution, the error sequence is subjected to non-uniform segmentation sampling, including: From the boundary of the high-frequency component interval, it extends inward and outward respectively to form a first transition interval and a second transition interval. Within the first transition interval and the second transition interval, a third sampling density between the first sampling density and the second sampling density is used for sampling; the third sampling density gradually decreases from the boundary of the high-frequency component interval to the second sampling density in the direction of the other intervals, so that the sampling point density transitions smoothly at the interval boundary.
3. The photoelectric encoder error compensation method according to claim 2, characterized in that... The first sampling density is 4.5~5.5 points / degree; the second sampling density is 0.5~1 points / degree.
4. The photoelectric encoder error compensation method according to claim 1, characterized in that... Based on the analysis results of the error spectrum distribution, the error sequence is subjected to non-uniform segmentation sampling, which further includes: Obtain the spectral amplitude corresponding to each phase point within the high-frequency component interval; Based on the distribution of the spectral amplitude within the high-frequency component interval, the high-frequency component interval is divided into two sub-intervals to generate at least two sub-intervals, including a first sub-interval and a second sub-interval, wherein the average spectral amplitude in the first sub-interval is higher than the average spectral amplitude in the second sub-interval. Within the first sub-interval, sampling is performed using a fourth sampling density that is higher than the first sampling density; within the second sub-interval, sampling is performed using a fifth sampling density that is lower than the fourth sampling density but higher than the second sampling density.
5. The photoelectric encoder error compensation method according to any one of claims 1-4, characterized in that... The process of querying the error compensation table to obtain the error compensation value of the current position of the photoelectric encoder includes: if the current position does not match the index value in the error compensation table, locating two sampling points adjacent to the current position in the error compensation table, obtaining the original positions of the two sampling points and their corresponding error compensation values, and calculating the error compensation value of the current position based on interpolation.
6. The photoelectric encoder error compensation method according to claim 5, characterized in that... The error compensation value for the current position is calculated based on interpolation, including: Obtain the angular distance between two sampling points adjacent to the current position; If the angular distance exceeds the threshold, the error change rate at the two sampling points is obtained; Based on the original positions of the two sampling points, the error compensation value, and the error change rate, a piecewise cubic interpolation algorithm is used to calculate the error compensation value of the current position.
7. The photoelectric encoder error compensation method according to claim 1, characterized in that... Obtain the original position set of the photoelectric encoder in its operating state, including: The photoelectric encoder is controlled to rotate at a constant speed, and the original position readings output by the photoelectric encoder are collected at fixed time intervals during the rotation to generate the original position set; the original position set is subjected to coarse error detection and rejection to obtain the purified actual position; Simultaneously, the reference position reading output synchronously by the reference measuring device is acquired to generate the theoretical position.
8. The photoelectric encoder error compensation method according to claim 1, characterized in that... Analyze the error spectrum distribution to determine the high-frequency component range, including: Bandpass filtering is performed on each frequency component in the error spectrum distribution to extract the spectral peaks of the frequency components whose amplitude exceeds the threshold. Each spectral peak corresponds to a frequency band. Perform an inverse Fourier transform on each frequency band to obtain the time-domain component signal corresponding to that frequency band; calculate the instantaneous amplitude envelope of each time-domain component signal to obtain the energy distribution curve of that frequency band in the phase domain; The energy distribution curve is segmented by a threshold, and the continuous phase intervals where the energy amplitude exceeds the energy threshold are determined as the high-frequency energy concentration intervals corresponding to that frequency band.
9. The photoelectric encoder error compensation method according to claim 8, characterized in that... After determining the high-frequency energy concentration range corresponding to each frequency band, the method further includes: The high-frequency energy concentration intervals of all frequency bands are superimposed in the phase domain to generate a superimposed energy distribution map, which reflects the number of layers covered by the high-frequency energy concentration intervals of different frequency bands for each phase interval. Based on the number of superimposed layers, the phase domain is divided into at least two different levels of composite high-frequency intervals, including a first-level composite high-frequency interval and a second-level composite high-frequency interval, wherein the number of superimposed layers in the first-level composite high-frequency interval is higher than the number of superimposed layers in the second-level composite high-frequency interval. Within the first-level composite high-frequency range, sampling is performed using a sixth sampling density that is higher than the first sampling density; within the second-level composite high-frequency range, sampling is performed using a seventh sampling density that is between the first sampling density and the sixth sampling density.
10. The photoelectric encoder error compensation method according to claim 9, characterized in that... The sixth sampling density is 3 to 4 times the first sampling density; the seventh sampling density is 2 to 3 times the first sampling density.