A self-calibration method, apparatus, device, and storage medium for a grating encoder.

By using a 2-3 hybrid layout of the grating encoder and a specific distribution of the four reading heads and data processing methods, high-precision angle measurement of the grating encoder is achieved, solving the problems of high cost and complexity in the existing technology, improving the angle measurement accuracy and reducing the system complexity.

CN123065503APending Publication Date: 2026-11-10INST OF MICROELECTRONICS CHINESE ACAD OF SCI LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510584142.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-07
Publication Date
2026-11-10

AI Technical Summary

Technical Problem

Existing grating encoders face problems such as high cost, system complexity, and cumbersome operation when achieving high-precision error compensation.

Method used

A grating encoder with a 2-3 hybrid layout uses four reading heads. The first and third reading heads are symmetrically distributed at 180° intervals, while the first, second, and fourth reading heads are evenly distributed at 120° intervals. The relative error data is calculated, the harmonic coefficients are extracted by Fourier transform, and error compensation is performed by combining the real-time reading head data.

Benefits of technology

It improves the angle measurement accuracy of the grating encoder, reduces the dependence on high-precision external measuring equipment, and reduces system complexity and cost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123065503A_ABST
    Figure CN123065503A_ABST
Patent Text Reader

Abstract

This application provides a self-calibration method, apparatus, device, and storage medium for a grating encoder. It includes: a 2-3 hybrid layout of reading heads for the grating encoder to control its uniform rotation; calculating relative error data relative to the first reading head based on readings from the first and third reading heads; calculating specific harmonic coefficients required for self-compensation based on the relative error data; obtaining a first measurement angle value based on real-time acquired readings from the first, second, and fourth reading heads; calculating specific harmonic compensation terms required for compensation based on the specific harmonic coefficients and the reading from the first reading head; and performing real-time correction on the first measurement angle value based on the specific harmonic compensation terms to obtain a second measurement angle value. This application creatively combines the advantages of dual-reading-head and triple-reading-head layouts, improving the angle measurement accuracy of the grating encoder while reducing cost and complexity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of grating encoder technology, and specifically to a self-calibration method, apparatus, device, and storage medium for a grating encoder. Background Technology

[0002] Circular grating encoders, as high-precision angle measuring devices, play a crucial role in high-end manufacturing and intelligent manufacturing, particularly in high-precision measurement scenarios such as precision machining, robot positioning, and aerospace. With the increasing demands for measurement accuracy and efficiency in industrial sectors, self-calibration and error compensation technologies for circular grating encoders have become a research hotspot.

[0003] The development of circular grating error compensation technology mainly revolves around two directions: First, constructing an error compensation model, using external high-precision equipment (such as a laser interferometer or angle measuring instrument) for error calibration, and then combining the compensation algorithm to fit the error curve characteristics to achieve online error compensation. The advantage is high compensation accuracy, but the disadvantage is that it requires a high-precision angle measurement reference as a calibration value, and the reliance on external equipment increases cost, operational complexity, and calibration time, and may introduce new errors. Second, adopting a hardware solution with a multi-readhead layout, by evenly arranging multiple readheads around the circular grating, the influence of errors on reading accuracy is partially eliminated by using the averaging principle, or by optimizing the layout through mixed readheads, the ability to eliminate harmonic errors is improved without increasing the number of readheads, thus improving the self-calibration effect. The advantage is that it does not require external equipment, and the error can be calibrated at any time. The more readheads, the higher the accuracy. However, the increase in the number of readheads increases cost and system complexity.

[0004] The patent "A Method and Apparatus for Encoder Calibration Data Amplification and Error Compensation" discloses a method and apparatus for encoder calibration data amplification and error compensation. It collects angular measurement data and calibration data through multiple evenly arranged reading heads, utilizes a motion control system to rotate a prism to amplify the calibration data, and integrates the calibration data based on the harmonic characteristics of the angular measurement data to establish an angular encoder angular measurement error compensation model, ultimately achieving high-precision compensation for angular measurement errors. This patent effectively amplifies calibration data and improves the accuracy of angular measurement error compensation. However, this method uses external equipment to measure the angular measurement error of the circular grating, thus introducing some errors, and requires a certain level of equipment precision and user proficiency.

