Motor encoder calibration method and calibration device

By using the current-frequency ratio control mode and generating an error compensation table through Fourier transform, the problem of insufficient calibration accuracy of magnetic encoders is solved, achieving efficient and low-cost encoder calibration.

CN121655599APending Publication Date: 2026-03-1358 INTELLIGENT TECH (HANGZHOU) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-09
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing magnetic encoder calibration methods rely on the stability of motor speed, resulting in insufficient calibration accuracy and requiring additional equipment and processes, thus increasing costs.

Method used

By adopting the current-frequency ratio control mode, an error compensation table is generated through Fourier transform and gradient search method to eliminate the influence of motor magnetic field harmonics and achieve encoder error calibration.

Benefits of technology

It can improve encoder calibration accuracy without the need for external equipment, reduce production costs, and avoid compensation errors caused by motor magnetic field harmonics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121655599A_ABST
    Figure CN121655599A_ABST
Patent Text Reader

Abstract

The invention discloses a motor encoder calibration method and a calibration device. A calibration parameter set is configured, a motor is dragged to rotate according to a first current in a current frequency ratio control mode, an encoder feedback value and a corresponding given position value are collected, an error compensation value sequence is obtained through calculation, and a purified error compensation value sequence is further obtained; dragging the motor to rotate at a constant speed according to a second current in a current frequency ratio control mode; detecting whether an error absolute value corresponding to the purified error compensation value sequence exceeds a preset threshold value or not; if the preset threshold value is not exceeded, determining each target position value of a reconstruction error compensation table according to a preset step length, obtaining a corresponding error reconstruction value, and generating a reconstruction error compensation table; and acquiring a real-time feedback value of the encoder, searching a target compensation value corresponding to the real-time feedback value based on the reconstruction error compensation table, and calculating to obtain a calibrated encoder value. External hardware equipment is not needed, the calibration process flow is simplified, and the production cost is reduced; and the calibration precision and stability are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of motor control and testing technology, and in particular to a method and apparatus for calibrating a motor encoder. Background Technology

[0002] In recent years, with the development of artificial intelligence, intelligent robots, especially humanoid robots, have become a research hotspot in embodied intelligence. Joint modules, as core components of robots, directly affect their motion control performance. A robot may have up to thirty joint modules, and due to cost and space limitations, intelligent robots generally use magnetic encoders as motor position sensors. Magnetic encoders have advantages such as small size and low cost, but factors such as mechanical installation deviations (tilt, eccentricity), uneven magnetic fields, and nonlinearity of the encoder sampling circuit lead to poor linearity and absolute accuracy. This affects the maximum torque and torque and speed stability of the joint modules, ultimately reducing the robot's motion performance. Currently, commonly used magnetic encoders typically offer a calibration process at a constant speed. This calibration process usually requires the encoder to be installed on the motor, and then the motor is driven to rotate at a constant speed using other equipment. The magnetic encoder then performs position correction through its internal algorithm. However, the accuracy of this calibration method is highly dependent on the stability of the motor speed, and significant errors still exist after calibration; when the motor speed fluctuates greatly, the calibration operation may even worsen the encoder's accuracy. Furthermore, when calibrating the magnetic encoder of the joint module motor, a uniform motion is typically input at the output end of the joint module, and the reverse-drive motor achieves uniform rotation. This method results in poor motor speed stability, making it difficult to guarantee calibration accuracy. Moreover, this method requires additional calibration fixtures and manufacturing processes, increasing production costs. Summary of the Invention

[0003] This invention addresses the shortcomings of existing technologies by providing a method for calibrating a motor encoder, comprising the following steps:

[0004] Configure a calibration parameter set, drive the motor to rotate at a constant speed in the current-frequency ratio control mode according to the first current, and periodically collect the encoder feedback value and the corresponding given position value during the process of the motor rotating at least one mechanical revolution, and calculate the error compensation value sequence.

[0005] Perform a Fourier transform on the error compensation value sequence, extract the components in the transform result that are less than the electrical frequency of the motor, and perform an inverse Fourier transform on the components to obtain the purified error compensation value sequence.

[0006] The motor is driven to rotate at a constant speed in a current-frequency ratio control mode according to a second current, where the second current is less than the first current; during the process of the motor rotating at least one mechanical revolution, it is detected whether the absolute value of the error corresponding to the purified error compensation value sequence exceeds a preset threshold.

