Robot motor magnetic encoder error compensation method based on polynomial approximation

By combining polynomial approximation and phase-locked loop, the problem of signal distortion of magnetic encoders in robot joint modules is solved, achieving high-precision rotor position measurement, improving the positioning accuracy and motion smoothness of robot joints, and reducing the overhead of storage and computing resources.

CN121966378APending Publication Date: 2026-05-01XIAN BEIDEXIN DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XIAN BEIDEXIN DATA TECH CO LTD
Filing Date
2026-03-25
Publication Date
2026-05-01

Smart Images

  • Figure CN121966378A_ABST
    Figure CN121966378A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of motor control, and particularly discloses a robot motor magnetic encoder error compensation method based on polynomial approximation, and the method comprises the steps: collecting N original signals of a magnetic encoder; error signals are calculated and segmented; performing centralization and standardization transformation on the uncompensated rotor position in each error signal segment to obtain a transformed position; segmenting each error signal, fitting an n-order polynomial by adopting a least square method, and establishing a mapping relation between the transformed position and the error signal; solving and storing a polynomial coefficient matrix; electromagnetic encoder signals in the motor operation process are collected in real time, a corresponding polynomial coefficient matrix is called, and a real-time compensation value is calculated; calculating a compensated electromagnetic encoder signal based on the real-time compensation value; and carrying out position calculation on the compensated electromagnetic encoder signal by adopting a phase-locked loop. According to the invention, high-precision rotor position measurement can be realized under extremely low resource overhead.
Need to check novelty before this filing date? Find Prior Art

Description

Error Compensation Method for Robot Motor Magnetic Encoders Based on Polynomial Approximation Technical Field

[0001] This invention relates to the field of motor control technology, and more specifically to a method for error compensation of motor magnetic encoder in robot joint modules based on polynomial approximation. Background Technology

[0002] Permanent magnet synchronous motors (PMSMs), with their high torque density, compact structure, and excellent dynamic response performance, have become the core drive component in robot joint modules. In robotic applications, the control performance of PMSMs, such as the smoothness of motion and the accuracy of positioning, highly depends on the accurate measurement of the motor rotor position; therefore, reliable position sensors are indispensable.

[0003] Among numerous position sensing solutions, magnetic encoders have been widely used in robotic systems due to their high tolerance to harsh environments such as dust and oil, compact structure, and cost advantages. Their basic working principle is as follows: when a multi-pole permanent magnet (usually a magnetic ring) fixed coaxially with the motor rotor rotates, the rotating magnetic field it generates is detected by a fixed magnetic sensing chip. This chip integrates an array of magnetic sensing elements such as Hall effect sensors, anisotropic magnetoresistive sensors, or giant magnetoresistive sensors, which can calculate the direction of the magnetic field in real time and output two analog signals, a sine and a cosine, with a 90° phase difference.

[0004] In practical applications, one approach is to use these analog signals to generate digital pulses, simulating the operation of an incremental encoder. However, this pulse integration method has inherent discontinuities and cumulative integration drift problems, which degrade position accuracy after long-term operation, failing to meet the stringent position fidelity requirements of high-precision robots.

[0005] Therefore, a better approach is to directly utilize the original sine and cosine analog signals output by the magnetic encoder and reconstruct a full-cycle, continuous rotor angle through arctangent calculation. However, although theoretically feasible, in the compact and complex internal environment of the PMSM robot, the inherent characteristic of magnetic encoders based on magnetic field measurements makes them highly susceptible to various environmental interferences, leading to severe signal distortion.

[0006] First, there's the sensitivity to external magnetic fields and electromagnetic interference: Magnetic encoders rely on the precise measurement of the weak magnetic field generated by their own permanent magnets. However, inside a robot joint, the motor stator windings generate a high-intensity, high-frequency dynamic electromagnetic field. This powerful interference field directly superimposes on and distorts the original magnetic field distribution of the encoder's permanent magnets, causing the magnetic field vector received by the magnetic sensing chip to shift and become distorted. This ultimately manifests as significant DC bias and harmonic components in the output signal.