[0005] The patent "A Self-Calibration Method for Circular Gratings Based on Fixed and Variable Position Reading Heads" provides a self-calibration method for circular gratings based on fixed and variable position reading heads. It uses a fixed reading head to determine the error compensation zero point, changes the position of the variable position reading head and judges the interference situation, records and processes the data, and achieves the self-calibration effect of simulating multiple reading heads with two reading heads. While this patent achieves the self-calibration effect of multiple reading heads using two reading heads, the variable position reading head requires changing its installation position, which imposes requirements on the system installation and introduces new errors.

[0006] In summary, while existing technologies can achieve high-precision error compensation for grating encoders, they often face problems such as high cost, system complexity, and cumbersome operation. Summary of the Invention

[0007] The purpose of this application is to provide a self-calibration method, apparatus, device, and storage medium for a grating encoder, which can improve the angle measurement accuracy of the grating encoder.

[0008] The first aspect of this application provides a self-calibration method for a grating encoder, wherein the grating encoder uses a 2-3 hybrid layout for a total of four reading heads; wherein the first and third reading heads are symmetrically distributed at 180° intervals, and the first, second, and fourth reading heads are evenly distributed at 120° intervals, with the first reading head shared between two reading head layouts; the method includes:

[0009] Control the grating encoder to rotate at a constant speed;

[0010] Based on the readings of the first and third reading heads, the relative error data relative to the first reading head is calculated;

[0011] The specific harmonic coefficients required for self-compensation are calculated based on the relative error data.

[0012] The first measurement angle value of the grating encoder is obtained based on the real-time readings of the first reading head, the second reading head, and the fourth reading head.

[0013] Based on the specific harmonic coefficient and the reading of the first reading head, the specific harmonic compensation term required to compensate the first measurement angle value is calculated.

[0014] The first measured angle value is corrected in real time according to the specific harmonic compensation term to obtain the second measured angle value.

[0015] In one possible implementation, calculating the relative error data relative to the first reading head based on the readings of the first and third reading heads includes:

[0016] The grating encoder is controlled to rotate uniformly from zero position to 360°. The readings of the first and third reading heads are collected at fixed angles, namely θ1 and θ3, respectively. The relative error data e of each sampling point is calculated according to the first formula.

[0017] First formula:

[0018] Record the relative error data (e1, e2, ..., e) of all sampling points. N There are a total of N relative error data points.

[0019] In one possible implementation, calculating the specific harmonic coefficients required for self-compensation based on the relative error data includes:

[0020] Perform a Fourier transform on the N relative error data to extract the Fourier coefficients a and b of the third harmonic:

[0021]

[0022] Repeat the above steps M times to obtain multiple sets of Fourier coefficients a1, a2, ..., a M and b1, b2, ... b M Calculate the average of a and b:

[0023]

[0024] Save the average Fourier coefficients and Used for subsequent real-time error compensation.

[0025] In one possible implementation, obtaining the first measurement angle value of the grating encoder based on the real-time acquired readings from the first, second, and fourth reading heads includes:

[0026] The readings of the first reading head, the second reading head, and the fourth reading head are collected in real time and recorded as θ1, θ2, and θ4, respectively. The average value of the three reading heads is calculated according to the second formula. This average value is the first measurement angle value of the grating encoder.

[0027] Second formula:

[0028] In one possible implementation, calculating the specific harmonic compensation term required to compensate the first measurement angle value based on the specific harmonic coefficient and the reading of the first reading head includes:

[0029] Based on the average Fourier coefficient and The specific harmonic compensation term e required to compensate for the first measured angle value is calculated. 补 :