[0007] If the preset threshold is not exceeded, the target position values ​​of the reconstruction error compensation table are determined according to the preset step size, and the error reconstruction value corresponding to each target position value is obtained by gradient search method to generate the reconstruction error compensation table.

[0008] Obtain the real-time feedback value of the encoder, find the target compensation value corresponding to the real-time feedback value based on the reconstruction error compensation table, and obtain the calibrated encoder value by performing a difference operation between the real-time feedback value of the encoder and the target compensation value.

[0009] Preferably, the calibration parameter set includes the MCU cyclic task cycle, the number of motor pole pairs, the number of motor electrical cycle sampling points, the number of data in the reconstruction error compensation table, and the encoder resolution.

[0010] Preferably, the error reconstruction value corresponding to each target position value is obtained by gradient search, which specifically includes the following steps:

[0011] The search point is initialized to the target position value. If the sum of the compensation value corresponding to the search point and the search point is greater than the target position value, the current search point is recorded as the upper limit position and the corresponding upper limit compensation value, and the search point is adjusted downward.

[0012] If the sum of the compensation value corresponding to the search point and the search point is less than the target position value, then the current search point is recorded as the lower limit position and the corresponding lower limit compensation value, and the search point is adjusted upwards.

[0013] Once the upper limit position, upper limit compensation value, lower limit position, and lower limit compensation value are obtained, the error reconstruction value corresponding to the target position value is calculated.

[0014] Preferably, after obtaining the upper limit position, upper limit compensation value, lower limit position, and lower limit compensation value, the error reconstruction value corresponding to the target position value is calculated, specifically including the following:

[0015] The known parameters are defined as the lower limit position, the lower limit compensation value, the upper limit position, and the upper limit compensation value. The target parameter is the error reconstruction value corresponding to the target position value, and the target position value is between the lower limit position and the upper limit position.

[0016] Divide the difference between the target position value and the lower limit position by the encoder's minimum resolvable angle to obtain the position scaling factor; calculate the difference between the upper limit compensation value and the lower limit compensation value, multiply the difference by the position scaling factor to obtain the compensation value increment; add the compensation value increment to the lower limit compensation value to obtain the error reconstruction value corresponding to the target position value.

[0017] Preferably, the magnitude of the second current is 1 / 4 to 1 / 2 of the first current.

[0018] Preferably, the preset step size is the ratio of the total electrical angle 2π corresponding to the motor mechanical circle to the number of data in the reconstruction error compensation table.

[0019] Preferably, the process involves obtaining the encoder's real-time feedback value, finding the target compensation value corresponding to the real-time feedback value based on the reconstruction error compensation table, and obtaining the calibrated encoder value by performing a difference operation between the encoder's real-time feedback value and the target compensation value. Specifically, this includes:

[0020] Obtain the encoder's real-time feedback value, and based on the number of data in the reconstruction error compensation table and the encoder's real-time feedback value, obtain an integer index through rounding; then obtain the remainder value through the operation of the encoder's real-time feedback value, the integer index, and the number of data in the reconstruction error compensation table.

[0021] Based on the integer index, two compensation reference values ​​for the corresponding and adjacent positions are extracted from the reconstruction error compensation table; the interpolation coefficients are calculated based on the remainder value and the number of data in the reconstruction error compensation table.

[0022] Linear interpolation is performed on the two compensation reference values ​​according to the interpolation coefficients to obtain the target compensation value corresponding to the encoder real-time feedback value; the difference between the encoder real-time feedback value and the target compensation value is calculated to obtain the calibrated encoder value.

[0023] The present invention also discloses a motor encoder calibration device, comprising:

[0024] The first acquisition module is used to configure the calibration parameter set, drive the motor to rotate at a constant speed according to the first current in the current-frequency ratio control mode, and periodically acquire the encoder feedback value and the corresponding given position value during the process of the motor rotating at least one mechanical revolution, and calculate the error compensation value sequence.

[0025] A conversion module is used to perform a Fourier transform on the error compensation value sequence, extract the components in the transform result that are less than the electrical frequency of the motor, perform an inverse Fourier transform on the components, and obtain a purified error compensation value sequence.