[0007] Secondly, the magneto-mechanical coupling characteristics and mechanical misalignment: the output accuracy of a magnetic encoder is highly dependent on the precise relative positional relationship between the permanent magnet and the magnetic sensing chip. During assembly, any minute mechanical misalignment, such as changes in air gap, eccentricity, or tilt, will directly alter the magnitude and direction of the magnetic flux density at the location of the magnetic sensing element, thereby causing periodic modulation of the output signal amplitude and phase. After arctangent calculation, this inevitably produces cyclic angular errors (i.e., angular ripple).

[0008] Secondly, the temperature sensitivity and thermal drift of materials: Robot joint modules generate significant heat during operation. Increased temperature affects two core components of the magnetic encoder: on the one hand, the remanence of the permanent magnet decreases with increasing temperature, leading to a weakening of the magnetic field strength and a decrease in the overall signal amplitude; on the other hand, the magnetic sensing chip and its internal signal processing circuits also exhibit temperature drift, causing additional bias and gain errors in the signal.

[0009] Finally, there are manufacturing tolerances for permanent magnets: It is difficult to achieve absolute uniformity in the magnetization process of multi-pole magnetic rings used in encoders, and slight differences in the strength of each pole may exist. This inherent magnetization non-uniformity also results in the output sine and cosine signals not being ideal sine waves, but rather containing various higher harmonics.

[0010] Therefore, in high-precision continuous position estimation of robot PMSMs, the signal distortion caused by the combined effects of multiple interference factors, determined by the working principle of the magnetic encoder itself, cannot be ignored. Existing compensation methods mostly employ lookup tables, but this requires a difficult trade-off between accuracy and controller memory usage, making it unsuitable for resource-constrained robot controllers with extremely high accuracy requirements. Therefore, in application scenarios such as compact robot joint modules with strong interference and limited controller resources, how to effectively overcome the inherent contradiction between accuracy and memory usage in traditional methods, and compensate for the comprehensive signal distortion caused by the coupling of multiple sources such as electromagnetic interference, mechanical misalignment, thermal drift, and permanent magnet manufacturing tolerances, thereby achieving high-precision rotor position measurement with minimal resource overhead, and ultimately improving the positioning accuracy and motion smoothness of robot joints, is a technical challenge that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0011] In view of the above problems, the present invention proposes a robot motor magnetic encoder error compensation method based on polynomial approximation, so as to overcome the above problems or at least partially solve the above problems.

[0012] To achieve the above objectives, the present invention adopts the following technical solution:

[0013] A method for error compensation of a robot motor magnetic encoder based on polynomial approximation includes a calibration step and a real-time compensation step. The calibration step includes: S11, under steady-state conditions, acquiring N original signals from the magnetic encoder at a preset sampling frequency; S12, subtracting the ideal waveform from the original signals to obtain an error signal containing nonlinear distortion, and segmenting the error signal; S13, performing centering and normalization transformations on the uncompensated rotor position within each error signal segment to obtain the transformed position; S14, for each error signal segment, fitting an nth-order polynomial using the least squares method to establish a mapping relationship between the transformed position and the error signal; S15, solving and storing the polynomial coefficient matrix. The real-time compensation step includes: S21, acquiring the electromagnetic encoder signal during the operation of the robot joint module motor in real time, retrieving the corresponding polynomial coefficient matrix, and calculating the real-time compensation value; S22, calculating the compensated electromagnetic encoder signal based on the real-time compensation value; S23, using a phase-locked loop to calculate the position of the compensated electromagnetic encoder signal.

[0014] Furthermore, S11 includes: starting the motor via magnetic field orientation control and stabilizing it at a set speed. Switch online to open-loop voltage-frequency control mode to maintain the d-axis voltage reference value. Record the q-axis voltage V after low-pass filtering. q mean As the q-axis voltage reference value, a synchronous ideal ramp signal is used. This replaces the magnetic encoder to measure position and achieve constant-speed rotation; under steady-state conditions, it acquires the original sine and cosine analog signals output by the encoder at a preset sampling frequency to obtain N sampling points; the ideal sine and cosine waveforms are set as standard orthogonal signals with unit amplitude.