[0030]

[0031] In one possible implementation, the step of real-time correction of the first measured angle value based on the specific harmonic compensation term to obtain the second measured angle value includes:

[0032] Based on the third formula, the first measured angle value is corrected in real time according to the specific harmonic compensation term to obtain the second measured angle value θ.

[0033] The third formula:

[0034] A second aspect of this application provides a self-calibration device for a grating encoder, wherein the grating encoder uses a 2-3 hybrid layout for its reading heads, employing a total of four reading heads; wherein the first and third reading heads are symmetrically distributed at 180° intervals, and the first, second, and fourth reading heads are evenly distributed at 120° intervals, with the first reading head shared between two reading head layouts; the device comprises:

[0035] The control module is used to control the grating encoder to rotate at a constant speed;

[0036] The calculation module is used to calculate relative error data relative to the first reading head based on the readings of the first reading head and the third reading head; calculate the specific harmonic coefficient required for self-compensation based on the relative error data; obtain the first measurement angle value of the grating encoder based on the real-time acquired readings of the first reading head, the second reading head, and the fourth reading head; and calculate the specific harmonic compensation term required to compensate the first measurement angle value based on the specific harmonic coefficient and the reading of the first reading head.

[0037] The calibration module is used to correct the first measurement angle value in real time according to the specific harmonic compensation term to obtain the second measurement angle value.

[0038] In one possible implementation, the computing module is used for:

[0039] The grating encoder is controlled to rotate uniformly from zero position to 360°. The readings of the first and third reading heads are collected at fixed angles, namely θ1 and θ3, respectively. The relative error data e of each sampling point is calculated according to the first formula.

[0040] First formula:

[0041] Record the relative error data (e1, e2, ..., e) of all sampling points. N There are a total of N relative error data points.

[0042] A third aspect of this application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect of this application.

[0043] A fourth aspect of this application provides a computer-readable medium having computer-readable instructions stored thereon, the computer-readable instructions being executable by a processor to implement the method described in the first aspect of this application.

[0044] Compared to existing technologies, the self-calibration method, apparatus, electronic device, and storage medium for grating encoders provided in this application employ a 2-3 hybrid layout for the grating encoder's reading heads, controlling the encoder to rotate at a uniform speed. Based on the readings of the first and third reading heads, relative error data is calculated relative to the first reading head. A specific harmonic coefficient required for self-compensation is calculated based on the relative error data. A first measurement angle value of the grating encoder is obtained based on the real-time acquired readings of the first, second, and fourth reading heads. A specific harmonic compensation term required to compensate the first measurement angle value is calculated based on the specific harmonic coefficient and the reading of the first reading head. The first measurement angle value is then corrected in real-time based on the specific harmonic compensation term to obtain a second measurement angle value. Compared to existing technologies, this application creatively combines the advantages of dual-reading-head and triple-reading-head layouts. Utilizing the evenly distributed layout characteristics of dual-reading-heads, it fully leverages their error compensation advantages, precisely compensating for the shortcomings of evenly distributed triple-reading-heads in error compensation. This improves the angle measurement accuracy of the grating encoder, eliminates reliance on high-precision external measuring equipment, and reduces cost and complexity. Attached Figure Description

[0045] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0046] Figure 1 A schematic diagram of a hybrid layout of the reading head 2-3 of a grating encoder provided in this application is shown;

[0047] Figure 2 A flowchart illustrating a self-calibration method for a grating encoder provided by some embodiments of this application is shown;

[0048] Figure 3 A flowchart illustrating the average Fourier coefficient extraction provided by some embodiments of this application is shown;

[0049] Figure 4 It shows the basis Figure 1 A flowchart of a specific self-calibration method for a grating encoder;

[0050] Figure 5 A schematic diagram of a self-calibration device for a grating encoder provided by some embodiments of this application is shown. Detailed Implementation