[0026] The second acquisition module is used to drive the motor to rotate at a constant speed according to the second current in the current-frequency ratio control mode, wherein the second current is less than the first current; during the process of the motor rotating at least one mechanical revolution, it detects whether the absolute value of the error corresponding to the purified error compensation value sequence exceeds a preset threshold; if it does not exceed the preset threshold, it determines the target position value of the reconstruction error compensation table according to the preset step size, obtains the error reconstruction value corresponding to each target position value through the gradient search method, and generates the reconstruction error compensation table;

[0027] The calibration module is used to obtain the real-time feedback value of the encoder, find the target compensation value corresponding to the real-time feedback value based on the reconstruction error compensation table, and obtain the calibrated encoder value by performing a difference operation between the real-time feedback value of the encoder and the target compensation value.

[0028] Preferably, the calibration parameter set includes the MCU cyclic task cycle, the number of motor pole pairs, the number of motor electrical cycle sampling points, the number of data in the reconstruction error compensation table, and the encoder resolution.

[0029] The present invention also discloses a motor encoder calibration system, including a controller and a memory. The controller is connected to a robot joint motor, and the memory is used to store a computer program executable by the processor. The processor is configured to execute the computer program in the memory to implement any of the aforementioned motor encoder calibration methods.

[0030] This invention discloses a motor encoder calibration method and calibration device. By configuring a calibration parameter set and using a constant-speed forced-drive motor in IF control mode, the encoder error compensation value is obtained. In addition, in order to eliminate the influence of magnetic field harmonics of the motor in IF control mode on the error compensation value, a Fourier transform is performed on the error compensation value sequence. The components less than the motor's electrical frequency in the transform result are extracted and an inverse Fourier transform is performed to obtain a purified error compensation value sequence. Compared with the original error compensation sequence, the new error compensation value sequence eliminates the influence of motor magnetic field harmonics and high-frequency noise in the sequence.

[0031] In addition, to reduce the impact of friction on the error correction value and decrease the strong drag current in the IF control mode, the absolute value of the error corresponding to the purified error compensation value sequence is checked to see if it exceeds a preset threshold. If it does not exceed the preset threshold, the target position values ​​of the reconstructed error compensation table are determined according to a preset step size, and the error reconstruction value corresponding to each target position value is obtained through gradient search method to generate the reconstructed error compensation table. Finally, the difference between the real-time feedback value of the encoder and the target compensation value is calculated to obtain the calibrated encoder value. Thus, the effectiveness of the error compensation value can be effectively judged by observing the operation of the motor with different currents under the IF control mode. This technical solution can achieve calibration compensation of the motor encoder output position signal without the aid of external hardware devices, effectively avoiding the compensation error caused by motor magnetic field harmonics during the IF strong drag process.

[0032] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0033] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0034] Figure 1 This is a schematic diagram illustrating the specific process of a motor encoder calibration method disclosed in an embodiment of the present invention.

[0035] Figure 2 This is a schematic diagram of a pole motor structure disclosed in an embodiment of the present invention.

[0036] Figure 3 This is a schematic diagram of the structure of a motor encoder calibration device disclosed in an embodiment of the present invention. Detailed Implementation

[0037] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0038] Unless otherwise defined, the technical or scientific terms used herein shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention pertains. The terms “first,” “second,” and similar terms used in the specification and claims of this patent application do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Similarly, the terms “an” or “a” and similar terms do not indicate a limitation of quantity, but rather indicate the presence of at least one.

[0039] In this embodiment, as shown in the appendix Figure 1 As shown, a method for calibrating a motor encoder is disclosed, comprising the following steps:

[0040] Step S1: Configure the calibration parameter set, drive the motor to rotate at a constant speed in the current-frequency ratio control mode according to the first current, and periodically collect the encoder feedback value and the corresponding given position value during the process of the motor rotating at least one mechanical revolution, and calculate the error compensation value sequence.

[0041] In this embodiment, the calibration parameter set includes the MCU cyclic task cycle, the number of motor pole pairs, the number of motor electrical cycle sampling points, the number of data in the reconstruction error compensation table, and the encoder resolution.

