Error detection method for optoelectronic shaft angle encoder based on harmonic analysis
Patent Information
- Application Number
- CN202611076265.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-20
- Publication Date
- 2026-10-20
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention belongs to the field of encoder error detection technology, and relates to an error detection method for photoelectric shaft angle encoders based on harmonic analysis. Background Technology
[0002] An optoelectronic shaft angle encoder is a measuring device that converts mechanical angular displacement into digital angle signals. It is widely used in angular position measurement and servo control in CNC machine tools, industrial robots, and other fields. Eccentricity and tilt of the encoder code disk are the main sources of error. However, as the rotational speed increases, centrifugal deformation of the shaft and changes in bearing clearance caused by temperature rise result in dynamic time-varying characteristics for the eccentricity and tilt angle. This generates first and second harmonic disturbances related to the rotation angle, causing periodic jumps in the output angle within a specific azimuth range.
[0003] Currently, existing technologies for error detection in photoelectric shaft angle encoders still have the following shortcomings: First, the calibration specifications of existing photoelectric shaft angle encoders are still based on static discrete measurements, measuring angular deviations at a finite number of discrete angle points, and then obtaining correction values for arbitrary angle positions through linear interpolation or list correction. This cannot obtain complete error distribution information of the encoder during continuous rotation, making it difficult to accurately identify the specific contribution magnitude and direction of each error source, and thus failing to effectively guide the structural optimization and assembly process improvement of the encoder.
[0004] In addition, existing encoder error detection is mostly completed under static or low-speed quasi-static conditions, which makes it difficult to reflect the dynamic error characteristics of the encoder under actual operating speed due to factors such as centrifugal force and bearing vibration. This means that encoders that are calibrated under static conditions may still have large measurement deviations when running at high speeds, especially for encoders with small code disk grating pitch and a large number of subdivisions. Summary of the Invention
[0005] In view of this, in order to solve the problems mentioned in the background art, the present invention provides an error detection method for photoelectric shaft angle encoder based on harmonic analysis.
[0006] The objective of this invention can be achieved through the following technical solution: an error detection method for photoelectric shaft angle encoder based on harmonic analysis, comprising: acquiring four light intensity signals output by dual reading heads arranged in a diametrical manner, and performing sum and difference operations on the corresponding signals of the two reading heads to obtain the common mode component of the installation tilt error and the differential mode component of the radial eccentricity error;
[0007] Spectral analysis was performed on the common-mode and differential-mode components respectively. Based on the fact that the energy of the eccentricity error is concentrated at the fundamental frequency and the energy of the tilt error is concentrated at the second harmonic, the location of the peak frequency of each spectrum was determined. The fundamental frequency component was classified as the eccentricity error feature and the second harmonic component was classified as the tilt error feature.
[0008] The fundamental frequency component and the second harmonic component are expanded in the integer angular domain, and their amplitude and phase information are extracted by the least squares projection method to obtain the eccentricity error envelope and the tilt error envelope.
[0009] The amplitude and initial phase of the eccentricity error characteristics and tilt error characteristics are integrated to form the eccentricity vector and tilt vector;
[0010] Error compensation is performed on the eccentric vector and tilt vector. Based on the current encoder angle value, the error components corresponding to the two vectors are synthesized and phase-aligned to output the compensated angular position data.
[0011] Compared with the prior art, the beneficial effects of the present invention are as follows: (1) The present invention performs sum and difference operations on the four light intensity signals output by the dual reading heads arranged in a diametrical manner, separates the common mode and differential mode components, and then assigns the fundamental frequency component and the second harmonic component to the eccentric error and tilt error respectively through spectrum analysis, thereby realizing the accurate separation of the two errors and the independent extraction of their respective amplitude and phase information. This overcomes the shortcomings of the existing static discrete calibration specifications, which cannot obtain the complete error distribution and are difficult to accurately identify the specific contribution of each error source. It can guide the structural optimization and assembly process improvement of the encoder.
[0012] (2) This invention expands the fundamental frequency component and the second harmonic component in the integer angle domain, extracts the amplitude and phase information by using the least squares projection method, forms the eccentric vector and the tilt vector, and synthesizes the instantaneous compensation amount in real time based on the original angle value output by the encoder at the current moment and deducts it. It can complete dynamic error detection and real-time compensation under the actual working speed of the encoder, overcomes the defects that static or quasi-static detection methods cannot reflect dynamic error characteristics and statically calibrated qualified products still have measurement deviations when running at high speed. It can realize dynamic detection and real-time compensation of eccentric error and tilt error within the working speed range of the encoder, and improve the measurement accuracy of the encoder under dynamic operating conditions. Attached Figure Description
[0013] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0014] Figure 1 This is a diagram illustrating the implementation steps of the method of the present invention;
[0015] Figure 2 This is a flowchart of the encoder spectrum peak frequency determination process of the present invention;
[0016] Figure 3 This is a flowchart illustrating the frequency domain error feature classification of the encoder according to the present invention. Detailed Implementation
[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0018] Please see Figure 1 As shown, the present invention provides an error detection method for photoelectric shaft angle encoder based on harmonic analysis, including: S1, acquiring four light intensity signals output by dual reading heads arranged in a diametrical manner, and performing sum and difference operations on the corresponding signals of the two reading heads to obtain the common mode component of the installation tilt error and the differential mode component of the radial eccentricity error.
[0019] Considering that radial eccentricity error and installation tilt error cause the two reading heads arranged in a radial configuration to produce completely opposite response characteristics at the physical level, that is, radial eccentricity causes the corresponding signals of the two reading heads to change in differential mode, while installation tilt causes the corresponding signals of the two reading heads to change in common mode.
[0020] Based on this, four light intensity signals output by the dual reading heads arranged in a diametrical configuration are obtained, and the sum and difference operations are performed on the corresponding signals of the two reading heads as follows: the original light intensity signals containing two orthogonal signals are obtained from the first and second reading heads arranged in a diametrical configuration.
[0021] Specifically, the photoelectric shaft angle encoder includes a code disk, a light source, a first reading head, a second reading head, and a signal processing circuit. The first and second reading heads are aligned along the diameter direction of the code disk. The encoder is arranged at an angle to the diameter and is fixedly installed on the encoder housing. The code disk is fixedly installed on the rotating shaft and rotates synchronously with the shaft.
[0022] During signal acquisition, the light beam emitted by the light source is modulated by the grating lines on the code disk, carrying the rotation angle information to the first and second reading heads respectively. The photoelectric receiving elements inside each reading head convert the received light signal into an electrical signal, which is then pre-amplified, differentially amplified, and converted from analog to digital, outputting a digitized raw light intensity signal. The raw light intensity signal output by the first reading head includes two orthogonal signals with a 90° phase difference. and and its inverted signal and The raw light intensity signal output by the second reading head also includes two orthogonal signals. and and its inverted signal and .
[0023] Identify signal pairs in the original light intensity signal that belong to the same phase channel and originate from the first and second reading heads, respectively.
[0024] The phase detection method is as follows: zero-crossing detection is performed on the four signals output from the first reading head and the four signals output from the second reading head, and the zero-crossing time of the rising edge of each signal is recorded. ; Calculate the time difference between the zero-crossing moments of each signal within the same reading head. Time difference The ratio of the signal period T to the signal period T is Two signals within the range are determined to be in orthogonal phase, where ε is a preset tolerance threshold, ranging from 0.01 to 0.05; the time difference between the zero-crossing moments of different reading heads is used. exist Two signals within the range are determined to belong to the same phase channel, where δ is a preset time tolerance threshold, and the value range is 0.1% to 1% of the signal period.
[0025] In this embodiment, among the four signals output by each reading head, one signal has a fixed phase difference of one-quarter of a cycle from another signal. Two signals belonging to the same phase channel exhibit consistent phase change patterns at the same rotation angle of the encoder. Therefore, by performing phase detection on each signal, two signals with consistent phase change patterns are determined to belong to the same channel, thereby identifying the phase channel to which each signal belongs.
[0026] All identified signal pairs are summed to separate the signal components of the tilt error common-mode variation, which are then used as the common-mode components.
[0027] The tilt error, at the physical level, causes the light intensity signals output from the corresponding channels of the two diametrically aligned reading heads to change in the same direction. That is, both reading heads simultaneously experience the same increase or decrease in light intensity in the same direction caused by the code disk tilt. Based on this physical difference, by performing a summation operation on the signal pairs from the first and second reading heads that belong to the same phase channel, the tilt error components changing in the middle direction of the two signals can be superimposed and strengthened, while the eccentric error components changing in opposite directions cancel each other out due to their opposite signs. This separates the tilt error component from the original mixed signal.
[0028] All identified signal pairs are subtracted to separate the signal components of radial eccentricity error differential mode variation, which are then used as differential mode components.
[0029] At the physical level, radial eccentricity error causes inverse changes in the light intensity signals output from corresponding channels of two radially aligned reading heads. Specifically, when code disk eccentricity leads to a decrease in the relative distance between one reading head and the code disk, resulting in signal enhancement, the relative distance between the other radially aligned reading head and the code disk increases, resulting in signal weakening. Based on this difference in physical characteristics, by performing a difference operation on the signal pairs from the first and second reading heads that belong to the same phase channel, the inversely changing eccentricity error components in the two signals can be amplified due to their opposite signs, while the inversely changing tilt error components cancel each other out, thereby separating the eccentricity error component from the original mixed signal.
[0030] S2. Perform spectral analysis on the common-mode component and the differential-mode component respectively. Based on the fact that the energy of the eccentricity error is concentrated at the fundamental frequency and the energy of the tilt error is concentrated at the second harmonic, determine the location of the peak frequency of each spectrum. Assign the fundamental frequency component to the eccentricity error feature and the second harmonic component to the tilt error feature.
[0031] Because eccentricity error and tilt error have different periodic characteristics at the physical level, the former completes a full modulation every time the code disk rotates once, while the latter completes a full modulation every half rotation. As a result, multiple frequency components will appear in the spectrum analysis results, and the source of error corresponding to each component cannot be determined solely based on the magnitude of the amplitude.
[0032] See Figure 2 As shown, the specific determination of the location of each spectrum peak frequency is as follows: Perform spectrum transformation operations on the common-mode component and the differential-mode component respectively to obtain the common-mode spectrum and the differential-mode spectrum.
[0033] For both the common-mode and differential-mode spectra, identify the amplitude maxima within a preset frequency neighborhood, and record the frequencies corresponding to the amplitude maxima as candidate frequencies.
[0034] The encoder's rotational speed may fluctuate slightly, and spectral analysis suffers from limited frequency resolution due to limitations in sampling duration and frequency. This means that the theoretical fundamental frequency component may not fall precisely on a single frequency point in the actual spectrum, but rather exhibits energy diffusion or peak shift within a certain frequency range around the theoretical fundamental frequency value. To address this issue, the preset frequency neighborhood range is centered on the encoder's theoretical rotational fundamental frequency, extending to the left and right by the width of one frequency resolution unit. This frequency resolution unit is equal to the ratio of the sampling frequency to the number of sampling points.
[0035] The fundamental frequency of rotation is determined based on the rotation speed of the encoder. Candidate frequencies at the fundamental frequency position are marked as fundamental frequency peaks, and candidate frequencies at the second harmonic position are marked as harmonic peaks.
[0036] When there is a large error in the encoder's original angle output, the rotational speed is directly obtained through an external speed measuring device. If there is no external speed measuring device, the original angle data is low-pass filtered before numerical differentiation to suppress the influence of high-frequency errors on the fundamental frequency estimation. The cutoff frequency of the low-pass filter is set to 3 to 5 times the rotational speed frequency.
[0037] The fundamental frequency of an encoder refers to the number of revolutions the code disk makes per second, and its value is determined by the current rotational speed of the encoder. Specifically, the fundamental frequency can be obtained by differentiating the encoder's output angle data with time to get the real-time rotational speed, or it can be directly provided by an external speed measuring device.
[0038] Because radial eccentricity error modulates the signal completely once during each rotation of the code disk, its spectral peak frequency is consistent with the rotation fundamental frequency; while installation tilt error modulates the signal completely once during each half-rotation of the code disk, its spectral peak frequency is twice the rotation fundamental frequency. Based on this correspondence, after obtaining candidate frequencies, candidate frequencies located at the theoretical value of the fundamental frequency are marked as fundamental frequency peaks and classified as eccentricity error features, while candidate frequencies located at the theoretical value of the second harmonic are marked as harmonic peaks and classified as tilt error features.
[0039] See Figure 3 As shown, the fundamental frequency component is classified as an eccentricity error feature, and the second harmonic component is classified as a tilt error feature. This includes using the uniform angle sequence obtained by resampling the encoder's angle measurement values at equal intervals as the independent variable, and constructing a fundamental frequency orthogonal function basis and a second harmonic orthogonal function basis in the integer angle domain.
[0040] The angle measurements output by the encoder during variable speed operation are non-uniformly sampled data in the time domain. To meet the requirement of equal intervals for independent variables in least squares projection, the original angle measurements output by the encoder are first resampled at equal intervals. Specifically, the sequence of original angle measurements output by the encoder is used as the basis for this process. and its corresponding timestamp Set the angle interval as input. The value ranges from 0.1° to 1°, with 0.5° being preferred, for the target angle sequence. Search in the original sequence The adjacent points are calculated by interpolation. corresponding time Then, the original signal sequence is processed in... Interpolation and resampling are performed at the location to obtain a uniform angle domain signal sequence.
[0041] The fundamental frequency orthogonal function basis is constructed as follows: Using each angle value in the uniform angle sequence as input, two fundamental frequency function values are calculated. The first fundamental frequency function value is equal to the cosine of the angle value, and the second fundamental frequency function value is equal to the sine of the angle value. The two fundamental frequency functions are orthogonal to each other across the integer angle domain. The second harmonic frequency orthogonal function basis is constructed as follows: Using each angle value in the same uniform angle sequence as input, two second harmonic frequency function values are calculated. The first second harmonic frequency function value is equal to the cosine of twice the angle value, and the second second harmonic frequency function value is equal to the sine of twice the angle value. The two second harmonic frequency functions are orthogonal to each other across the integer angle domain.
[0042] The fundamental frequency orthogonal function basis and the second harmonic orthogonal function basis are orthogonal to each other in a uniform angular sequence in the integer angular domain, that is, their inner product is zero in the range of 0° to 360°.
[0043] The common-mode component and the differential-mode component are respectively projected onto the fundamental frequency orthogonal function basis by least squares, and the fundamental frequency orthogonal coefficients obtained by the projection are extracted. The vector components represented by the fundamental frequency orthogonal coefficients are classified as eccentricity error features.
[0044] The specific steps for extracting the fundamental frequency component from the common-mode and differential-mode components using the least-squares projection method are as follows: Using the constructed fundamental frequency orthogonal function basis as the projection basis, the common-mode and differential-mode components are taken as the signals to be projected. The projection coefficients of each signal to be projected are calculated in each component direction of the fundamental frequency orthogonal function basis. Since the fundamental frequency orthogonal function basis is mutually orthogonal in the integer angular domain, the component channels do not interfere with each other during projection calculation. The fundamental frequency orthogonal coefficients are obtained by calculating the inner product of the signal to be projected with each basis function in the fundamental frequency orthogonal function basis. Here, the fundamental frequency orthogonal coefficients contain two components, corresponding to two mutually orthogonal directions in the fundamental frequency orthogonal function basis.
[0045] Since the fundamental frequency component corresponds to the radial eccentricity error generated by one complete modulation per revolution of the code disk, the amplitude of this vector component reflects the magnitude of the eccentricity error, and its phase reflects the direction of the eccentricity error. Thus, the eccentricity error characteristic is expressed in vector form by the fundamental frequency orthogonal coefficients, and is used for envelope reconstruction and error compensation.
[0046] The common-mode component and the differential-mode component are respectively projected onto the second harmonic orthogonal function basis by least squares, and the second harmonic orthogonal coefficients obtained by the projection are extracted. The vector components represented by the second harmonic orthogonal coefficients are classified as tilt error features.
[0047] The specific steps for extracting the second harmonic components from the common-mode and differential-mode components using the least squares projection method are as follows: Using the constructed second harmonic orthogonal function basis as the projection basis, the common-mode and differential-mode components are taken as the signals to be projected, and the projection coefficients of each signal to be projected are calculated in each component direction of the second harmonic orthogonal function basis. Since the second harmonic orthogonal function basis is mutually orthogonal in the integer angular domain, the component channels do not interfere with each other during projection calculation. The second harmonic orthogonal coefficients can be obtained by calculating the inner product of the signal to be projected with each basis function in the second harmonic orthogonal function basis. Here, the second harmonic orthogonal coefficients contain two components, corresponding to two mutually orthogonal directions in the second harmonic orthogonal function basis.
[0048] Because the second harmonic component corresponds to the installation tilt error that generates one complete modulation every half revolution of the code disk, its amplitude reflects the magnitude of the tilt error, and its phase reflects the direction of the tilt error. Thus, the tilt error characteristic is expressed in vector form by the second harmonic orthogonal coefficients, which is used for subsequent envelope reconstruction and error compensation.
[0049] The fundamental frequency orthogonal function basis and the second harmonic orthogonal function basis satisfy an orthogonal relationship in the integer angular domain under a uniform angular sequence, so as to decouple and assign the fundamental frequency component and the second harmonic component during the projection process.
[0050] The fundamental frequency orthogonal function basis and the second harmonic orthogonal function basis satisfy an orthogonal relationship in the integer angle domain, which is independent of the actual rotation speed of the code disk. Specifically, in the integer range of 0° to 360°, the sum of the product between any component of the fundamental frequency orthogonal function basis and any component of the second harmonic orthogonal function basis over the integer angle is zero.
[0051] When the encoder speed change rate exceeds 20% / second of the maximum speed, the sampling time of the spectrum analysis is shortened. The shortened sampling time is equal to the standard sampling time multiplied by the ratio of the speed change rate limit to the real-time speed change rate, where the speed change rate limit is 20% / second of the maximum speed.
[0052] S3. Expand the fundamental frequency component and the second harmonic component in the integer angular domain, and extract their amplitude and phase information using the least squares projection method to obtain the eccentricity error envelope and the tilt error envelope.
[0053] Since the eccentricity error and tilt error take different instantaneous values with different angular positions during the rotation of the code disk, in order to obtain the error distribution sequence for each angular position for subsequent angular alignment compensation, the above-mentioned steps of expanding the fundamental frequency component and the second harmonic component in the integer angular domain are as follows: obtain the fundamental frequency orthogonal coefficients corresponding to the eccentricity error characteristics and the second harmonic orthogonal coefficients corresponding to the tilt error characteristics.
[0054] By multiplying the fundamental frequency orthogonal coefficients with the fundamental frequency orthogonal function basis and then superimposing them, we obtain the eccentricity error sequence of the fundamental frequency component as a function of the uniform angle sequence in the integer angular domain.
[0055] After obtaining the fundamental frequency orthogonal coefficients, they exist as two components, corresponding to the projection weights of the eccentricity error in the two orthogonal directions of the fundamental frequency orthogonal function basis. The two basis functions in the fundamental frequency orthogonal function basis represent the angular changes in the two orthogonal directions during the code disk rotation. Multiplying the corresponding coefficients by the function values of their respective basis functions at each angle and summing them synthesizes the fixed vector of the eccentricity error along each angular direction, thus obtaining the instantaneous projection value of the eccentricity error at each angular position, i.e., the sequence of instantaneous error values that varies with the uniform angular sequence. This sequence of instantaneous error values describes the specific deviation of the measurement result caused by the eccentricity error at each angular position of the code disk.
[0056] By reconstructing the second harmonic orthogonal coefficients and the second harmonic orthogonal function basis, the tilt error of the second harmonic component varies with the angle in the integer angular domain.
[0057] The reconstruction operation steps for the second harmonic orthogonal coefficients and the second harmonic orthogonal function basis are as follows: The second harmonic orthogonal coefficients contain two components, each corresponding to one of the two basis function directions in the second harmonic orthogonal function basis. During the reconstruction operation, each angle value in the obtained uniform angle sequence is used as the independent variable. The function values of the two basis functions in the second harmonic orthogonal function basis at each angle position are calculated. The first component of the second harmonic orthogonal coefficient is multiplied point-by-point by the function value of the first basis function at each angle. Simultaneously, the second component of the second harmonic orthogonal coefficient is multiplied point-by-point by the function value of the second basis function at each angle. The results of the two point-by-point multiplications are summed at each angle position. The resulting sequence is the instantaneous value sequence of the tilt error of the second harmonic component as a function of the uniform angle sequence in the integer angular domain. This instantaneous value sequence reflects the specific deviation of the measurement results caused by the installation tilt error of the code disk at each angular position.
[0058] The above-mentioned methods for obtaining the eccentricity error envelope and tilt error envelope include: determining the magnitude of the fundamental frequency orthogonal coefficients as the amplitude of the eccentricity error characteristic, and determining the argument of the fundamental frequency orthogonal coefficients as the initial phase of the eccentricity error characteristic;
[0059] The fundamental frequency orthogonality coefficient comprises two values, denoted as the first fundamental frequency coefficient and the second fundamental frequency coefficient, respectively. These correspond to the directions of two mutually orthogonal basis functions in the fundamental frequency orthogonality function basis. Using the first fundamental frequency coefficient as the abscissa and the second fundamental frequency coefficient as the ordinate, a vector point is determined in a two-dimensional coordinate system. Based on this, the amplitude is determined as follows: the straight-line distance from the vector point to the origin is taken as the amplitude, i.e., the amplitude of the eccentricity error characteristic. Specifically, the straight-line distance is obtained by calculating the square root of the sum of the squares of the first and second fundamental frequency coefficients.
[0060] The initial phase is determined as follows: A vector is drawn starting from the origin and ending at the vector point. The angle between this vector and the positive direction of the horizontal axis is taken as the initial phase, i.e., the initial phase of the eccentricity error characteristic. Specifically, if the second fundamental frequency coefficient is greater than zero, the angle is the arctangent of the ratio of the first to the second fundamental frequency coefficient. If the second fundamental frequency coefficient is less than zero, the angle is the arctangent of the ratio of the first to the second fundamental frequency coefficient plus one period angle. If the second fundamental frequency coefficient is equal to zero and the first fundamental frequency coefficient is greater than zero, the angle is zero. If the second fundamental frequency coefficient is equal to zero and the first fundamental frequency coefficient is less than zero, the angle is half of one period angle.
[0061] Using the amplitude and initial phase, the fundamental frequency error value is calculated point by point in the integer angular domain according to a uniform angular sequence, and the calculated error values at each angular position are arranged in angular order to form an eccentricity error envelope.
[0062] The magnitude of the second harmonic orthogonal coefficients is determined as the amplitude of the tilt error characteristic, and the argument of the second harmonic orthogonal coefficients is determined as the initial phase of the tilt error characteristic.
[0063] The tilt error completes a full cycle change every half rotation of the code disk. Its second harmonic quadrature coefficient contains two orthogonal components, which together form a two-dimensional vector. The magnitude of the vector reflects the magnitude of the tilt error, and the argument reflects the initial phase shift of the tilt error relative to the zero-angle position. Therefore, the magnitude of the second harmonic quadrature coefficient is determined as the amplitude, and the argument is determined as the initial phase.
[0064] The second harmonic error value is calculated point by point in the integer angular domain using the amplitude and initial phase according to a uniform angular sequence. The calculated error values at each angular position are then arranged in angular order to form the tilt error envelope.
[0065] S4. Integrate the amplitude and initial phase of the eccentricity error characteristics and tilt error characteristics to form the eccentricity vector and tilt vector.
[0066] Specifically, the steps for forming the eccentric vector and the tilt vector are as follows: using the amplitude and initial phase of the eccentric error feature and the tilt error feature as the polar radius and polar angle respectively, and performing coordinate transformation from polar coordinates to rectangular coordinates, calculate the two projection values of each vector in the orthogonal direction, and merge and store them as the corresponding eccentric vector and tilt vector.
[0067] The steps for converting polar coordinates to rectangular coordinates are as follows: For eccentricity error characteristics, using its amplitude as the polar radius and the initial phase as the polar angle, calculate the projection values of the vector along two mutually perpendicular coordinate axes. The first projection value equals the amplitude multiplied by the cosine of the initial phase, and the second projection value equals the amplitude multiplied by the sine of the initial phase. Combine and store these two projection values as the eccentricity vector. Similarly, for tilt error characteristics, using its amplitude as the polar radius and the initial phase as the polar angle, calculate the projection values of the vector along two orthogonal directions, and combine and store them as the tilt vector.
[0068] S5. Perform error compensation on the eccentric vector and tilt vector. Based on the current encoder angle value, synthesize the error components corresponding to the two vectors and align their phases to output the compensated angular position data.
[0069] Considering that the error vector is fixed while the current angle value of the encoder is constantly changing, the above error compensation for the eccentric vector and tilt vector includes: obtaining the original angle value output by the encoder at the current moment, extracting its length value and direction angle from the eccentric vector, adding the original angle value and direction angle to obtain the eccentric reference phase, using the length value as the amplitude and the eccentric reference phase as the phase, and calculating the instantaneous compensation amount of the eccentric error according to the sine function.
[0070] The eccentric vector is stored in rectangular coordinates and contains two orthogonal components, denoted as the eccentric in-phase component and the eccentric quadrature component, respectively. When extracting the length and direction angle from the eccentric vector, the length value is equal to the square root of the sum of the squares of the eccentric in-phase component and the squares of the eccentric quadrature component, and the direction angle is equal to the arctangent of the ratio of the eccentric quadrature component to the eccentric in-phase component.
[0071] During real-time error compensation, the original angle value output by the encoder at the current moment is obtained. This original angle value is then added to the direction angle of the eccentric vector to obtain the eccentric reference phase. Next, using the length of the eccentric vector as the amplitude and the eccentric reference phase as the phase, the instantaneous eccentric error compensation at the current angular position is calculated according to a sine function. Specifically, the instantaneous eccentric error compensation is equal to the length value multiplied by the negative of the sine of the eccentric reference phase. Here, the sine of the eccentric reference phase is the sine of the sum of the original angle value and the direction angle.
[0072] When the eccentric reference phase is zero degrees, the instantaneous compensation for eccentricity error is zero; when the eccentric reference phase is 90°, the instantaneous compensation for eccentricity error is equal to the length value.
[0073] The length and direction angle are extracted from the tilt vector. The tilt reference phase is obtained by adding twice the original angle value to the direction angle. The instantaneous compensation amount for tilt error is generated by using the length value as the amplitude and the tilt reference phase as the phase.
[0074] The instantaneous compensation for tilt error is calculated according to a sine function, which is as follows: the instantaneous compensation for tilt error equals the length value multiplied by the negative of the sine of the tilt reference phase. The sine of the tilt reference phase is the sine of the sum of twice the original angle value and the direction angle.
[0075] The spatial period of the eccentricity error is an integer cycle, while the spatial period of the tilt error is half a cycle. The instantaneous deviations of the two change with different frequencies as the angle changes. If they are directly added together, it will lead to inconsistencies in the angle reference. Therefore, the error components corresponding to the two vectors are synthesized and their phases aligned as follows: the eccentric in-phase component and the eccentric quadrature component are extracted from the eccentricity vector, and the tilt in-phase component and the tilt quadrature component are extracted from the tilt vector.
[0076] Using the current angle as the phase reference, the eccentric in-phase component and the eccentric quadrature component are multiplied by the cosine and sine values of the current angle, respectively, and then added together to obtain the instantaneous projection value of the eccentric vector at the current angle.
[0077] The tilted in-phase component and the tilted quadrature component are multiplied by the cosine and sine values, which are twice the current angle, respectively, and then added together to obtain the instantaneous projection value of the tilted vector at the current angle.
[0078] The instantaneous projection value of the eccentric vector is added to the instantaneous projection value of the tilt vector to obtain the comprehensive error compensation amount at the current angle.
[0079] The instantaneous projection value of the eccentric vector represents the deviation of the measurement result caused by the radial eccentricity error at the current angular position, while the instantaneous projection value of the tilt vector represents the deviation of the measurement result caused by the installation tilt error at the current angular position. Since both deviations exist in the form of angular deviations and are simultaneously superimposed on the same output value of the encoder, adding them together yields the comprehensive error compensation amount resulting from the combined effect of the two errors at the current angle. Specifically, the comprehensive error compensation amount is equal to the sum of the instantaneous projection values of the eccentric vector and the tilt vector.
[0080] The specific output compensation angular position data is as follows: Obtain the original angle value currently output by the encoder, and subtract the comprehensive error compensation amount from the original angle value to obtain the compensated angular position value;
[0081] Determine whether the compensated angular position value is within the encoder's range. If it is outside the range, perform a modulo operation on the compensated angular position value to convert it to the corresponding position within the encoder's range.
[0082] The modular operation is: ,in The angle value after compensation. This is the original angle value. The mod(a,R) function returns the remainder when a is divided by R, where R is the upper limit of the encoder's range and equals the upper limit of the encoder's total measurement range. The remainder range is [0,R].
[0083] The encoder's angle measurement is periodic. The start and end points of the range correspond to the same physical angle on the code disk in terms of geometric position. The compensated angle position value may be less than the start point or greater than the end point of the range due to the deduction of the compensation amount. Although the above values correspond to a certain physical angle within the range, they cannot be directly recognized and output by the encoder because they do not fall within the range interval. This ensures that the output angle value is always within the effective value range that the encoder can recognize, while maintaining the equivalence of the angle position.
[0084] The encoder's measurement range is determined as follows: the encoder's measurement range is determined by its hardware structure and measurement method. For a single-turn absolute encoder, its measurement range is 0° to 360°; for a multi-turn absolute encoder, its measurement range is the product of 0° to 360° and the total number of turns. Specifically, the measurement range can be directly read from the encoder's technical specifications.
[0085] After outputting the compensated angular position data, the compensated angle value is converted from digital to analog and fed back to the encoder's signal processing circuit. The phase of the angle value is compared with the original light intensity signal to calculate the residual signal. When the amplitude of the residual signal exceeds twice the encoder's nominal accuracy, compensation is stopped and the original angle value is restored.
[0086] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, in the form of a computer program product.
[0087] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0088] In addition, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.
[0089] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0090] Finally, the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for detecting errors in a photoelectric shaft angle encoder based on harmonic analysis, characterized in that: include: The four light intensity signals output by the dual reading heads arranged in a radial direction are acquired, and the sum and difference operations are performed on the corresponding signals of the two reading heads to obtain the common mode component of the installation tilt error and the differential mode component of the radial eccentricity error. Spectral analysis was performed on the common-mode and differential-mode components respectively. Based on the fact that the energy of the eccentricity error is concentrated at the fundamental frequency and the energy of the tilt error is concentrated at the second harmonic, the location of the peak frequency of each spectrum was determined. The fundamental frequency component was classified as the eccentricity error feature and the second harmonic component was classified as the tilt error feature. The fundamental frequency component and the second harmonic component are expanded in the integer angular domain, and their amplitude and phase information are extracted by the least squares projection method to obtain the eccentricity error envelope and the tilt error envelope. The amplitude and initial phase of the eccentricity error characteristics and tilt error characteristics are integrated to form the eccentricity vector and tilt vector; Error compensation is performed on the eccentric vector and tilt vector. Based on the current encoder angle value, the error components corresponding to the two vectors are synthesized and phase-aligned to output the compensated angular position data.
2. The photoelectric shaft angle encoder error detection method based on harmonic analysis according to claim 1, characterized in that: The process of acquiring the four light intensity signals output by the dual reading heads arranged in a diametrical pattern, and performing sum and difference operations on the corresponding signals of the two reading heads, is as follows: The original light intensity signal containing two orthogonal signals is obtained from the first and second reading heads arranged in opposite directions. Identify signal pairs in the original light intensity signal that belong to the same phase channel and originate from the first and second reading heads respectively; All identified signal pairs are summed to separate the signal components of the tilt error common-mode variation, which are then used as the common-mode components. All identified signal pairs are subtracted to separate the signal components of radial eccentricity error differential mode variation, which are then used as differential mode components.
3. The photoelectric shaft angle encoder error detection method based on harmonic analysis according to claim 1, characterized in that: The specific steps for determining the location of the peak frequencies of each spectrum are as follows: Perform spectral transformation operations on the common-mode component and the differential-mode component respectively to obtain the common-mode spectrum and the differential-mode spectrum; For the common-mode spectrum and differential-mode spectrum, identify the amplitude maxima points within a preset frequency neighborhood, and record the frequencies corresponding to the amplitude maxima points as candidate frequencies; The fundamental frequency of rotation is determined based on the rotation speed of the encoder. Candidate frequencies at the fundamental frequency position are marked as fundamental frequency peaks, and candidate frequencies at the second harmonic position are marked as harmonic peaks.
4. The photoelectric shaft angle encoder error detection method based on harmonic analysis according to claim 1, characterized in that: The fundamental frequency component is classified as an eccentricity error feature, and the second harmonic component is classified as a tilt error feature, including: Using the uniform angle sequence obtained by resampling the encoder's angle measurements at equal intervals as the independent variable, a fundamental frequency orthogonal function basis and a second harmonic orthogonal function basis are constructed in the integer angle domain; The common-mode component and the differential-mode component are respectively projected onto the fundamental frequency orthogonal function basis by least squares, and the fundamental frequency orthogonal coefficients obtained by the projection are extracted. The vector components represented by the fundamental frequency orthogonal coefficients are classified as eccentricity error features. The common-mode component and the differential-mode component are respectively projected onto the second harmonic orthogonal function basis by least squares, and the second harmonic orthogonal coefficients obtained by the projection are extracted. The vector components represented by the second harmonic orthogonal coefficients are classified as tilt error features. The fundamental frequency orthogonal function basis and the second harmonic orthogonal function basis satisfy an orthogonal relationship in the integer angular domain under a uniform angular sequence, so as to decouple and assign the fundamental frequency component and the second harmonic component during the projection process.
5. The photoelectric shaft angle encoder error detection method based on harmonic analysis according to claim 4, characterized in that: The expansion of the fundamental frequency component and the second harmonic component in the integer angular domain includes: Obtain the fundamental frequency orthogonal coefficients corresponding to the eccentricity error characteristics, and the second harmonic orthogonal coefficients corresponding to the tilt error characteristics; Multiply the fundamental frequency orthogonal coefficients with the fundamental frequency orthogonal function basis and then superimpose them to obtain the eccentricity error variation sequence of the fundamental frequency component with the uniform angle sequence in the integer angular domain. By reconstructing the second harmonic orthogonal coefficients and the second harmonic orthogonal function basis, the tilt error of the second harmonic component varies with the angle in the integer angular domain.
6. The photoelectric shaft angle encoder error detection method based on harmonic analysis according to claim 4, characterized in that: The process of obtaining the eccentricity error envelope and the tilt error envelope includes: The magnitude of the fundamental frequency orthogonal coefficients is determined as the amplitude of the eccentricity error characteristic, and the argument of the fundamental frequency orthogonal coefficients is determined as the initial phase of the eccentricity error characteristic. Using the amplitude and initial phase, the fundamental frequency error value is calculated point by point in the uniform angle sequence within the integer angular domain, and the calculated error values at each angular position are arranged in angular order to form the eccentricity error envelope. The magnitude of the second harmonic orthogonal coefficient is determined as the amplitude of the tilt error characteristic, and the argument of the second harmonic orthogonal coefficient is determined as the initial phase of the tilt error characteristic. The second harmonic error value is calculated point by point in the integer angular domain using the amplitude and initial phase according to a uniform angular sequence. The calculated error values at each angular position are then arranged in angular order to form the tilt error envelope.
7. The photoelectric shaft angle encoder error detection method based on harmonic analysis according to claim 1, characterized in that: The formation of the eccentric vector and the tilt vector are specifically as follows: Using the amplitude and initial phase of the eccentricity error characteristic and the tilt error characteristic as the polar radius and polar angle respectively, the two projection values of each vector in the orthogonal direction are calculated through coordinate transformation from polar coordinates to rectangular coordinates, and then merged and stored as the corresponding eccentricity vector and tilt vector.
8. The photoelectric shaft angle encoder error detection method based on harmonic analysis according to claim 1, characterized in that: The error compensation for the eccentricity vector and tilt vector includes: Obtain the original angle value output by the encoder at the current moment, extract its length value and direction angle from the eccentric vector, add the original angle value and direction angle to obtain the eccentric reference phase, use the length value as the amplitude and the eccentric reference phase as the phase, and calculate the instantaneous compensation amount of eccentric error according to the sine function. The length and direction angle are extracted from the tilt vector. The tilt reference phase is obtained by adding twice the original angle value to the direction angle. The instantaneous compensation amount for tilt error is generated by using the length value as the amplitude and the tilt reference phase as the phase.
9. The photoelectric shaft angle encoder error detection method based on harmonic analysis according to claim 1, characterized in that: The specific steps for synthesizing and aligning the phase of the error components corresponding to the two vectors are as follows: Extract the eccentric in-phase component and the eccentric quadrature component from the eccentric vector, and extract the tilted in-phase component and the tilted quadrature component from the tilted vector; Using the current angle as the phase reference, the eccentric in-phase component and the eccentric quadrature component are multiplied by the cosine and sine values of the current angle, respectively, and then added together to obtain the instantaneous projection value of the eccentric vector at the current angle. The tilted in-phase component and the tilted quadrature component are multiplied by the cosine and sine values, which are twice the current angle, respectively, and then added together to obtain the instantaneous projection value of the tilted vector at the current angle. The instantaneous projection value of the eccentric vector is added to the instantaneous projection value of the tilt vector to obtain the comprehensive error compensation amount at the current angle.
10. The photoelectric shaft angle encoder error detection method based on harmonic analysis according to claim 9, characterized in that: The output compensated angular position data is as follows: Obtain the original angle value currently output by the encoder, and subtract the comprehensive error compensation amount from the original angle value to obtain the compensated angular position value; Determine whether the compensated angular position value is within the encoder's range. If it is outside the range, perform a modulo operation on the compensated angular position value to convert it to the corresponding position within the encoder's range.