[0051] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0052] It should be noted that, unless otherwise stated, the technical or scientific terms used in this application shall have the ordinary meaning as understood by one of ordinary skill in the art to which this application pertains.

[0053] Furthermore, the terms "first" and "second," etc., are used to distinguish different objects, not to describe a specific order. Additionally, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to those processes, methods, products, or apparatuses.

[0054] This application provides a self-calibration method and apparatus for a grating encoder, an electronic device, and a computer-readable storage medium, which will be described below with reference to the accompanying drawings.

[0055] Please refer to Figure 1 This illustrates a schematic diagram of a hybrid layout of the reading heads 2-3 of a grating encoder provided in this application. Figure 1 As shown, the mixed layout of reading heads 2-3 uses a total of 4 reading heads. Among them, the first reading head 1 and the third reading head 3 are symmetrically distributed at 180° intervals, and the first reading head 1, the second reading head 2 and the fourth reading head 4 are evenly distributed at 120° intervals. The first reading head 1 is shared between the two reading head layouts.

[0056] In implementing circular grating self-compensation, this application first rotates the circular grating at a constant speed for several revolutions. During this period, specific harmonic coefficients are calculated multiple times using data from two uniformly distributed reading heads, and their average value is taken. After the harmonic coefficients are extracted, data from three uniformly distributed reading heads are acquired in real time, and error compensation is performed by combining the average harmonic coefficients, thereby achieving high-precision self-compensation for circular grating angle measurement.

[0057] For details, please refer to Figure 2 It illustrates a flowchart of a self-calibration method for a grating encoder provided by some embodiments of this application, such as... Figure 2 As shown, the method may include the following steps S101 to S106:

[0058] S101. Control the grating encoder to rotate at a constant speed;

[0059] S102. Calculate the relative error data relative to the first reading head based on the readings of the first reading head and the third reading head;

[0060] The above step S102 can be specifically implemented as follows:

[0061] The grating encoder is controlled to rotate at a constant speed from zero position to 360°. The readings of the first reading head 1 and the third reading head 3 are collected at fixed angles, namely θ1 and θ3, respectively. The relative error data e of each sampling point is calculated according to the first formula.

[0062] First formula:

[0063] Record the relative error data (e1, e2, ..., e) of all sampling points. N There are a total of N relative error data points.

[0064] S103. Calculate the specific harmonic coefficients required for self-compensation based on the relative error data;

[0065] The above step S103 can be specifically implemented as follows:

[0066] For the N relative error data (e1, e2, ..., e N Perform a Fourier transform to extract the Fourier coefficients a and b of the third harmonic:

[0067]

[0068] Where N is the number of sampling points, and e(i) is the i-th sampled value of the error data e.

[0069] Repeat steps S102 and S103 M times to obtain multiple sets of Fourier coefficients a1, a2, ..., a M and b1, b2, ... bM Calculate the average of a and b:

[0070]

[0071] Save the average Fourier coefficients and Used for subsequent real-time error compensation.

[0072] For ease of understanding, this application provides Figure 3 The flowchart shown is for the extraction of the average Fourier coefficients.

[0073] S104. Based on the readings of the first reading head, the second reading head, and the fourth reading head collected in real time, the first measurement angle value of the grating encoder is obtained;

[0074] The above step S104 can be specifically implemented as follows:

[0075] The readings of the first reading head 1, the second reading head 2, and the fourth reading head 4 are collected in real time and recorded as θ1, θ2, and θ4 respectively. The average value of the three reading heads is calculated according to the second formula. This average value is the first measurement angle value of the grating encoder.

[0076] Second formula:

[0077] S105. Based on the specific harmonic coefficient and the reading of the first reading head, calculate the specific harmonic compensation term required to compensate the first measurement angle value.

[0078] The above step S105 can be specifically implemented as follows:

[0079] Based on the average Fourier coefficient and The specific harmonic compensation term e required to compensate for the first measured angle value is calculated. 补 :

[0080]

[0081] S106. The first measured angle value is corrected in real time according to the specific harmonic compensation term to obtain the second measured angle value.

[0082] After obtaining the average Fourier coefficients through the aforementioned steps, real-time error self-compensation for the circular grating angle can be achieved. Specifically, the method involves real-time acquisition of reading head data, calculation of harmonic compensation terms based on the average Fourier coefficients, and real-time correction of the measurement results to output a high-precision angle value.

[0083] The above step S106 can be specifically implemented as follows:

[0084] Based on the third formula, the first measured angle value is corrected in real time according to the specific harmonic compensation term to obtain the second measured angle value θ.

[0085] The third formula: That is, θ is the output value after circular grating angle measurement compensation.

[0086] As can be seen, this application combines mean calculation and harmonic analysis in circular grating self-compensation, which effectively improves the measurement accuracy of circular gratings.

[0087] For ease of understanding, this application is based on Figure 1 Provided Figure 4 The flowchart illustrates a specific self-calibration method for a grating encoder. (See attached diagram.) Figure 4 As shown, the mean value of the two reading heads is first calculated, then the relative error data is calculated, then the specific harmonic order of the relative error is calculated, then the mean value of the three reading heads is calculated, and finally the compensated angle value is calculated.

[0088] Existing self-calibration methods for grating encoders require a large number of reading heads to ensure accuracy. Uniform layout methods, due to the large number of reading heads and limited accuracy, are insufficient for high-precision requirements. To address these issues, this application employs a 2-3 hybrid layout scheme. By introducing a common reading head, it achieves higher angle measurement accuracy while reducing the number of reading heads. Specifically, this application uses a layout with three evenly distributed reading heads and a layout with two evenly distributed reading heads, with a common reading head included. By leveraging the error compensation advantages of a dual-reading-head even distribution, it precisely compensates for the shortcomings of a three-reading-head even distribution in error compensation. Specifically, the average readings of the two reading heads are first calculated, and then the reading of the common reading head is subtracted to obtain the relative error. Next, specific harmonic coefficients are extracted from the relative error. Using the obtained results, error compensation is applied to the average value of the three reading heads. Finally, high-precision calibrated reading data is output. This unique hybrid layout and data processing method not only effectively suppresses systematic errors and significantly improves measurement accuracy, but also maintains low system complexity and implementation cost throughout the process, achieving a good balance between performance and cost.

[0089] Compared with existing technologies, this application creatively combines the layout advantages of dual and triple reading heads. By utilizing the evenly distributed layout characteristics of dual reading heads, it fully leverages their error compensation advantages and precisely compensates for the shortcomings of evenly distributed triple reading heads in error compensation. This improves the angle measurement accuracy of the grating encoder, eliminates the dependence on high-precision external measuring equipment, and reduces costs and complexity of use.

[0090] In the above embodiments, a self-calibration method for a grating encoder is provided. Correspondingly, this application also provides a self-calibration device for a grating encoder, which can be implemented through software, hardware, or a combination of both. For example, the self-calibration device may include integrated or separate functional modules or units to perform the corresponding steps in the above methods. Please refer to... Figure 5 This illustration shows a schematic diagram of a self-calibration device for a grating encoder provided in some embodiments of this application. Since the device embodiments are basically similar to the method embodiments, the description is relatively simple; relevant details can be found in the description of the method embodiments. The device embodiments described below are merely illustrative.

[0091] like Figure 5 As shown, the self-calibration device 10 of the grating encoder includes:

[0092] Control module 101 is used to control the grating encoder to rotate at a constant speed;

[0093] The calculation module 102 is used to calculate relative error data relative to the first reading head based on the readings of the first reading head and the third reading head; calculate the specific harmonic coefficient required for self-compensation based on the relative error data; obtain the first measurement angle value of the grating encoder based on the real-time acquired readings of the first reading head, the second reading head, and the fourth reading head; and calculate the specific harmonic compensation term required to compensate the first measurement angle value based on the specific harmonic coefficient and the reading of the first reading head.

[0094] The calibration module 103 is used to correct the first measurement angle value in real time according to the specific harmonic compensation term to obtain the second measurement angle value.

[0095] In one possible implementation, the computing module 102 is specifically used for:

[0096] The grating encoder is controlled to rotate uniformly from zero position to 360°. The readings of the first and third reading heads are collected at fixed angles, namely θ1 and θ3, respectively. The relative error data e of each sampling point is calculated according to the first formula.

[0097] First formula:

[0098] Record the relative error data (e1, e2, ..., e) of all sampling points. N There are a total of N relative error data points.

[0099] In one possible implementation, the computing module 102 is specifically used for:

[0100] Perform a Fourier transform on the N relative error data to extract the Fourier coefficients a and b of the third harmonic:

[0101]

[0102] Where e(i) is the i-th sampled value of the error data e;

[0103] Repeat the above steps M times to obtain multiple sets of Fourier coefficients a1, a2, ..., a M and b1, b2, ... b M Calculate the average of a and b:

[0104]

[0105] Save the average Fourier coefficients and Used for subsequent real-time error compensation.

[0106] In one possible implementation, the computing module 102 is specifically used for:

[0107] The readings of the first reading head, the second reading head, and the fourth reading head are collected in real time and recorded as θ1, θ2, and θ4, respectively. The average value of the three reading heads is calculated according to the second formula. This average value is the first measurement angle value of the grating encoder.

[0108] Second formula:

[0109] In one possible implementation, the computing module 102 is specifically used for:

[0110] Based on the average Fourier coefficient and The specific harmonic compensation term e required to compensate for the first measured angle value is calculated. 补 :

[0111]

[0112] In one possible implementation, the calibration module 103 is specifically used for:

[0113] Based on the third formula, the first measured angle value is corrected in real time according to the specific harmonic compensation term to obtain the second measured angle value θ.

[0114] The third formula:

[0115] The self-calibration device for the grating encoder provided in this application embodiment and the self-calibration method for the grating encoder provided in this application embodiment are based on the same inventive concept and have the same beneficial effects as the methods they adopt, operate or implement.

[0116] This application also provides an electronic device corresponding to the self-calibration method of the grating encoder provided in the foregoing embodiments. The electronic device may be a mobile phone, laptop computer, tablet computer, desktop computer, etc., to perform the self-calibration method of the grating encoder described above.

[0117] The electronic device provided in this application embodiment and the self-calibration method of the grating encoder provided in this application embodiment are based on the same inventive concept and have the same beneficial effects as the methods they adopt, operate or implement.

[0118] This application also provides a computer-readable storage medium corresponding to the self-calibration method of the grating encoder provided in the foregoing embodiments, wherein a computer program (i.e., a program product) is stored thereon, and the computer program, when run by a processor, executes the self-calibration method of the grating encoder provided in any of the foregoing embodiments.

[0119] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical and magnetic storage media, which will not be elaborated here.

[0120] The computer-readable storage medium provided in the above embodiments of this application and the self-calibration method of the grating encoder provided in the embodiments of this application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.

[0121] It should be noted that the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0122] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application, and they should all be covered within the scope of the claims and specification of this application.