[0042] In one specific embodiment, as shown in the appendix Figure 2 As shown, the mechanical cycle of the motor corresponds to a mechanical angle of... The electrical period corresponds to an electrical angle of . The mechanical cycle refers to the period during which the motor rotor completes one mechanical rotation, and its mechanical angular range is [range missing]. The electrical period refers to the period during which the induced electromotive force in the motor winding completes one full sine and cosine change, and its electrical angle range is [range missing]. .

[0043] Specifically, by configuring a calibration parameter set, which includes: the MCU cyclic task execution cycle Number of motor pole pairs Number of sampling points per motor electrical cycle Encoder resolution First current Increment of electrical angle during the operating cycle Number of data in the reconstructed error compensation table Second current ,in , For integers, the reconstruction error compensation table is as follows: .

[0044] Current-frequency ratio control mode With the first current The motor is continuously driven to maintain a stable, uniform rotation speed, with the rotation process fully covering at least one mechanical revolution. The electrical rotational speed is... That is, the operating cycle The angle increment below is Each given electrical angle is To make the motor move at a speed Rotate slowly, where 2π is the total electrical angle corresponding to the mechanical revolution of the motor, which is 360 degrees. 0 .

[0045] Throughout the entire process of the motor's uniform rotation, data is collected according to a preset fixed cycle, and encoder feedback values ​​are synchronously captured within each collection cycle. and corresponding given position value ,in For each acquisition cycle, the encoder feedback value and the corresponding given position value are compared using data processing to obtain the error compensation value. ,in By systematically comparing and calculating the corresponding data in each group, a continuous and complete sequence of error compensation values ​​is generated. The error compensation value sequence is used to characterize the error distribution characteristics of the encoder during motor rotation.

[0046] Step S2: Perform a Fourier transform on the error compensation value sequence, extract the components in the transform result that are less than the electrical frequency of the motor, and perform an inverse Fourier transform on the components to obtain the purified error compensation value sequence.

[0047] Specifically, a Fourier transform is performed on the acquired error compensation value sequence to convert it into frequency domain data. This frequency domain data includes high-frequency components related to motor magnetic field harmonics, frequency components corresponding to other high-frequency noise, and relevant components with frequency parameters lower than the motor's electrical frequency. Using the motor's electrical frequency as a threshold, the frequency domain data is filtered to identify and separate relevant components below this threshold, while excluding high-frequency components related to motor magnetic field harmonics and frequency components corresponding to other high-frequency noise. For the selected components that meet the frequency requirements, an inverse Fourier transform is performed to convert the filtered frequency domain components back into time domain data, which are then integrated to form the purified error compensation value sequence.

[0048] In one specific embodiment, performing a Fourier transform on the error compensation value may include the following steps:

[0049] Step S21, Initialization , Value, of which For the sequence of cosine term magnitudes, Let i be a sequence of sine term amplitude values, i=1 2 … Npp-1 is the frequency index. (Setting...) , The initial values ​​are all 0.