[0015] Among them, V in The unit amplitude of a sine or cosine signal is expressed in per-unit value, and θ is the ideal rotor position.

[0016] Furthermore, S12 includes: subtracting the ideal sine waveform from the acquired original sine signal to obtain the sine error signal, and subtracting the ideal cosine waveform from the original cosine signal to obtain the cosine error signal, the calculation formula being:

[0017] in, Here, E is the sampling point number, and N is the total number of sampling points. s (i) represents the sinusoidal error signal, E c (i) represents the cosine error signal; This represents the original sinusoidal signal at the i-th sampling point. This represents the original cosine signal at the i-th sampling point. This represents the ideal synchronous ramp position corresponding to the i-th sampling point; the error signal is segmented at each quadrant boundary, dividing the complete period's sinusoidal error signal into segments. The cosine error signal is divided into four segments. The rotor is divided into four segments, and the rotor position range corresponding to each segment is as follows: First quadrant: Second Quadrant: Third Quadrant: Fourth Quadrant: .

[0018] Furthermore, S13 includes: segmenting each error signal. Uncompensated rotor position within The positions are obtained by performing centering and standardization transformations. :

[0019] in, Indicates error signal segmentation The mean, The standard deviation of the error signal segments is represented by the following formula:

[0020]

[0021] Where M represents the segment The number of sampling points included; the subscript x represents the quadrant number; y represents the sine signal s or the cosine signal c; i represents the sampling point number within the error signal segment; the mean and standard deviation of the error signal segment under each quadrant are stored.

[0022] Furthermore, S14 includes: constructing a position power matrix θ from the (n+1) different powers of all transformed position samples within each error signal segment. p The position power matrix θ p Each row in the matrix corresponds to a transformation position in a quadrant and its power; polynomial approximation matrix With the polynomial coefficient matrix And position power matrix The relationship is: ; where the superscript T denotes matrix transpose.

[0023] Furthermore, S15 includes: solving for the polynomial coefficient matrix of each error signal segment of the sine and cosine signals using the least squares method. This minimizes the sum of squared fitting errors and stores all coefficient matrices.

[0024] Furthermore, S21 includes: during the operation of the robot joint module motor, acquiring the sine and cosine signals of the electromagnetic encoder at the current time k; and reading the mean value of the quadrant x where the current uncompensated rotor position is located. and standard deviation Perform centering and standardization transformations to obtain the transformed position; for the sine and cosine signals at the current time, call the polynomial coefficients of the corresponding quadrant x respectively, substitute them into the transformed position, perform polynomial evaluation according to Horner's rule, perform 4n multiplication operations and (2n+4) addition operations to obtain the compensation values ​​of the sine and cosine signals at time k.

[0025] Furthermore, S23 includes: performing arctangent calculation on the compensated electromagnetic encoder sine and cosine signals to obtain a rough rotor position, and performing low-pass filtering on the rough rotor position to obtain the speed feedforward compensation term, the calculation formula of which is:

[0026]

[0027] in, and These represent the compensated sine and cosine signals, respectively, with LPF indicating a low-pass filter operation. This represents the approximate rotor position calculated at the current time k. T represents the approximate rotor position calculated by k-1 at the previous moment. s The sampling period is represented by the following discrete difference equations for the phase-locked loop:

[0028]

[0029]

[0030] Where k represents the k-th sampling time, The adjusted rotational speed is the output speed of the phase-locked loop at time k. Here, ω′(k) represents the estimated rotor speed at time k, e(k) represents the phase detection error at time k, e(k-1) represents the phase detection error at time k-1, and ω′(k-1) represents the estimated rotor speed at time k-1. and These are the parameters for the proportional-integral controller; This represents the compensated input rotor position at time k. This represents the estimated rotor position at time k. This represents the estimated rotor position at time k-1.