Claims

1. A self-calibration method for a grating encoder, characterized in that, The grating encoder uses a 2-3 hybrid layout for its reading heads, employing a total of four reading heads. The first and third reading heads are symmetrically distributed at 180° intervals, while the first, second, and fourth reading heads are evenly distributed at 120° intervals. Two reading head layouts share the first reading head. The method includes: Control the grating encoder to rotate at a constant speed; Based on the readings of the first and third reading heads, the relative error data relative to the first reading head is calculated; The specific harmonic coefficients required for self-compensation are calculated based on the relative error data. The first measurement angle value of the grating encoder is obtained based on the real-time readings of the first reading head, the second reading head, and the fourth reading head. Based on the specific harmonic coefficient and the reading of the first reading head, the specific harmonic compensation term required to compensate the first measurement angle value is calculated. The first measured angle value is corrected in real time according to the specific harmonic compensation term to obtain the second measured angle value.

2. The method according to claim 1, characterized in that, The step of calculating the relative error data relative to the first reading head based on the readings of the first and third reading heads includes: The grating encoder is controlled to rotate uniformly from zero position to 360°. The readings of the first and third reading heads are collected at fixed angles, namely θ1 and θ3, respectively. The relative error data e of each sampling point is calculated according to the first formula. First formula: Record the relative error data (e1, e2, ..., e) of all sampling points. N There are N relative error data points, where N is the number of sampling points.