[0050] Step S22, in each MCU loop, i.e., sampling period In the middle, calculate the error compensation value of the current sampling point. At the same time, for each frequency i ( Cumulative calculation and ;

[0051] in, and The calculation formula is:

[0052] .

[0053] When the motor completes at least one mechanical revolution, that is When sampling stops, a complete sample is obtained. sequence sum The sequence, the The sequence corresponds to the amplitude of the cosine component of each frequency i, the The sequence corresponds to the amplitude of the sinusoidal component at each frequency i. Each i corresponds to a signal component at a specific frequency; the larger i is, the higher the frequency. and The magnitude of the amplitude represents the strength of the frequency component in the original error compensation value sequence. The larger the amplitude, the more obvious the signal of that frequency.

[0054] The components extracted from the transformation result that are less than the electrical frequency of the motor are subjected to an inverse Fourier transform to obtain a continuous error compensation function. Samples are then taken at equal intervals within one mechanical cycle of the error compensation function. These points form a sequence of purified error compensation values.

[0055] Step S3: Drive the motor to rotate at a constant speed in the current-frequency ratio control mode according to the second current, where the second current is less than the first current; during the process of the motor rotating at least one mechanical revolution, detect whether the absolute value of the error corresponding to the purified error compensation value sequence exceeds a preset threshold.

[0056] In this embodiment, the magnitude of the second current can be selected as 1 / 4 to 1 / 2 of the first current. Based on a preset calibration parameter set, a current-frequency ratio control mode is adopted, selecting a current smaller than the first current. The second current As the driving current, the motor is driven to rotate at a stable, uniform speed, ensuring that the motor's rotational stroke completely covers at least one mechanical revolution. Throughout the entire process of the motor maintaining uniform rotation, the absolute value of the error corresponding to the purified error compensation value sequence is continuously monitored in real time; simultaneously, a preset threshold is retrieved. The position error compensation value obtained from each real-time detection The data is compared one by one with the preset thresholds, where... , A value is given for the current position.

[0057] In one specific embodiment, the IF mode is configured to drive the current. IF mode is the current-frequency ratio control mode. For the first current, define the electrical angle period increment. , Number of sampling points per motor electrical cycle; Initialize the Fourier transform (FFT) amplitudes of the motor pole pairs down to order Npp, including... and the IF angle value Set to 0, that is, let =0.

[0058] Among them, judgment Whether it is valid or not, specifically includes:

[0059] like If true, then collect the encoder feedback value. Calculate the given value at the current position. Calculate the position error compensation value If the compensation table update trigger condition is met, then calculate and update the Fourier transform amplitude components. and And update the compensation table data, the calculation formula is:

[0060] ;in For the sequence of cosine term magnitudes, Let i be a sequence of sine term amplitude values, i=1 2 … Npp-1 is the frequency index; the electrical angle is then updated. Return to continue the judgment. Whether it is valid or not.

[0061] like If this is not met, proceed to secondary initialization, including configuring the drive current in IF mode. , and reset =0. Repeat execution. The determination of whether something is true or false includes the following:

[0062] like Then collect the encoder feedback value. Calculate the given value at the current position. Calculate the position error compensation value ; then judge Is it greater than the preset threshold? If yes, the calibration is considered a failure; otherwise, the electrical angle is updated. Return to continue the judgment. Whether it is valid or not.

[0063] like If the condition is not met, the calibration is considered successful, the error compensation table reconstruction operation is performed, and the judgment ends.

[0064] Step S4: If the preset threshold is not exceeded, determine the target position values ​​of the reconstruction error compensation table according to the preset step size, obtain the error reconstruction value corresponding to each target position value through the gradient search method, and generate the reconstruction error compensation table.

[0065] In this embodiment, the preset step size is the ratio of 2π to the number of data in the reconstruction error compensation table.

[0066] Specifically, To preset the step size, the number of data items in the reconstructed error compensation table is: ,but .

[0067] For each target location value, a gradient search method is used to perform a localization search to find the corresponding location associated with that target location value. and matching compensation value Based on the associated locations and corresponding compensation values ​​obtained from the search, the error reconstruction value corresponding to each target location value is calculated. All error reconstruction values ​​are integrated according to the order of the target position values ​​to generate a reconstruction error compensation table. ,in The corresponding compensation value is calculated using an error compensation function, which is:

[0068] .

[0069] In this embodiment, the error reconstruction value corresponding to each target position value is obtained by gradient search method, specifically including the following steps:

[0070] The search point is initialized to the target position value. If the sum of the compensation value corresponding to the search point and the search point is greater than the target position value, the current search point is recorded as the upper limit position and the corresponding upper limit compensation value, and the search point is adjusted downward.

[0071] Among them, the search point is The target location value is The compensation value corresponding to the search point is The upper limit position is The maximum compensation value is That is, if the sum of the compensation value corresponding to the search point and the search point is greater than the target position value, it can be expressed as if... Then let The maximum compensation value is search points .

[0072] If the sum of the compensation value corresponding to the search point and the search point is less than the target position value, then the current search point is recorded as the lower limit position and the corresponding lower limit compensation value, and the search point is adjusted upwards.

[0073] Among them, the search point is The target location value is The compensation value corresponding to the search point is The lower limit position is The lower limit compensation value is That is, if the sum of the compensation value corresponding to the search point and the search point is less than the target position value, it can be expressed as: if Then let The lower limit compensation value is search points .

[0074] Once the upper limit position, upper limit compensation value, lower limit position, and lower limit compensation value are obtained, the error reconstruction value corresponding to the target position value is calculated.

[0075] In another embodiment, if Ph and Pl have both been found, the error reconstruction value corresponding to the target position value is further calculated; otherwise, the gradient search process is repeated.

[0076] In this embodiment, after obtaining the upper limit position, upper limit compensation value, lower limit position, and lower limit compensation value, the error reconstruction value corresponding to the target position value is calculated, specifically including the following:

[0077] The known parameters are defined as the lower limit position, the lower limit compensation value, the upper limit position, and the upper limit compensation value. The target parameter is the compensation value corresponding to the target position value, and the target position value is between the lower limit position and the upper limit position.

[0078] Specifically, the target position value being between the lower limit and the upper limit can be described as follows: .

[0079] Divide the difference between the target position value and the lower limit position by the encoder's minimum resolvable angle to obtain the position scaling factor; calculate the difference between the upper limit compensation value and the lower limit compensation value, multiply the difference by the position scaling factor to obtain the compensation value increment; add the compensation value increment to the lower limit compensation value to obtain the error reconstruction value corresponding to the target position value.

[0080] Wherein, the difference between the target position value and the lower limit position is ( The minimum resolvable angle is The positional scaling factor is The difference between the upper limit compensation value and the lower limit compensation value is The increment of the compensation value is The formula for calculating the error reconstruction value is: .

[0081] In one specific embodiment, generating the reconstruction error compensation table specifically includes the following steps:

[0082] Perform an initialization operation, which includes defining a preset step size. Initialize target position .

[0083] determination Whether it is valid or not, specifically includes:

[0084] If not, the judgment ends;

[0085] If so, then assign values ​​to the variables, including setting values ​​in the middle positions. At the same time, initialize the status flag bits. .

[0086] Based on error compensation function calculate Corresponding encoder value ;judge Whether it is valid or not, specifically includes:

[0087] like If successful, update the status flag to... , let the upper limit position At the same time, obtain the current position upper limit compensation value. = .

[0088] like If not, update the status flag to... Set the lower limit position At the same time, obtain the lower limit compensation value of the current position. = Then, the status flags are checked, including the following:

[0089] like If true, then calculate. The error reconstruction value of the position is calculated using the following formula: And update the error compensation points. Jump back to the judgment The process continues with the determination, whereby... This is the preset step size.

[0090] like If not, then according to Current value adjustment , including: if Then let ;if Then let Jump back to the step of calculating the corresponding encoder value.

[0091] After completing the error reconstruction calculation, update the error compensation point, letting... Jump back The conditional judgment steps are repeated until the above process is completed. It is no longer valid.

[0092] Step S5: Obtain the encoder real-time feedback value, find the target compensation value corresponding to the real-time feedback value based on the reconstruction error compensation table, and obtain the calibrated encoder value by performing a difference operation between the encoder real-time feedback value and the target compensation value.

[0093] In this embodiment, step S5 includes:

[0094] Obtain the encoder's real-time feedback value, and based on the number of data in the reconstruction error compensation table and the encoder's real-time feedback value, obtain an integer index through rounding; then obtain the remainder value through the operation of the encoder's real-time feedback value, the integer index, and the number of data in the reconstruction error compensation table.

[0095] Among them, the encoder real-time feedback value is Integer index is The integer index obtained through rounding can be expressed as follows: , This is an integer operation; the remainder value is... The remainder value obtained by calculating the encoder's real-time feedback value, integer index, and the number of data in the reconstruction error compensation table can be expressed as: .

[0096] Based on the integer index, two compensation benchmark values ​​for the corresponding and adjacent positions are extracted from the reconstruction error compensation table; interpolation coefficients are calculated based on the remainder value and the number of data in the reconstruction error compensation table. The two compensation benchmark values ​​are... and The interpolation coefficients are .

[0097] Linear interpolation is performed on the two compensation reference values ​​based on the interpolation coefficients to obtain the target compensation value corresponding to the encoder real-time feedback value; the difference between the encoder real-time feedback value and the target compensation value is then calculated to obtain the calibrated encoder value. The target compensation value is... The calibrated encoder value is .

[0098] The above steps can eliminate the influence of motor magnetic field harmonics and high-frequency noise in the sequence, reduce the strong drag current of IF control mode, and determine the effectiveness of error compensation value by using encoder feedback on position linearity.

[0099] In this embodiment, as shown in the appendix Figure 3As shown, a motor encoder calibration device is also disclosed, comprising: a first acquisition module 1, a conversion module 2, a second acquisition module 3, and a calibration module 4. The first acquisition module 1 is used to configure a calibration parameter set, drive the motor to rotate at a constant speed according to a first current in a current-frequency ratio control mode, and periodically acquire encoder feedback values ​​and corresponding given position values ​​during at least one mechanical revolution of the motor, calculating an error compensation value sequence. The conversion module 2 is used to perform a Fourier transform on the error compensation value sequence, extract components less than the motor's electrical frequency from the transform result, and perform an inverse Fourier transform on these components to obtain a purified error compensation value sequence. The second acquisition module 3 is used to drive the motor to rotate at a constant speed according to a second current in a current-frequency ratio control mode, where the second current is less than the first current; during at least one mechanical revolution of the motor, it detects whether the absolute value of the error corresponding to the purified error compensation value sequence exceeds a preset threshold; if it does not exceed the preset threshold, it determines each target position value of the reconstructed error compensation table according to a preset step size, obtains the error reconstruction value corresponding to each target position value through a gradient search method, and generates a reconstructed error compensation table. The calibration module 4 is used to obtain the real-time feedback value of the encoder, find the target compensation value corresponding to the real-time feedback value based on the reconstruction error compensation table, and obtain the calibrated encoder value by performing a difference operation between the real-time feedback value of the encoder and the target compensation value.

[0100] In this embodiment, the calibration parameter set includes the MCU cyclic task cycle, the number of motor pole pairs, the number of motor electrical cycle sampling points, the number of data in the reconstruction error compensation table, and the encoder resolution.

[0101] In this embodiment, a motor encoder calibration system is also disclosed, including a controller and a memory. The controller is connected to a robot joint motor, and the memory is used to store a computer program executable by the processor. The processor is configured to execute the computer program in the memory to implement the motor encoder calibration method as described above.

[0102] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention 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 of the technical features; and these 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 the present invention.

[0103] In summary, the above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made within the scope of the claims of the present invention should be covered by the present invention.

Claims

1. A method for calibrating a motor encoder, characterized in that, Includes the following steps: Configure the calibration parameter set, drive the motor to rotate at a constant speed in the current-frequency ratio control mode according to the first current, and periodically collect the encoder feedback value and the corresponding given position value during the process of the motor rotating at least one mechanical revolution, and calculate the error compensation value sequence. Perform a Fourier transform on the error compensation value sequence, extract the components in the transform result that are less than the electrical frequency of the motor, perform an inverse Fourier transform on the components, and obtain the purified error compensation value sequence. The motor is driven to rotate at a constant speed in a current-frequency ratio control mode according to a second current, where the second current is less than the first current; during the process of the motor rotating at least one mechanical revolution, it is detected whether the absolute value of the error corresponding to the purified error compensation value sequence exceeds a preset threshold. If the preset threshold is not exceeded, the target position values ​​of the reconstruction error compensation table are determined according to the preset step size, and the error reconstruction value corresponding to each target position value is obtained by gradient search method to generate the reconstruction error compensation table. Obtain the real-time feedback value of the encoder, find the target compensation value corresponding to the real-time feedback value based on the reconstruction error compensation table, and obtain the calibrated encoder value by performing a difference operation between the real-time feedback value of the encoder and the target compensation value.

2. The motor encoder calibration method according to claim 1, characterized in that: The calibration parameter set includes the MCU cyclic task cycle, the number of motor pole pairs, the number of motor electrical cycle sampling points, the number of data in the reconstruction error compensation table, and the encoder resolution.

3. The motor encoder calibration method according to claim 1, characterized in that, The error reconstruction value corresponding to each target location is obtained by gradient search, which includes the following steps: Initialize the search point to the target position value. If the sum of the compensation value corresponding to the search point and the search point is greater than the target position value, then record the current search point as the upper limit position and the corresponding upper limit compensation value, and adjust the search point downwards. If the sum of the compensation value corresponding to the search point and the search point is less than the target position value, then record the current search point as the lower limit position and the corresponding lower limit compensation value, and adjust the search point upwards; Once the upper limit position, upper limit compensation value, lower limit position, and lower limit compensation value are obtained, the error reconstruction value corresponding to the target position value is calculated.

4. The motor encoder calibration method according to claim 3, characterized in that, After obtaining the upper limit position, upper limit compensation value, lower limit position, and lower limit compensation value, the error reconstruction value corresponding to the target position value is calculated, specifically including the following: The known parameters are defined as the lower limit position, the lower limit compensation value, the upper limit position, and the upper limit compensation value. The target parameter is the error reconstruction value corresponding to the target position value, and the target position value is between the lower limit position and the upper limit position. Divide the difference between the target position value and the lower limit position by the minimum resolvable angle of the encoder to obtain the position scaling factor; calculate the difference between the upper limit compensation value and the lower limit compensation value, and multiply the difference by the position scaling factor to obtain the compensation value increment; The incremental compensation value is added to the lower limit compensation value to obtain the error reconstruction value corresponding to the target position value.

5. The motor encoder calibration method according to claim 4, characterized in that: The magnitude of the second current is 1 / 4 to 1 / 2 of the first current.

6. The motor encoder calibration method according to claim 4, characterized in that: The preset step size is the ratio of the total electrical angle 2π corresponding to the motor mechanical circle to the number of data in the reconstruction error compensation table.

7. The motor encoder calibration method according to claim 6, characterized in that, Obtain the encoder's real-time feedback value, find the target compensation value corresponding to the real-time feedback value based on the reconstruction error compensation table, and obtain the calibrated encoder value by performing a difference operation between the encoder's real-time feedback value and the target compensation value. Specifically, this includes: Obtain the encoder's real-time feedback value, and based on the number of data in the reconstruction error compensation table and the encoder's real-time feedback value, obtain an integer index through rounding; then obtain the remainder value by calculating the encoder's real-time feedback value, the integer index, and the number of data in the reconstruction error compensation table. Based on the integer index, extract two compensation reference values ​​for the corresponding and adjacent positions from the reconstruction error compensation table; calculate the interpolation coefficients based on the remainder value and the number of data in the reconstruction error compensation table; Linear interpolation is performed on the two compensation reference values ​​according to the interpolation coefficients to obtain the target compensation value corresponding to the encoder real-time feedback value; the difference between the encoder real-time feedback value and the target compensation value is calculated to obtain the calibrated encoder value.

8. A motor encoder calibration device, characterized in that, include: The first acquisition module is used to configure the calibration parameter set, drive the motor to rotate at a constant speed according to the first current in the current-frequency ratio control mode, and periodically acquire the encoder feedback value and the corresponding given position value during the process of the motor rotating at least one mechanical revolution, and calculate the error compensation value sequence. The conversion module is used to perform a Fourier transform on the error compensation value sequence, extract the components in the transformation result that are less than the electrical frequency of the motor, perform an inverse Fourier transform on the components, and obtain a purified error compensation value sequence. The second acquisition module is used to drive the motor to rotate at a constant speed according to the second current in the current-frequency ratio control mode, wherein the second current is less than the first current; during the process of the motor rotating at least one mechanical revolution, it detects whether the absolute value of the error corresponding to the purified error compensation value sequence exceeds a preset threshold. If the preset threshold is not exceeded, the target position values ​​of the reconstruction error compensation table are determined according to the preset step size, and the error reconstruction value corresponding to each target position value is obtained by gradient search method to generate the reconstruction error compensation table. The calibration module is used to obtain the real-time feedback value of the encoder, find the target compensation value corresponding to the real-time feedback value based on the reconstruction error compensation table, and obtain the calibrated encoder value by performing a difference operation between the real-time feedback value of the encoder and the target compensation value.

9. The motor encoder calibration device according to claim 8, characterized in that: The calibration parameter set includes the MCU cyclic task cycle, the number of motor pole pairs, the number of motor electrical cycle sampling points, the number of data in the reconstruction error compensation table, and the encoder resolution.

10. A motor encoder calibration system, characterized in that, The system includes a controller and a memory, the controller being connected to robot joint motors, and the memory storing a computer program executable by the processor, wherein the processor is configured to execute the computer program in the memory to implement the method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Asynchronous sampling rate conversion device and method

    CN110708069A

  • Error correction method, terminal equipment and computer readable storage medium

    CN116046044A

  • Method for determining brightness voltage of unlocking area, program product and electronic device

    CN119741893A

  • Off-axis magnetic encoder data calibration compensation method

    CN120760774A

  • Ground station antenna pointing error compensation method and related equipment

    CN121484423A