[0031] Furthermore, in S14, the total harmonic distortion (THD) and peak position error e of the compensated electromagnetic encoder signal are plotted. peak Number of storage coefficients N coef and overall computation execution time t exe The performance surface plots of these four indicators vary with the number of error signal segments s and the polynomial order n. The operating point that achieves the best trade-off between the four indicators is found in the range of s∈[2,8] and n∈[3,9]. s=4 and n=5 are selected.

[0032] Furthermore, in S21, when calculating the real-time compensation value, by determining the quadrant in which the current rotor position is located, only the multiplication operation of the polynomial coefficients and the position power of the corresponding row is activated, and the calculation results of the other three quadrants are zero.

[0033] As can be seen from the above technical solution, compared with the prior art, the present invention has the following beneficial effects: The present invention, through a piecewise n-order polynomial approximation algorithm, can simultaneously compensate for multiple non-ideal factors such as amplitude mismatch, DC bias, non-orthogonality, and harmonic distortion; compared with high-resolution lookup tables, only multiple coefficients need to be stored to achieve high-precision compensation, greatly reducing storage space; it can compensate for each continuous input position without interpolation or quantization operations, achieving real-time, high-precision correction of the magnetic encoder output signal with minimal computational and storage resource overhead, thereby improving the positioning accuracy and motion smoothness of robot joints and effectively overcoming the inherent contradiction between compensation accuracy and controller memory usage in traditional methods. Simultaneously, the calibration program does not require a high-precision reference encoder, and uses open-loop voltage-frequency control to achieve constant motor speed operation, reducing speed fluctuations during the calibration process. Furthermore, the present invention, combined with a phase-locked loop to suppress high-frequency electromagnetic interference, significantly improves the application performance of low-cost magnetic encoders in permanent magnet synchronous motor drives for electric vehicles. Attached Figure Description

[0034] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0035] Figure 1 is a flowchart of the robot motor magnetic encoder error compensation method based on polynomial approximation provided in an embodiment of the present invention. Detailed Implementation

[0036] 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.

[0037] As shown in Figure 1, this invention discloses a method for error compensation of a robot motor magnetic encoder based on polynomial approximation, including a calibration step and a real-time compensation step. The calibration step includes: S11, under steady-state conditions, acquiring N original signals from the magnetic encoder at a preset sampling frequency; S12, subtracting the ideal waveform from the original signals to obtain an error signal containing nonlinear distortion, and segmenting the error signal; S13, performing centering and normalization transformations on the uncompensated rotor position within each error signal segment to obtain the transformed position; S14, for each error signal segment, fitting an nth-order polynomial using the least squares method to establish a mapping relationship between the transformed position and the error signal; S15, solving and storing the polynomial coefficient matrix. The real-time compensation step includes: S21, acquiring the electromagnetic encoder signal during the operation of the robot joint module motor in real time, retrieving the corresponding polynomial coefficient matrix, and calculating the real-time compensation value; S22, calculating the compensated electromagnetic encoder signal based on the real-time compensation value; S23, using a phase-locked loop to calculate the position of the compensated electromagnetic encoder signal.

[0038] The following provides further explanation of each of the above steps.

[0039] S1. Execute the calibration procedure, specifically including: S11. After installing the magnetic encoder on the permanent magnet synchronous motor, start the motor and stabilize it at the set speed through field-oriented control. Record the q-axis voltage V after low-pass filtering. q mean Voltage amplitude to frequency ratio satisfy: .

[0040] Switch online to open-loop voltage-frequency control mode to maintain d-axis voltage reference value. The q-axis voltage V after low-pass filtering q mean Using the q-axis voltage reference value, a synchronous ideal ramp signal is employed. It replaces the magnetic encoder to measure position and achieve constant speed rotation; under steady-state conditions, it collects the original sine analog signal and the original cosine analog signal output by the encoder according to the preset sampling frequency to obtain N sampling points; where the sampling frequency is set to 10 kHz, the sampling duration is 1 second, and the sampling points N=10000.

[0041] Set the ideal sine and cosine waveforms as standard quadrature signals with unit amplitude:

[0042] Among them, V in The unit amplitude of a sine or cosine signal is expressed in per-unit value, and θ is the ideal rotor position.

[0043] The low-pass filter uses a first-order filter with a cutoff frequency f. c Set to 10 Hz, the transfer function is:

[0044] in, The cutoff angular frequency is set to sufficiently attenuate the speed oscillations from the rotor position error, ensuring that the encoder signal frequency variation range is limited to within ±0.017Hz during voltage frequency control.

[0045] S12. Extract the error signal and process it in segments, specifically including: subtracting the ideal sine waveform from the acquired original sine signal to obtain the sine error signal; subtracting the ideal cosine waveform from the original cosine signal to obtain the cosine error signal. The calculation formula is as follows:

[0046] in, Here, E is the sampling point number, and N is the total number of sampling points. s (i) represents the sinusoidal error signal, E c (i) represents the cosine error signal; This represents the original sinusoidal signal at the i-th sampling point. This represents the original cosine signal at the i-th sampling point. This represents the ideal synchronous ramp position corresponding to the i-th sampling point; the error signal is segmented at each quadrant boundary, dividing the complete period's sinusoidal error signal into segments. The cosine error signal is divided into four segments. The rotor is divided into four segments, and the rotor position range corresponding to each segment is as follows: First quadrant: Second Quadrant: Third Quadrant: Fourth Quadrant: .

[0047] S13. Perform centering and standardization transformations on the error signal segments, specifically including: dividing each error signal segment... Uncompensated rotor position within The positions are obtained by performing centering and standardization transformations. :

[0048] in, Indicates error signal segmentation The mean, The standard deviation of the error signal segments is represented by the following formula:

[0049]

[0050] Where M represents the segment The number of sampling points included; the subscript x indicates the quadrant number; y indicates the sine signal s or the cosine signal c; i indicates the sampling point number within the error signal segment; this transformation operation improves the numerical stability of polynomial fitting.

[0051] Then, the mean and standard deviation of the error signal segments in each quadrant are stored.

[0052] S14. Apply the least squares method to perform polynomial approximation, specifically including: segmenting each error signal. The least squares method is used to fit the nth-order polynomial. Establish the transformed position Mapping relationship with error signal; comprehensively considering total harmonic distortion (THD) and peak position error of the compensated signal. Number of storage coefficients and algorithm execution time The trade-off relationship is determined by plotting the total harmonic distortion (THD) and peak position error e of the compensated electromagnetic encoder signal. peak Number of storage coefficients N coef and overall computation execution time t exe The performance surface plots of these four indicators as a function of the number of error signal segments s and the polynomial order n were used to find the optimal compromise point for the four indicators within the ranges of s∈[2,8] and n∈[3,9]. The number of segments was ultimately selected. Polynomial order As the optimal operating point, the position power matrix θ is constructed from the (n+1) different powers of all transformed position samples within each error signal segment. p :

[0053] Wherein, the position power matrix θ p Each row in the matrix corresponds to a transformation position in a quadrant and its power; polynomial approximation matrix With the polynomial coefficient matrix And position power matrix The relationship is: ; where the superscript T denotes matrix transpose.

[0054] S15. Solve for and store the polynomial coefficient matrix, specifically including: solving for the polynomial coefficient matrix of each error signal segment of the sine and cosine signals using the least squares method. To minimize the sum of squared fitting errors, the specific formula is:

[0055] in, Indicates error signal segmentation The error signal at the i-th sampling point, This represents the calculated value after substituting the transformed position of the error signal at the i-th sampling point into the nth-order polynomial.

[0056] The polynomial coefficient matrix obtained by solving is:

[0057] Each row represents the coefficients of six polynomials in one quadrant. Represents the x-th quadrant The coefficients corresponding to the j-th power. Construct coefficient matrices for both sine and cosine signals. and All coefficient matrices are stored in the digital signal processor's read-only memory, and the total number of stored coefficients is:

[0058] Here, factor 2 represents the two signals, sine and cosine, s=4 is the number of segments, and (n+2) includes n+1 polynomial coefficients plus a set of mean μ and standard deviation σ.