3. The method according to claim 2, characterized in that, The calculation of the specific harmonic coefficients required for self-compensation based on the relative error data includes: Perform a Fourier transform on the N relative error data to extract the Fourier coefficients a and b of the third harmonic: Where e(i) is the i-th sampled value of the error data e; Repeat the above steps M times to obtain multiple sets of Fourier coefficients a1, a2, ..., a M and b1, b2, ... b M Calculate the average of a and b: Save the average Fourier coefficients and Used for subsequent real-time error compensation.

4. The method according to claim 3, characterized in that, The step of obtaining the first measurement angle value of the grating encoder based on the real-time collected readings from the first, second, and fourth reading heads includes: The readings of the first reading head, the second reading head, and the fourth reading head are collected in real time and recorded as θ1, θ2, and θ4, respectively. The average value of the three reading heads is calculated according to the second formula. This average value is the first measurement angle value of the grating encoder. Second formula:

5. The method according to claim 4, characterized in that, The step of calculating the specific harmonic compensation term required to compensate the first measurement angle value based on the specific harmonic coefficient and the reading of the first reading head includes: Based on the average Fourier coefficient and The specific harmonic compensation term e required to compensate for the first measured angle value is calculated. 补 :

6. The method according to claim 5, characterized in that, The step of real-time correction of the first measured angle value according to the specific harmonic compensation term to obtain the second measured angle value includes: Based on the third formula, the first measured angle value is corrected in real time according to the specific harmonic compensation term to obtain the second measured angle value θ. The third formula:

7. A self-calibration device for a grating encoder, characterized in that, The grating encoder uses a 2-3 hybrid layout for its reading heads, employing a total of four reading heads. The first and third reading heads are symmetrically distributed at 180° intervals, while the first, second, and fourth reading heads are evenly distributed at 120° intervals. Two reading head layouts share the first reading head. The device includes: The control module is used to control the grating encoder to rotate at a constant speed; The calculation module is used to calculate relative error data relative to the first reading head based on the readings of the first reading head and the third reading head; calculate the specific harmonic coefficient required for self-compensation based on the relative error data; obtain the first measurement angle value of the grating encoder based on the real-time acquired readings of the first reading head, the second reading head, and the fourth reading head; and calculate the specific harmonic compensation term required to compensate the first measurement angle value based on the specific harmonic coefficient and the reading of the first reading head. The calibration module is used to correct the first measurement angle value in real time according to the specific harmonic compensation term to obtain the second measurement angle value.

8. The apparatus according to claim 7, characterized in that, The computing module is used for: The grating encoder is controlled to rotate uniformly from zero position to 360°. The readings of the first and third reading heads are collected at fixed angles, namely θ1 and θ3, respectively. The relative error data e of each sampling point is calculated according to the first formula. First formula: Record the relative error data (e1, e2, ..., e) of all sampling points. N There are a total of N relative error data points.

9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor, when executing the computer program, implements the method as described in any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that, It stores computer-readable instructions that can be executed by a processor to implement the method as described in any one of claims 1 to 6.