[0059] More advantageously, the least squares method solves for polynomial coefficients by constructing a system of normal equations: The optimal coefficient vector is obtained by solving the problem. ,in This is the column vector of error signal samples for the corresponding segment.

[0060] S2. Real-time compensation steps, specifically including: S21. During the operation of the robot joint module motor, acquire the sine and cosine signals of the electromagnetic encoder at the current time k; based on the quadrant x where the uncompensated rotor position is located, read the mean value of that quadrant. and standard deviation Perform centralization and normalization transformations to obtain the transformed positions: For the sine and cosine signals at the current moment, respectively call the polynomial coefficients of the corresponding quadrant x. The transformed positions are then substituted into the equation, and the polynomial is evaluated according to Horner's rule. Horner's rule transforms high-order power calculations into consecutive multiplications and additions through nested parentheses, thus reducing the computational load. Multiplication refers to the product of the polynomial coefficients and the transformed positions (or intermediate variables), while addition refers to the summation operation in the accumulation step. Performing 4n = 20 multiplications and (2n + 4) = 14 additions yields the compensation values ​​for the sine and cosine signals at time k. The specific calculation process is as follows:

[0061] Rewrite it as a nested multiplication form to optimize computational efficiency:

[0062] in, The compensation value for the sine or cosine signal at the k-th sampling time is calculated separately for the sine and cosine signals. and .

[0063] In this step, only the multiplication operation of the polynomial coefficients and position powers of the corresponding row is activated, and the calculation results of the other three quadrants are zero, avoiding unnecessary computational overhead and improving real-time performance.

[0064] S22. Calculate the compensated electromagnetic encoder signal based on the real-time compensation value: The calculated compensation value... and The uncompensated sine and cosine voltage signals are superimposed on the k-th sampling time respectively. and Above, the compensated signal is obtained:

[0065] in, and These are the compensated sine and cosine signals, respectively.

[0066] After compensation, the total harmonic distortion (THD) of the signal can be reduced to below 0.3%. The formula for calculating THD is as follows:

[0067] in, The effective value of the h-th harmonic current. Here, is the effective value of the fundamental current, and H is the highest harmonic order considered.

[0068] Meanwhile, the non-orthogonality error changes from before compensation. Improved from 0.17° to +0.02°, non-orthogonal angle The calculation is as follows:

[0069] S23. Position calculation and electromagnetic interference suppression using a phase-locked loop (PLL) specifically include: using a type-II PLL to calculate the position of the compensated sine and cosine signals, and further suppressing high-frequency electromagnetic interference spikes caused by inverter commutation through the inherent low-pass filtering characteristics of the PLL. The continuous transfer function of the PLL is:

[0070] in, For the Laplace transform of the input rotor position, To estimate the Laplace transform of the output position, S denotes the Laplace operator; and The parameters of the proportional-integral controller satisfy the following relationship:

[0071] in, For natural frequency, This refers to the damping coefficient. The damping coefficient is set... The transfer function is simplified to a first-order system to avoid amplifying position errors near the bandwidth. Phase-locked loop bandwidth. Set to 510 radians / second, calculate the natural frequency using the following formula:

[0072] Substitution Solving for the problem, we get:

[0073] Then, the controller parameters are calculated:

[0074] The Euler backward difference method is used, utilizing the mapping relationship between the S-domain and the Z-domain. Discretize the continuous transfer function to obtain the discrete transfer function:

[0075] Where Z is a complex variable in the Z-domain, and Ts = 50 μs is the sampling period. Substituting the parameters, we get:

[0076]

[0077] Specifically, in this invention, the arctangent of the compensated electromagnetic encoder sine and cosine signals is first calculated to obtain a rough rotor position. Then, a low-pass filter is applied to the rough rotor position to obtain the speed feedforward compensation term. The calculation formula is as follows:

[0078]

[0079] in, and These represent the compensated sine and cosine signals, respectively, with LPF indicating a low-pass filter operation. This represents the approximate rotor position calculated at the current time k. T represents the approximate rotor position calculated by k-1 at the previous moment. s The sampling period is represented by the following discrete difference equations for the phase-locked loop:

[0080]

[0081]

[0082] Where k represents the k-th sampling time, The adjusted rotational speed is the output speed of the phase-locked loop at time k. Here, ω′(k) represents the estimated rotor speed at time k, e(k) represents the phase detection error at time k, e(k-1) represents the phase detection error at time k-1, and ω′(k-1) represents the estimated rotor speed at time k-1. and These are the parameters for the proportional-integral controller; This represents the compensated input rotor position at time k. This represents the estimated rotor position at time k. This represents the estimated rotor position at time k-1.

[0083] The total position error of the final output rotor position θ′(k) is controlled within ±0.2 mechanical degrees. The position error is defined as:

[0084] Where, θ ref (k) represents the actual rotor position.

[0085] In this step, the phase-locked loop rotates at speed ω m At 5000 r / min, the attenuation of the second harmonic is |H(2ω)|.m )∣≈ 7.3dB, the attenuation of the tenth harmonic is |H(10ω) m )∣≈ 20.5 dB can effectively suppress harmonic components in position errors. The calculation formula is as follows:

[0086] Where j represents the imaginary unit, and ω represents the angular frequency of the input signal, which is a variable used to describe the response characteristics of the phase-locked loop system to signals of different frequencies.

[0087] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0088] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for error compensation of a robot motor magnetic encoder based on polynomial approximation, characterized in that, The system includes calibration and real-time compensation steps. The calibration steps include: S11, under steady-state conditions, acquiring N raw signals from the magnetic encoder at a preset sampling frequency; S12, subtracting the ideal waveform from the raw signals to obtain an error signal containing nonlinear distortion, and segmenting the error signal; S13, centering and standardizing the uncompensated rotor position within each error signal segment to obtain the transformed position; S14, fitting an nth-order polynomial to each error signal segment using the least squares method to establish a mapping relationship between the transformed position and the error signal; S15, solving and storing the polynomial coefficient matrix. The real-time compensation steps include: S21, acquiring electromagnetic encoder signals during the robot joint module motor operation in real time, retrieving the corresponding polynomial coefficient matrix, and calculating the real-time compensation value; S22, calculating the compensated electromagnetic encoder signal based on the real-time compensation value; S23, using a phase-locked loop to calculate the position of the compensated electromagnetic encoder signal.

2. The robot motor magnetic encoder error compensation method based on polynomial approximation as described in claim 1, characterized in that, S11 includes: starting the motor via magnetic field orientation control and stabilizing it at a set speed. Switch online to open-loop voltage-frequency control mode to maintain the d-axis voltage reference value. Record the q-axis voltage V after low-pass filtering. q mean As the q-axis voltage reference value, a synchronous ideal ramp signal is used. This replaces the magnetic encoder to measure position and achieve constant-speed rotation; under steady-state conditions, it acquires the original sine and cosine analog signals output by the encoder at a preset sampling frequency to obtain N sampling points; the ideal sine and cosine waveforms are set as standard orthogonal signals with unit amplitude. Among them, V in The unit amplitude of a sine or cosine signal is expressed in per-unit value, and θ is the ideal rotor position.

3. The robot motor magnetic encoder error compensation method based on polynomial approximation as described in claim 1, characterized in that, S12 includes: subtracting the ideal sine waveform from the acquired original sine signal to obtain the sine error signal, and subtracting the ideal cosine waveform from the original cosine signal to obtain the cosine error signal. The calculation formula is as follows: in, Here, E is the sampling point number, and N is the total number of sampling points. s (i) represents the sinusoidal error signal, E c (i) represents the cosine error signal; This represents the original sinusoidal signal at the i-th sampling point. This represents the original cosine signal at the i-th sampling point. This represents the ideal synchronous ramp position corresponding to the i-th sampling point; the error signal is segmented at each quadrant boundary, dividing the complete period's sinusoidal error signal into segments. The cosine error signal is divided into four segments. The rotor is divided into four segments, and the rotor position range corresponding to each segment is as follows: First quadrant: Second Quadrant: Third Quadrant: Fourth Quadrant: 。 4. The robot motor magnetic encoder error compensation method based on polynomial approximation as described in claim 3, characterized in that, S13 includes: segmenting each error signal. Uncompensated rotor position within The positions are obtained by performing centering and standardization transformations. : in, Indicates error signal segmentation The mean, The standard deviation of the error signal segments is represented by the following formula: Where M represents the segment The number of sampling points included; the subscript x represents the quadrant number; y represents the sine signal s or the cosine signal c; i represents the sampling point number within the error signal segment; the mean and standard deviation of the error signal segment under each quadrant are stored.

5. The robot motor magnetic encoder error compensation method based on polynomial approximation as described in claim 4, characterized in that, S14 includes: constructing a position power matrix θ from the (n+1) different powers of all transformed position samples within each error signal segment. p The position power matrix θ p Each row in the matrix corresponds to a transformation position in a quadrant and its power; polynomial approximation matrix With the polynomial coefficient matrix And position power matrix The relationship is: ; where the superscript T denotes matrix transpose.

6. The error compensation method for robot motor magnetic encoders based on polynomial approximation as described in claim 5, characterized in that, S15 includes: solving the polynomial coefficient matrix of each error signal segment of the sine and cosine signals using the least squares method. This minimizes the sum of squared fitting errors and stores all coefficient matrices.

7. The robot motor magnetic encoder error compensation method based on polynomial approximation as described in claim 3, characterized in that, S21 includes: during the operation of the robot joint module motor, acquiring the sine and cosine signals of the electromagnetic encoder at the current time k; and reading the mean value of the quadrant x where the current uncompensated rotor position is located. and standard deviation Perform centering and standardization transformations to obtain the transformed position; for the sine and cosine signals at the current time, call the polynomial coefficients of the corresponding quadrant x respectively, substitute them into the transformed position, perform polynomial evaluation according to Horner's rule, perform 4n multiplication operations and (2n+4) addition operations to obtain the compensation values ​​of the sine and cosine signals at time k.

8. The robot motor magnetic encoder error compensation method based on polynomial approximation as described in claim 1, characterized in that, S23 includes: calculating the arctangent of the compensated electromagnetic encoder sine and cosine signals to obtain a rough rotor position, and performing low-pass filtering on the rough rotor position to obtain the speed feedforward compensation term. The calculation formula is as follows: in, and These represent the compensated sine and cosine signals, respectively, with LPF indicating a low-pass filter operation. This represents the approximate rotor position calculated at the current time k. T represents the approximate rotor position calculated by k-1 at the previous moment. s The sampling period is represented by the following discrete difference equations for the phase-locked loop: Where k represents the k-th sampling time, The adjusted rotational speed is the output speed of the phase-locked loop at time k. Here, ω′(k) represents the estimated rotor speed at time k, e(k) represents the phase detection error at time k, e(k-1) represents the phase detection error at time k-1, and ω′(k-1) represents the estimated rotor speed at time k-1. and These are the parameters for the proportional-integral controller; This represents the compensated input rotor position at time k. This represents the estimated rotor position at time k. This represents the estimated rotor position at time k-1.

9. The robot motor magnetic encoder error compensation method based on polynomial approximation as described in claim 1, characterized in that, In S14, the total harmonic distortion (THD) and peak position error e of the compensated electromagnetic encoder signal are plotted. peak Number of storage coefficients N coef and overall computation execution time t exe The performance surface plots of these four indicators vary with the number of error signal segments s and the polynomial order n. The operating point that achieves the best trade-off between the four indicators is found in the range of s∈[2,8] and n∈[3,9]. s=4 and n=5 are selected.

10. The robot motor magnetic encoder error compensation method based on polynomial approximation as described in claim 7, characterized in that, In S21, when calculating the real-time compensation value, the multiplication operation of the polynomial coefficients and the position power of the corresponding row is activated only by determining the quadrant in which the current rotor position is located, while the calculation results of the other three quadrants are zero.