Encoder calibration method, device, host computer and storage medium

By acquiring the encoder's target and reference position sequences, determining the compensation error sequence and performing fitting processing, the function compensation coefficients are obtained. This solves the problem of large errors in traditional encoders, achieving high-precision angular position measurement and reducing calibration time.

CN117589221BActive Publication Date: 2026-11-24SHENZHEN SHUMA ELECTRONICS TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311577385.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-22
Publication Date
2026-11-24
Estimated Expiration
2043-11-22

AI Technical Summary

Technical Problem

Traditional encoders have large errors in angular position measurement, which cannot meet the stringent requirements of industry for high precision, fast response and anti-interference.

Method used

By acquiring the output sequence of the encoder to be calibrated and the sequence of the reference position, the sequence of compensation error is determined, the function compensation coefficients are obtained through fitting, and the function compensation coefficients are sent to the encoder for calibration.

Benefits of technology

It improves the positional accuracy of the encoder, reduces calibration time, lowers maintenance costs, and increases work efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117589221B_ABST
    Figure CN117589221B_ABST
Patent Text Reader

Abstract

This application relates to an encoder calibration method, apparatus, host computer, and storage medium. The method includes: acquiring a sequence of positions to be processed output by the encoder to be calibrated, and a reference sequence of positions corresponding to the sequence of positions to be processed; determining a compensation error sequence corresponding to the sequence of positions to be processed based on the sequence of positions to be processed and the reference sequence of positions; performing fitting processing on the sequence of positions to be processed and the corresponding compensation error sequence to obtain function compensation coefficients; sending the function compensation coefficients to the encoder to be calibrated; the function compensation coefficients are used to calibrate the encoder to be calibrated. This method can improve position accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to an encoder calibration method, apparatus, host computer, and storage medium. Background Technology

[0002] In today's industrialized and continuously developing world, engineers have an ever-increasing demand for high-precision and high-reliability measuring devices. Angular position and angular velocity measuring devices are one type of such in-demand device. These devices are widely used in industry, especially in the field of motor control. High-performance servo motor control requires measuring devices to provide high-precision and high-reliability position and angular velocity measurements. Common position sensors used in motor control include: photoelectric encoders, magnetic encoders, inductive encoders, capacitive encoders, and rotary transformers.

[0003] As technology advances, the requirements for diagonal position measurement in industrial production are becoming increasingly stringent. The stringent requirements for high precision, fast response, and strong anti-interference capabilities in diagonal position measurement mean that some traditional diagonal position sensors are no longer adequate for today's product needs. Traditional encoders, for example, produce large position errors. Summary of the Invention

[0004] Therefore, it is necessary to provide an encoder calibration method, device, host computer, and storage medium that can improve position accuracy in response to the above-mentioned technical problems.

[0005] An encoder calibration method, the method comprising:

[0006] Obtain the sequence of positions to be processed output by the encoder to be calibrated, and the sequence of reference positions corresponding to the sequence of positions to be processed;

[0007] Based on the sequence of positions to be processed and the sequence of reference positions, determine the compensation error sequence corresponding to the sequence of positions to be processed;

[0008] The sequence of positions to be processed and the corresponding sequence of compensation errors are fitted together to obtain the function compensation coefficients;

[0009] The function compensation coefficient is sent to the encoder to be calibrated; the function compensation coefficient is used to calibrate the encoder to be calibrated.

[0010] An encoder calibration method, applied to an encoder, the method comprising:

[0011] A compensation function is obtained, wherein the function compensation coefficients in the compensation function are obtained by fitting the sequence of positions to be processed and the corresponding compensation error sequence; the compensation error sequence is determined based on the sequence of positions to be processed and the reference position sequence; the sequence of positions to be processed is output by the encoder; the reference position sequence corresponds to the sequence of positions to be processed.

[0012] Obtain the current position of the encoder, input the current position into the compensation function, and obtain the position compensation value;

[0013] The current position is calibrated based on the position compensation value to obtain the target position.

[0014] A host computer includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of various encoder calibration method embodiments.

[0015] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of various encoder calibration method embodiments.

[0016] The aforementioned encoder calibration method, device, host computer, and storage medium acquire a reference position sequence, determine a compensation error sequence based on the position sequence to be processed and the reference position sequence, fit the reference position sequence and the compensation error sequence to obtain function compensation coefficients, and send the function compensation coefficients to the encoder to be calibrated. This calibrates the errors introduced by the encoder, improving position accuracy. Furthermore, only one calibration is required after the encoder is installed, significantly reducing calibration time, improving work efficiency, and lowering maintenance costs. Attached Figure Description

[0017] Figure 1 This is a diagram illustrating the application environment of an encoder calibration method in one embodiment;

[0018] Figure 2 This is a diagram illustrating the application environment of the encoder calibration method in another embodiment;

[0019] Figure 3 This is a flowchart illustrating an encoder calibration method in one embodiment;

[0020] Figure 4 This is a schematic diagram of the curve of the fitting function in one embodiment;

[0021] Figure 5 This is a flowchart illustrating the encoder calibration method in another embodiment;

[0022] Figure 6 This is a diagram of the internal structure of the host computer in one embodiment. Detailed Implementation

[0023] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.

[0024] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0025] It should be noted that all directional indicators (such as up, down, left, right, front, back, etc.) in the embodiments of this application are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indicator will also change accordingly. The connection can be a direct connection or an indirect connection.

[0026] Furthermore, the use of terms such as "first" and "second" in this application is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of the various embodiments can be combined with each other, but only on the basis of being achievable by those skilled in the art. If the combination of technical solutions is contradictory or impossible to implement, such a combination of technical solutions should be considered non-existent and not within the scope of protection claimed in this application.

[0027] The terms "first," "second," etc., used in this application may be used herein to describe various data, but such data are not limited by these terms. These terms are only used to distinguish one set of data from another. For example, without departing from the scope of this application, a first set of coefficients may be referred to as a second set of coefficients, and similarly, a second set of coefficients may be referred to as a first set of coefficients. Both the first set of coefficients and the second set of coefficients are sets of coefficients, but they are not the same set of coefficients.

[0028] It is understood that the term "connection" in the following embodiments should be understood as "electrical connection," "communication connection," etc., if the connected circuits, modules, units, etc., have electrical signal or data transmission with each other.

[0029] The encoder calibration method provided in this application can be applied to, for example... Figure 1 In the application environment. Figure 1This diagram illustrates the application environment of an encoder calibration method in one embodiment. It includes a host computer 110 and an encoder 120 to be calibrated. The host computer 110 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The type of encoder 120 to be calibrated is not limited. The encoder calibration methods in various embodiments of this application can be applied to the calibration of various photoelectric encoders, magnetic encoders, inductive encoders, capacitive encoders, and rotary transformers. The position can be displacement, angular position, etc., and is not limited thereto.

[0030] In one embodiment, an encoder is an important device used to record the rotation angle and speed of the motor bearings. The rotation of the motor typically requires the use of an encoder for control and feedback. For example... Figure 2 The diagram shown illustrates the application environment of the encoder calibration method in another embodiment. Figure 2 The system includes a controller for servo motor 1, servo motor 1, a coupling, servo motor 2, and a host computer. The main drive system comprises the controller for servo motor 1, servo motor 1, the coupling, and servo motor 2. The controller for servo motor 1 controls the uniform rotation of servo motor 1. Servo motor 1 is equipped with a high-precision photoelectric encoder. Servo motor 1 is connected to servo motor 2 via the coupling. Servo motor 2 is equipped with an encoder to be calibrated. The uniform rotation of the main drive system with the high-precision photoelectric encoder drives the rotation of servo motor 2, meaning the high-precision photoelectric encoder provides relatively accurate rotational feedback for servo motor 2, ensuring accurate rotation. With servo motor 2 rotating accurately, the encoder to be calibrated is tested, and the output sequence of positions to be processed is obtained. The reference position sequence can be considered as accurate values, corresponding one-to-one with the positions to be processed.

[0031] In one embodiment, such as Figure 3 The diagram shown is a flowchart of an encoder calibration method in one embodiment, including:

[0032] Step 302: Obtain the sequence of positions to be processed output by the encoder to be calibrated, and the sequence of reference positions corresponding to the sequence of positions to be processed.

[0033] The reference position sequence can be considered as a set of correct positions. The reference position sequence includes multiple reference positions. These reference positions can be preset in the host computer.

[0034] The sequence of positions to be processed contains multiple positions to be processed. One reference position corresponds to one position to be processed. Generally, there is a certain error between the position to be processed and the reference position.

[0035] The location to be processed can be the location obtained by normalizing the signal output by the programmer to be calibrated.

[0036] Specifically, taking position as an angle as an example, the main drive system drives the encoder to be calibrated to rotate one revolution, calculates the angle position at regular intervals, outputs r angles, and obtains the sequence of positions to be processed.

[0037] Optionally, the main drive system equipped with a high-precision photoelectric encoder rotates according to the reference position sequence and drives the encoder to be calibrated to rotate. After the encoder to be calibrated rotates, the host computer obtains the position sequence to be processed.

[0038] Step 304: Based on the sequence of positions to be processed and the sequence of reference positions, determine the compensation error sequence corresponding to the sequence of positions to be processed.

[0039] The compensation error sequence contains multiple compensation error values. The compensation error sequence corresponding to the position to be processed means that a current position has a corresponding compensation error value.

[0040] Specifically, the host computer can subtract the corresponding elements in the sequence of positions to be processed and the sequence of reference positions to obtain the compensation error sequence corresponding to the sequence of positions to be processed.

[0041] Step 306: Fit the sequence of positions to be processed and the corresponding compensation error sequence to obtain the function compensation coefficients.

[0042] The fitting process can be either direct fitting or fitting a pre-defined function. The function compensation coefficients can be obtained through only one calibration process.

[0043] Specifically, the host computer fits the sequence of positions to be processed and the corresponding sequence of compensation errors to obtain the compensation function and the corresponding function compensation coefficients.

[0044] Step 308: Send function compensation coefficients to the encoder to be calibrated; the function compensation coefficients are used to calibrate the encoder to be calibrated.

[0045] Specifically, the host computer sends the function compensation coefficient to the encoder to be calibrated. The encoder to be calibrated obtains its current position, inputs the current position into a compensation function containing the function compensation coefficient, and obtains a position compensation value. The encoder to be calibrated then compensates for the current position based on the position compensation value to obtain the target position.

[0046] In this embodiment, a reference position sequence is obtained, and a compensation error sequence is determined based on the position sequence to be processed and the reference position sequence. The position sequence to be processed and the compensation error sequence are then fitted to obtain function compensation coefficients. These function compensation coefficients are sent to the encoder to be calibrated, thereby calibrating the errors introduced by the encoder and improving position accuracy. Furthermore, only one calibration is required after the encoder is installed, greatly reducing calibration time, improving work efficiency, and lowering maintenance costs.

[0047] In one embodiment, fitting the sequence of positions to be processed and the corresponding compensation error sequence to obtain function compensation coefficients includes: fitting the sequence of positions to be processed and the corresponding compensation error sequence with a sine function to obtain function compensation coefficients.

[0048] The encoder to be calibrated can be a position sine function fitted by the general expression f(x) = a*sin(b*x + c), where * represents multiplication. a, b, and c are the function compensation coefficients.

[0049] Specifically, the host computer obtains the sine compensation function and its corresponding compensation coefficients by fitting a sine function to the sequence of positions to be processed and the corresponding compensation error sequence. Specifically, the sum of sines can be used for function fitting.

[0050] In this embodiment, after repeated testing, it was found that the fitting effect was better when using a sine function. Therefore, by fitting the position sequence to be processed and the corresponding compensation error sequence with a sine function, the compensation function obtained is accurate, thereby making the position value obtained by the encoder to be calibrated more accurate.

[0051] In one embodiment, fitting the sequence of positions to be processed and the corresponding compensation error sequence with a sine function to obtain the function compensation coefficients includes: fitting the sequence of positions to be processed and the corresponding compensation error sequence with an eighth-order sine function to obtain the function compensation coefficients.

[0052] Specifically, the general expression for fitting an eighth-order function is:

[0053] f(x)=a1*sin(b1*x+c1)+a2*sin(b2*x+c2)+a3*sin(b3*x+c3)+a4*sin(b4*x+c 4)+a5*sin(b5*x+c5)+a6*sin(b6*x+c6)+a7*sin(b7*x+c7)+a8*sin(b8*x+c8)

[0054] The function compensation coefficients are then a1, b1, c1, a2, b2, c2...a8, b8, and c8. Based on this, the first set of coefficients includes b1, b2...b8, the second set of coefficients includes a1, a2...a8, and the third set of coefficients includes c1, c2...c8.

[0055] In this embodiment, after analysis, it is found that the higher the order of the function fitting, the more frequency points can be suppressed. Therefore, an eighth-order sine function fitting is selected. The position sequence to be processed and the corresponding compensation error sequence are fitted with an eighth-order sine function. The compensation function fitting effect is good, so that the position value obtained by the encoder to be calibrated is more accurate.

[0056] In one embodiment, the sequence of positions to be processed is the output of the encoder to be calibrated, which is sampled at regular intervals during rotation;

[0057] The sequence of positions to be processed and the corresponding compensation error sequence are fitted with a sine function to obtain the function compensation coefficients, including:

[0058] Obtain the first coefficient set; the first coefficient set is determined based on a preset number of frequencies with the highest percentage; the preset number of frequencies with the highest percentage are determined based on a spectrum function; the spectrum function is obtained by performing a fast Fourier transform on the sequence of positions to be processed and the time corresponding to each position to be processed;

[0059] The sequence of positions to be processed, the time corresponding to each position, and the first set of coefficients are fitted with a sine function to obtain the function compensation coefficients.

[0060] The frequency with the highest percentage is the frequency corresponding to the maximum amplitude represented by the spectral function. The frequency with the highest percentage is the dominant frequency. The first set of coefficients is predetermined. The first set of coefficients contains one or more first coefficients. The first coefficient refers to the angular frequency ω of the sine function. The preset number corresponds to the order of the sine function fitting. For example, if the sine function fitting is fourth order, then the preset number is 4; if the sine function fitting is eighth order, then the preset number is 8.

[0061] Specifically, the sequence of positions to be processed is the timed sampling output of the encoder to be calibrated during rotation; that is, each position has a corresponding time, and these times are different. Using the positions and their corresponding times as discrete points, a Fast Fourier Transform is performed to obtain the spectral function. The spectral function reveals the relationship between amplitude and frequency. The larger the amplitude, the greater the proportion of that frequency. Based on the spectral function, a preset number of frequencies with the highest proportion can be determined. The first coefficient b is actually ω, which is related to the frequency f, ω = 2πf; therefore, by obtaining f and calculating ω = 2πf, the value of b can be determined.

[0062] Therefore, given the first set of coefficients, only the second and third sets of coefficients remain unsolved in the sine function expression. The sequence of positions to be processed and the corresponding compensation error sequence are then fitted with a sine function to obtain the function compensation coefficients.

[0063] Optionally, the preset number can be 8. The sequence of positions to be processed, the corresponding compensation error sequence, and the first coefficient set are fitted with an eighth-order sine function to obtain the function compensation coefficients. For example... Figure 4 The figure shown is a schematic diagram of the curve of the fitting function in one embodiment. Figure 4The x-axis represents position, and the y-axis represents error compensation value. Black dots represent the position to be processed and its corresponding error compensation value. The curve represents the compensation function corresponding to the coefficients of that compensation function. Figure 4 It can be seen that the compensation function obtained by fitting is basically consistent with the error compensation value, indicating that calibration based on the compensation coefficient of this function can effectively reduce the error.

[0064] In this embodiment, by pre-determining the first coefficient set and then performing sine function fitting, the accuracy of the obtained function compensation coefficients can be quickly fitted and improved. In addition, the high accuracy of the first coefficient set obtained through spectrum analysis can also improve the accuracy of the fitted function.

[0065] In one embodiment, determining the compensation error sequence corresponding to the position sequence to be processed based on the position sequence to be processed and the reference position sequence includes:

[0066] The error sequence is obtained by subtracting the sequence of positions to be processed and the sequence of reference positions.

[0067] The average error is obtained by averaging the error series.

[0068] Subtract the average error from each element in the error sequence to obtain the compensation error sequence.

[0069] Specifically, assuming the encoder rotates one revolution, calculates the position at regular intervals, and outputs a sequence of positions Xn to be processed, with a total of r positions:

[0070] Xn = {X0, X1, X2, ..., Xr-1}

[0071] First, using the first position value as the starting value, and with a common difference of 2π / r, we obtain the reference position sequence Gn:

[0072] Gn = {G0, G1, G2, ..., Gr-1}

[0073] ={X0,X0+2π / r,X0+4π / r,…,X0+(r-1)*2π / r}

[0074] Error sequence:

[0075] Hn=Xn-Gn={H0, H1, H2,…,Hr-1}={X0-G0,X1-G1,X2-G2,…,Xr-1–Gr-1}

[0076] Calculate the average of the error series:

[0077] H_average=(H0+H1+H2+…+Hr-1) / r

[0078] Subtracting the average value from each element of the error sequence Hn yields the compensated error sequence:

[0079] Kn = {K0, K1, K2, ..., Kr-1}

[0080] ={H0-H_average,H1-H_average,H2-H_average,…,Hr-1-H_average}

[0081] In this embodiment, the difference between the sequence of positions to be processed and the sequence of reference positions is calculated, and the average error is obtained by averaging the resulting error sequence. Then, the average error is subtracted from each element in the error sequence to obtain the compensation error sequence, which can reduce sampling bias and improve accuracy.

[0082] In one embodiment, the sequence of positions to be processed is obtained by the main drive system configured with a photoelectric encoder driving the encoder to be calibrated to rotate at a constant speed.

[0083] In this embodiment, the photoelectric encoder has high precision, which can ensure that the main drive system drives the encoder to be calibrated to rotate at a constant speed. Therefore, the determined sequence of positions to be processed and the sequence of reference positions are both accurate, improving the accuracy of the data for fitting.

[0084] In one embodiment, the signal output by the encoder to be calibrated is normalized to obtain the normalized signal and the normalized parameter value; after solving the normalized data, the sequence of positions to be processed is obtained.

[0085] Let's take an inductive encoder as an example. First, let's introduce the basic principle of an inductive encoder: it uses the physical principle of eddy currents to detect the position of a metal target moving above the coil.

[0086] First, the position sensor chip inputs alternating current into the transmitter coil, generating an alternating magnetic field. This magnetic field induces a voltage in the receiver coil. In the absence of a metal target, due to anti-serialization and balancing between the line segments, zero output is achieved on each pair of ports after compensation for the induced voltage.

[0087] If the metal target is placed above the coil:

[0088] a. The magnetic field induces eddy currents on the surface of the metal target.

[0089] b. Eddy currents generate a counter-magnetic field, which reduces the total magnetic flux density below.

[0090] c. Reduce the voltage induced in the receiver coil region below the target, thereby creating a voltage imbalance in the anti-serial coil.

[0091] d. Output voltage signal, the amplitude and polarity of which change with the target position.

[0092] The following explanation uses an encoder with inner and outer coils as an example. The inner coil refers to the group of coils near the center of the encoder. It includes one transmitting coil and at least two receiving coils. The outer coil refers to the group of coils away from the center of the encoder. It also includes one transmitting coil and at least two receiving coils. Taking two receiving coils as an example, one receiving coil generates a sine wave signal, and the other generates a cosine wave signal. The signal generated by the inner coil receiving coil is called the inner coil signal, which includes the inner coil sine wave signal and the inner coil cosine wave signal. The signal generated by the outer coil receiving coil is called the outer coil signal, which includes the outer coil sine wave signal and the outer coil cosine wave signal. That is, both the inner and outer coil signals are signals generated by the receiving coils. All of the above signals are voltage signals. This embodiment uses angle as an example for explanation.

[0093] The encoder system rotates at a constant speed of F Hz. Therefore, the frequency of the inner ring's sine and cosine waves is F Hz, and the total frequency of the inner ring's sine and cosine waves is N*F Hz. To capture the actual amplitudes of Vsin and Vcos, a sufficient number of sampling points should be collected for each sine and cosine wave. Here, we assume that we want to collect M points for each sine and cosine wave of the outer ring, collecting P sine and cosine waves with the same sampling interval. The sampling frequency is then N*F*MHz. After collecting M points, we compare the maximum and minimum values ​​of Vsin and Vcos at these M points. We then average the maximum and minimum values ​​of the P Vsin and Vcos, assuming they are Vsina, Vsinb, Vcosa, and Vcosb.

[0094] The bias voltages Vsin and Vcos can be obtained:

[0095] Vsin_offset=(Vsina+Vsinb) / 2

[0096] Vcos_offset=(Vcosa+Vcosb) / 2

[0097] The amplitudes of Vsin and Vcos:

[0098] Vsin_pp=Vsina–Vsinb

[0099] Vcos_pp = Vcosa – Vcosb

[0100] Normalization factors for Vsin and Vcos:

[0101] Q = Vsin_pp / Vcos_pp

[0102] Before each calculation of the position, let

[0103] V_sin=V_sin-Vsin_offset

[0104] V_cos = Q*(V_cos - Vcos_offset)

[0105] (Where V_sin and V_cos are the actual sampled sine and cosine voltage values ​​at the current position)

[0106] The normalization process for the inner ring is the same as above. The resulting normalized parameter values ​​are the bias voltage and the normalization factor.

[0107] 2. The host computer obtains the function compensation coefficients:

[0108] Assuming the encoder rotates one revolution, calculates the position periodically, and outputs r position values, respectively...

[0109] Xn = {X0, X1, X2, ..., Xr-1}

[0110] The sequence Xn is passed to the host computer, and the host computer will then handle the rest.

[0111] First, using the first position value as the starting value, a sequence of numbers is obtained with a common difference of 2π / r.

[0112] Gn = {G0, G1, G2, ..., Gr-1}

[0113] ={X0,X0+2π / r,X0+4π / r,…,X0+(r-1)*2π / r}.

[0114] Error sequence

[0115] Hn=Xn-Gn={H0, H1, H2,…, Hr-1}

[0116] ={X0-G0,X1-G1,X2-G2,…,Xr-1–Gr-1}

[0117] Calculate the average of the error series

[0118] H_average=(H0+H1+H2+…+Hr-1) / r

[0119] Subtracting the average value from each element of the error sequence Hn yields the compensation error sequence Kn = {K0, K1, K2, ..., Kr-1}.

[0120] ={H0-H_average,H1-H_average,H2-H_average,…,Hr-1-H_average}

[0121] To better demonstrate the effect, MATLAB is used for function compensation curve fitting, with the x-axis representing the sequence Xn and the y-axis representing the sequence Kn.

[0122] Testing showed that sumofsin provides good fitting results for functions, and higher-order functions suppress more frequency points. Therefore, an 8th-order function was chosen for fitting.

[0123] The fitting formula is:

[0124] f(x)=a1*sin(b1*x+c1)+a2*sin(b2*x+c2)+a3*sin(b3*x+c3)+a4*sin(b4*x+c 4)+a5*sin(b5*x+c5)+a6*sin(b6*x+c6)+a7*sin(b7*x+c7)+a8*sin(b8*x+c8)

[0125] Before fitting, a spectrum analysis was first performed using FFT (Fast Fourier transform) to obtain the 8 points with the highest spectral amplitude (8 points were chosen because the function compensation uses the 8th order). After actual spectrum analysis, the points with relatively high frequencies were found to be 1, 9, 10, 11, 20, 30, 40, and 80. These 8 points were used as the initial frequencies for curve fitting.

[0126] Next, the host computer transmits the function fitting coefficients to the encoder, which then writes the normalized parameters and function fitting coefficients into its internal flash memory, completing the calibration process.

[0127] In this embodiment, due to various factors such as production errors and environmental influences, the input signal is not perfectly ideal, and the calculated angle will contain errors. Therefore, the above method can significantly improve the accuracy and precision of angle detection. Furthermore, the encoder only needs to be calibrated once after installation, greatly reducing the calibration time required before each use of many measuring devices, improving work efficiency, and lowering maintenance costs. An experimental environment was set up for actual comparative testing, such as... Figure 4 This demonstrates that the present embodiment can achieve error analysis and calibration of inductive angular position sensors.

[0128] In one embodiment, the encoder includes an inner ring and an outer ring, each including a transmitting coil and at least two receiving coils; obtaining the current position of the encoder includes: obtaining an inner ring signal, the inner ring signal including an inner ring sine signal and an inner ring cosine signal; determining the inner ring position based on the inner ring sine signal and the inner ring cosine signal; determining the current sector corresponding to the inner ring position based on the inner ring position and the corresponding sector position; and determining the current position of the encoder based on the current sector and the outer ring position.

[0129] The inner circle position refers to the position of the object indicated by the inner circle. Position can be understood as an angle, or linear displacement, etc. The inner circle position can be an inner circle mechanical angle, used to represent an absolute angle. The value range of the inner circle position is 0 to 2π. The outer circle position can be a relative angle of the outer circle, not representing a mechanical angle. The value range of the outer circle position is 0 to 2π.

[0130] Specifically, when an object is within the encoder's detection range, the encoder's receiving coil generates inner and outer loop signals, and the amplitude of the signals generated by the coil varies depending on the object's position.

[0131] Both the inner circle sine and cosine signals can be normalized signals. Normalization involves removing the bias of the inner circle signal and adjusting the amplitudes of the inner circle sine and cosine signals to match.

[0132] The inner circle's sine and cosine signals are input into the position calculation rules to obtain the inner circle's position. The position calculation rules are as follows:

[0133] Position 内 =arctan(Vsin 内 / Vcos 内 )

[0134] Vsin 内 Vcos represents the voltage value of the inner ring sinusoidal signal. 内 This represents the voltage value of the inner cosine signal. Generally, the value for the inner position is in the range of 0 to 2π.

[0135] The position corresponding to a sector refers to the position represented by one sector, or one outer ring signal cycle. Taking a sector position of π / 2 as an example, the current sector indicates which sector the user is currently in. The current sector is an integer, ranging from 0 to N-1 (the total number of sectors N), such as 0 to 3. That is, the current sector can be sector 0, sector 1, sector 2, or sector 3.

[0136] The ratio of the inner circle position to the corresponding sector position, after rounding, gives the current sector corresponding to the inner circle position. For example, if the inner circle position is 2π / 3 and the corresponding sector position is π / 2, then the current sector = [2π / 3 / (π / 2)] = 1. ([x] is the integer part).

[0137] Both the outer ring sine and cosine signals can be normalized signals. Normalization involves removing the bias of the outer ring signal and adjusting the amplitudes of the outer ring sine and cosine signals to match.

[0138] The outer ring sine and cosine signals are input into the position calculation rules to obtain the outer ring position. The position calculation rules are as follows:

[0139] Position 外 =arctan(Vsin 外 / Vcos 外 )

[0140] Vsin 外 Vcos represents the voltage value of the outer ring sinusoidal signal. 外 This represents the voltage value of the outer ring cosine signal. Generally, within each outer ring signal cycle, the outer ring position ranges from 0 to 2π. One inner ring signal cycle corresponds to N outer ring signal cycles; therefore, within one inner ring signal cycle, there are N outer ring signal cycles ranging from 0 to 2π.

[0141] The inner ring position calculates a coarse position, while the outer ring position further refines this coarse position. Based on the current sector and its corresponding position, a coarse positioning position is obtained. The ratio of the outer ring position to the total number of sectors N yields the fine positioning position. The sum of the coarse and fine positioning positions represents the encoder's current position.

[0142] In this embodiment, position processing is performed based on an encoder containing inner and outer coils. The inner coil position is determined by the inner coil sine and cosine signals, and the outer coil position is determined by the outer coil sine and cosine signals. The current sector corresponding to the inner coil position is calculated, and the current position of the encoder is determined based on the current sector and the outer coil position. Coarse and fine positioning are performed respectively to improve the accuracy of the encoder output position.

[0143] In one embodiment, determining the inner circle position based on the inner circle sine signal and the inner circle cosine signal includes: determining the current inner circle partition corresponding to the inner circle signal; obtaining the position calculation rule corresponding to the current inner circle partition; and calculating the inner circle sine signal and the inner circle cosine signal based on the current inner circle partition and the corresponding position calculation rule to obtain the inner circle position.

[0144] The inner circle can be divided according to requirements. Specifically, there can be 8 inner circle partitions. For example, there are 8 inner circle partitions: [0, π / 4), [π / 4, π / 2), [π / 2, 3π / 4), [3π / 4, π), [π, 5π / 4), [5π / 4, 3π / 2), [3π / 2, 7π / 4), [7π / 4, 2π). Each π / 4 represents one interval.

[0145] The encoder can combine the inner ring sine signal and the inner ring cosine signal to determine the current inner ring partition corresponding to the inner ring signal.

[0146] Each inner circle partition corresponds to a position calculation rule. The position calculation rules for different inner circle partitions can be the same or different. The position calculation rule for the inner circle partition is used to avoid infinity results at positions that are multiples of π / 2. That is, within the range of multiples of π / 2, the algorithm modifies tan to cot or -cot. For example, near the positions of π / 2 and 3π / 2, a position calculation rule including the cotangent relation is used. The final obtained inner circle position is within the position range corresponding to the inner circle partition.

[0147] Table 1

[0148] Partition Number partition Location calculation rules 0 [0,π / 4] Position = arctan(Vsin / Vcos) 1 (π / 4,π / 2] Position = arccot(Vcos / Vsin) 2 (π / 2,3π / 4] Position = arccot(-Vcos / Vsin) 3 (3π / 4,π] Position = arctan(-Vsin / Vcos) 4 (π,5π / 4] Position = arctan(Vsin / Vcos) 5 (5π / 4,3π / 2] Position = arccot(Vcos / Vsin) 6 (3π / 2,7π / 4] Position = arccot(-Vcos / Vsin) 7 (7π / 4,2π) Position = arctan(-Vsin / Vcos)

[0149] Based on the position calculation rules corresponding to the current inner circle partition, the inner circle sine and cosine signals are calculated to determine their positions within the current inner circle partition, thus obtaining the inner circle position. For example, if the current inner circle partition is 1, which is in the range [π / 4, π / 2), the inner circle position can be obtained based on the inner circle position calculation rule Position = arccot(Vcos / Vsin). Since the current inner circle partition is 1, the calculation range is [π / 4, π / 2), and the calculated inner circle position is located within the interval [π / 4, π / 2).

[0150] It is understandable that the partitions and corresponding position calculation rules in Table 1 can be applied to both inner-ring signals and outer-ring signals. For example, determining the outer-ring position based on the outer-ring sine and cosine signals includes: determining the current outer-ring partition corresponding to the outer-ring signal; obtaining the position calculation rules corresponding to the current outer-ring partition; and calculating the outer-ring sine and cosine signals based on the current outer-ring partition and the corresponding position calculation rules to obtain the outer-ring position.

[0151] In this embodiment, the position error calculated using the traditional method is relatively large in some partitions. By determining the current inner circle partition corresponding to the inner circle signal, the position calculation rule corresponding to the current inner circle partition is obtained. Based on the position calculation rule corresponding to the current inner circle partition, the inner circle sine signal and inner circle cosine signal are calculated to obtain the inner circle position, which can reduce the error and improve the accuracy of the position.

[0152] In one embodiment, determining the current inner zone corresponding to the inner zone signal includes:

[0153] Determine the partitioning conditions that the voltage values ​​of the inner ring signals must satisfy, and use the inner ring partitions that satisfy the partitioning conditions as the current inner ring partitions.

[0154] The partitions can be set according to requirements. For example, intervals can be divided into π / 4 intervals. Table 2 shows a schematic diagram of the partitioning conditions and the current inner circle partitions. The partitioning conditions that the voltage values ​​satisfy refer to the partitioning conditions that are satisfied by both the voltage values ​​of the sine and cosine signals. For example, when the voltage value range of the inner circle sine signal is [0, √2 / 2) and the voltage value range of the inner circle cosine signal is [√2 / 2, 1), it is located in the interval [0, π / 4), i.e., partition 0.

[0155] Table 2

[0156]

[0157] It is understood that the partitioning conditions in this embodiment can also be applied to the outer ring. Partitioning based on the outer ring sine and cosine signals to obtain the current outer ring partition includes: determining the partitioning conditions satisfied by the voltage values ​​of the outer ring signals, and using the outer ring partition corresponding to the satisfied partitioning conditions as the current outer ring partition.

[0158] In this embodiment, the partitioning conditions satisfied by the voltage value of the inner ring signal are determined, and the inner ring partition corresponding to the satisfied partitioning conditions is taken as the current inner ring partition. Different position calculation rules can be selected according to different partitions, thereby improving the accuracy of the encoder output position.

[0159] In one embodiment, the partitioning conditions include the magnitude relationship between the voltage value of the inner circle sine signal and 0, the magnitude relationship between the voltage value of the inner circle cosine signal and 0, and the magnitude relationship between the absolute values ​​of the voltage values ​​of the inner circle sine signal and the absolute values ​​of the voltage values ​​of the inner circle cosine signal.

[0160] Specifically, Table 3 is obtained by taking the example that the voltage value of the inner ring sine signal is greater than 0 and marked as 1, the voltage value of the inner ring cosine signal is greater than 0 and marked as 1, and the absolute value of the voltage value of the inner ring sine signal is greater than the absolute value of the voltage value of the inner ring sine signal.

[0161] Table 3

[0162]

[0163]

[0164] Table 3 uses Vsin > 0, Vcos > 0, and |Vsin| > |Vcos| as conditions. It is understandable that Vsin > 0, Vcos > 0, and |Vsin| < |Vcos| can also be used as conditions. Vsin < 0, Vcos < 0, and |Vsin| > |Vcos| can also be used as conditions.

[0165] In Table 3, 110 represents the value 6, 111 represents the number 7, and so on. This shows that each condition has a unique value, corresponding to a unique interval. Therefore, the conditions for partitioning can be: the voltage value of the inner circle sine wave signal being greater than or less than 0; the voltage value of the inner circle cosine wave signal being greater than or less than 0; and the absolute value of the voltage value of the inner circle sine wave signal being greater than or less than the absolute value of the voltage value of the inner circle cosine wave signal.

[0166] It is understood that the partitioning conditions in this embodiment can also be applied to the outer ring. The partitioning conditions include the magnitude relationship between the voltage values ​​of the outer ring sine signals and 0, the magnitude relationship between the voltage values ​​of the outer ring cosine signals and 0, and the magnitude relationship between the absolute values ​​of the voltage values ​​of the outer ring sine signals and the absolute values ​​of the voltage values ​​of the outer ring cosine signals. In this embodiment, partitioning according to the three preset conditions results in unique inner ring partitions that effectively represent the characteristics of each signal. This allows for different calculations to be performed on signals in different partitions, improving the accuracy of the obtained positions.

[0167] In one embodiment, the position calculation rules for different inner circle partitions are all represented by the tangent correlation function; and the inner circle partitions corresponding to π / 2 and 3π / 2 are both represented by the tangent correlation function containing the cotangent relation.

[0168] Specifically, since calculating the cot and arccot ​​functions in the hardware is time-consuming, the position calculation rules related to the cot function are all represented by the tangent correlation function. Corresponding to Figure 3 The position calculation rules are shown in Table 4. To avoid infinity at positions of π / 2 and 3π / 2, a specific operation is to set some expressions in the position calculation rules to Vcos / Vsin.

[0169] Table 4

[0170] Partition Number partition Location calculation rules 0 [0,π / 4) Position = arctan(Vsin / Vcos) 1 [π / 4,π / 2) Position=π / 2-arctan(Vcos / Vsin) 2 [π / 2,3π / 4) Position=π / 2+arctan(-Vcos / Vsin) 3 [3π / 4,π) Position=π-arctan(-Vsin / Vcos) 4 [π,5π / 4) Position=π+arctan(Vsin / Vcos) 5 [5π / 4,3π / 2) Position=3π / 2-arctan(Vcos / Vsin) 6 [3π / 2,7π / 4) Position=3π / 2+arctan(-Vcos / Vsin) 7 [7π / 4,2π) Position=2π-arctan(-Vsin / Vcos)

[0171] It is understandable that the above partitions can be changed as long as they avoid the cases where infinity occurs at the positions of π / 2 and 3π / 2. For example, partition number 0 can be changed to [0, π / 3), partition number 1 corresponds to [π / 3, π), etc.

[0172] It is understood that this embodiment is also applicable to the outer ring partitions. The position calculation rules for different outer ring partitions are all represented by the tangent correlation function; and the inner ring partitions corresponding to π / 2 and 3π / 2 are all represented by the tangent correlation function containing the cotangent relation.

[0173] In this embodiment, the position errors obtained after solving the inner circle partitions corresponding to π / 2 and 3π / 2 using the traditional method are relatively large. Therefore, a function containing the cotangent relation is used for calculation, namely Vcos / Vsin, to avoid infinity in these two places. Since hardware calculation of the arccot ​​function is time-consuming, the position calculation rules for different inner circle partitions are all represented by the tangent correlation function. Furthermore, the inner circle partitions corresponding to π / 2 and 3π / 2 are represented by the tangent correlation function containing the cotangent relation, which can improve the accuracy of the encoder position and improve the position calculation efficiency.

[0174] In one embodiment, determining the current sector corresponding to the inner circle position based on the inner circle position and the corresponding sector position includes:

[0175] Based on the position of the inner circle and the corresponding position of the sector, determine the reference sector corresponding to the position of the inner circle;

[0176] When the inner ring position is not within the sector connection range of the outer ring signal, the reference sector is rounded to obtain the current sector.

[0177] The current sector indicates which sector the user is currently in. The reference sector can be either a decimal or an integer.

[0178] The sector connection range is used to represent the area near the junction between two sectors of the encoder. For example, the range where the first outer ring signal cycle connects with the second outer ring signal cycle is the sector connection range, and the range where the second outer ring signal cycle connects with the third outer ring signal cycle is also the sector connection range. The sector connection range is represented numerically as k*2π / N±S (k=0,1,2,…,N-1,and k is an integer), where k is an integer and refers to the k-th cycle, and S is the judgment threshold.

[0179] When the position of the inner circle is outside the range of the outer circle signal period (k*2π / N±S), i.e., outside the sector connection range, the reference sector is rounded down to obtain the current sector. For example, if the inner circle position is 3π / 4 and the corresponding sector position is π / 2, with π / 2 as the separator and S as π / 9, the inner circle position is within the ranges of [7π / 18, 11π / 18], [8π / 9, 10π / 9], [25π / 18, 29π / 18], [17π / 9, 2π], and [0, π / 9], which is within the sector connection range. The reference sector is then 1.5, and since 3π / 4 is outside the sector connection range, 1.5 is rounded down to obtain the current sector as 1.

[0180] Understandably, determining whether the inner ring position is within the sector connection range of the outer ring signal can also be based on a reference sector. Taking S = π / 9 as an example, consider whether the decimal part of the reference sector is within the range of [0, 0.22] or [0.78, 1). If not, then the inner ring position is not within the sector connection range of the outer ring signal. Here, 0.22 = (11π / 18) / π / 2 (outer ring signal period) - 1, and 0.78 = (7π / 18) / π / 2.

[0181] In this embodiment, when the inner ring position is not within the sector connection range, it indicates that the inner ring position and the outer ring position are matched and the position is accurate. Therefore, the reference sector can be rounded to obtain the current sector.

[0182] In one embodiment, determining the current sector corresponding to the inner circle position based on the inner circle position and the corresponding sector position further includes:

[0183] When the inner ring position is within the sector connection range of the outer ring signal, the sector connection range where the outer ring position is located is determined; the sector connection range includes the start position range and the end position range;

[0184] When both the inner and outer ring positions are within the starting position range or both are within the ending position range, the reference sector is rounded to obtain the current sector.

[0185] When the inner and outer ring positions are not within the same position range, the sector is adjusted based on the reference sector to obtain the current sector.

[0186] The encoder presets the start and end position ranges of the outer ring signal. The start and end position ranges are determined by whether the signal is at the beginning or end of the cycle. For example, [k*2π / N, k*2π / N+S] is the start position range, and [k*2π / NS, k*2π / N] is the end position range. Similarly, [k*2π, k*2π+A] is the start position range, and [k*2π-A, k*2π] is the end position range. Although the values ​​are different, they represent the same range.

[0187] For example, the inner circle is located within the sector connection range of [7π / 18, 11π / 18], where [7π / 18, π / 2) is the end position range and [π / 2, 11π / 18] is the start position range.

[0188] Specifically, when the inner ring position is within the sector connection range of the outer ring position, the outer ring position is also within the sector connection range. The method for determining the sector connection range of the outer ring position is whether it is within the range of k*2π±A, where k*2π±A is consistent with the sector connection range represented by k*2π / N±S. Therefore, when S=π / 9 and N=4, A is taken as π / 9*4=4π / 9. When the outer ring position is in [0, 4π / 9], it is within the starting position range. When the outer ring position is in [14π / 9, 2π], it is within the ending position range.

[0189] When the inner and outer ring positions are in the same position range, that is, both are in the starting position range or both are in the ending position range, it means that they correspond. At this time, the sector division is correct. Therefore, the sector is rounded to obtain the actual current sector.

[0190] When the inner and outer ring positions are not in the same position range, that is, one position is in the starting position range and the other is in the ending position range, it means that the two do not correspond. At this time, the sector division is incorrect, so it is necessary to adjust the sector based on the reference sector to obtain the current sector.

[0191] In this embodiment, since the error is relatively large within the sector connection range of the outer ring signal cycle, further judgment is required when the inner ring position is within the sector connection range. When both the inner and outer ring positions are within the starting position range or both are within the ending position range, they are almost unaffected by the error, so the reference sector can be rounded. However, when affected by the error, the inner and outer ring positions will be in different position ranges, so sector adjustment is required based on the reference sector to obtain the accurate current sector.

[0192] In one embodiment, when the inner ring position and the outer ring position are not within the same position range, sector adjustment is performed based on a reference sector to obtain the current sector, including:

[0193] When the inner circle position is within the starting position range and the outer circle position is within the ending position range, the reference sector is rounded up, and the rounded reference sector is adjusted to the previous sector to obtain the current sector.

[0194] When the inner circle position is within the end position range and the outer circle position is within the start position range, the reference sector is rounded up, and the rounded reference sector is adjusted to the next sector to obtain the current sector.

[0195] Specifically, for example, the position ① of the inner circle is within the starting position range of the second outer circle signal cycle, while the corresponding position ① of the outer circle is within the ending position range of the first outer circle signal cycle. In this case, the reference sector is assumed to be 1.1, rounded down to 1, and adjusted to the previous sector. Therefore, the current sector is 0, meaning the inner circle has completely traversed 0 sectors. Based on the outer circle position result, 0 sectors is correct. The final calculated current position is less than π / 2.

[0196] The inner circle position ② is located at the end of the second outer circle signal cycle, while the corresponding outer circle position ② is located at the beginning of the third outer circle signal cycle. At this point, the reference sector is assumed to be 1.9, rounded down to 1, and adjusted to the next sector. Therefore, the current sector is 2, meaning the inner circle has completely traversed two sectors. Based on the outer circle position, the two sectors are correct. The final calculated current position is greater than π.

[0197] In this embodiment, when the inner ring position is within the starting position range and the outer ring position is within the ending position range, the reference sector after rounding is adjusted to the previous sector, i.e., to the sector where the outer ring position is located, based on the outer ring position, to obtain the accurate current sector; when the inner ring position is within the ending position range and the outer ring position is within the starting position range, the reference sector after rounding is adjusted to the next sector, i.e., to the sector where the outer ring position is located, to obtain the accurate current sector.

[0198] In one embodiment, determining the current position of the encoder based on the current sector and the outer ring position includes:

[0199] Determine the product of the current sector and the corresponding sector position to obtain the coarse positioning position;

[0200] Determine the ratio of the outer ring position to the total number of sectors to obtain the fine positioning position; the total number of sectors is the number of outer ring signal cycles corresponding to one inner ring signal cycle.

[0201] The current position of the encoder is obtained by summing the coarse and fine positioning positions.

[0202] Specifically, the coarse positioning position refers to the position represented by the inner ring. The fine positioning position is the position represented by the outer ring. The current sector indicates which sector the encoder is currently in; therefore, the product of the current sector and its corresponding position is the coarse positioning position. The ratio of the outer ring position to N represents the absolute position represented by the outer ring within the current outer ring signal cycle. The sum of the coarse and fine positioning positions gives the encoder's current position.

[0203] Taking one inner ring signal cycle corresponding to four outer ring signal cycles (sectors) as an example:

[0204] Encoder current position = current sector × π / 2 + position 外 / 4

[0205] In this embodiment, the coarse positioning position is obtained by the interaction of the signals from the inner and outer coils, the product of the current sector of the inner coil position and the corresponding position of the sector, the fine positioning position is obtained by the ratio of the outer coil position to the total number of sectors, and the current position of the encoder is obtained by the sum of the coarse positioning position and the fine positioning position, so that the position output by the encoder is more accurate.

[0206] In one embodiment, an encoder calibration method includes:

[0207] Step (a1): Obtain the sequence of positions to be processed output by the encoder to be calibrated.

[0208] Step (a2): Obtain the reference position sequence corresponding to the position sequence to be processed.

[0209] Step (a3): Based on the sequence of positions to be processed and the sequence of reference positions, determine the compensation error sequence corresponding to the sequence of positions to be processed.

[0210] Step (a4): Based on the elements in the sequence of positions to be processed and the corresponding compensation error sequence, perform a fast Fourier transform to obtain the spectrum function.

[0211] Step (a5) determines a preset number of frequencies with the highest percentage based on the spectrum function.

[0212] Step (a6): Determine the first coefficient set based on the frequency of the highest percentage of a preset number of items.

[0213] Step (a7) involves fitting a sine function to the reference position sequence, the corresponding compensation error sequence, and the first coefficient set to obtain the function compensation coefficients.

[0214] Step (a8) sends function compensation coefficients to the encoder to be calibrated; the function compensation coefficients are used to calibrate the encoder to be calibrated.

[0215] In this embodiment, a reference position sequence is obtained, and a compensation error sequence is determined based on the position sequence to be processed and the reference position sequence. The reference position sequence and the compensation error sequence are then fitted to obtain function compensation coefficients. These function compensation coefficients are sent to the encoder to be calibrated, thereby calibrating the errors introduced by the encoder and improving position accuracy. Furthermore, only one calibration is required after the encoder is installed, significantly reducing calibration time, improving work efficiency, and lowering maintenance costs.

[0216] In one embodiment, such as Figure 5The diagram shown is a flowchart of an encoder calibration method in another embodiment, applied to the encoder, and includes the following steps:

[0217] Step 502: Obtain the compensation function. The compensation coefficients in the compensation function are obtained by fitting the position sequence to be processed and the corresponding compensation error sequence. The compensation error sequence is determined based on the position sequence to be processed and the reference position sequence. The position sequence to be processed is output by the encoder. The reference position sequence corresponds to the position sequence to be processed.

[0218] Specifically, the compensation function is pre-stored in the encoder to be calibrated.

[0219] Step 504: Obtain the current position of the encoder, input the current position into the compensation function, and obtain the position compensation value.

[0220] Specifically, the compensation function is known to be f(x) = a1*sin(b1*x+c1)+a2*sin(b2*x+c2)+a3*sin(b3*x+c3)+a4*sin(b4*x+c4)+a5*sin(b5*x+c5)+a6*sin(b6*x+c6)+a7*sin(b7*x+c7)+a8*sin(b8*x+c8)

[0221] Furthermore, since the coefficients are known, x = the current position, and the f(x) value obtained after input is the position compensation value.

[0222] Step 506: Calibrate the current position based on the position compensation value to obtain the target position.

[0223] Specifically, the target position is obtained by adding the position compensation value to the current position.

[0224] In this embodiment, by obtaining a compensation function, inputting the current position into the compensation function, obtaining a position compensation value, calibrating the current position based on the position compensation value, and obtaining the target position, the position value can be accurately detected.

[0225] In one embodiment, the encoder calibration method further includes: acquiring normalized parameter values; acquiring the signal obtained at the detection position; normalizing the signal based on the normalized parameter values ​​to obtain a normalized signal; and calculating the current position based on the normalized signal.

[0226] The normalized parameter values ​​can be pre-stored in the encoder to be calibrated. These normalized parameter values ​​include the bias voltage. They may also include a normalization factor.

[0227] Specifically, the encoder to be calibrated first samples and filters the signal, then normalizes it to obtain a normalized signal, and calculates the current position based on the normalized signal.

[0228] In this embodiment, the normalized parameter value is obtained, the signal obtained when the detection position is obtained, and normalization processing is performed. The current position is calculated based on the normalized signal, which can improve the measurement accuracy of the encoder.

[0229] It should be understood that, although the above Figure 3 and Figure 5 In the flowchart, the steps are shown sequentially according to the arrows, and the steps (a1) to (a8) are shown sequentially according to their numbers. However, these steps are not necessarily executed in the order indicated by the arrows or numbers. Unless explicitly stated herein, there is no strict order requirement for the execution of these steps; they can be executed in other orders. Figure 3 and Figure 5 At least some of the steps in the process may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but may be executed at different times. The execution order of these steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the steps or stages in other steps.

[0230] Specific limitations regarding the encoder calibration device can be found in the limitations of the encoder calibration method described above, and will not be repeated here. Each module in the aforementioned encoder calibration device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the host computer's processor in hardware form or independent of it, or stored in the host computer's memory in software form, so that the processor can call and execute the corresponding operations of each module.

[0231] In one embodiment, a host computer is provided, which may be a terminal device, and its internal structure diagram may be as follows: Figure 6As shown, the host computer includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements an encoder calibration method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the host computer casing, or an external keyboard, touchpad, or mouse.

[0232] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the solution of this application and does not constitute a limitation on the host computer on which the solution of this application is applied. The specific host computer may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0233] In one embodiment, a host computer is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described method embodiments.

[0234] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method embodiments.

[0235] In one embodiment, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a host computer reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the host computer to perform the steps described in the above method embodiments.

[0236] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes described in the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0237] The above description is only a preferred embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural changes made based on the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. An encoder calibration method, characterized in that, The method includes: The system obtains the sequence of positions to be processed output by the encoder to be calibrated, and the sequence of reference positions corresponding to the sequence of positions to be processed; the sequence of positions to be processed is obtained by the encoder to be calibrated being sampled and output at regular intervals during rotation, and is obtained by the main drive system configured with photoelectric encoder driving the encoder to be calibrated to rotate at a constant speed; Based on the sequence of positions to be processed and the sequence of reference positions, determine the compensation error sequence corresponding to the sequence of positions to be processed; Obtain a first set of coefficients; the first set of coefficients is determined based on a preset number of frequencies with the highest percentage; the preset number of frequencies with the highest percentage are determined based on a spectrum function; the spectrum function is obtained by performing a fast Fourier transform on the sequence of positions to be processed and the time corresponding to each position to be processed; The sequence of positions to be processed, the corresponding sequence of compensation errors, and the first set of coefficients are fitted with a sine function to obtain the function compensation coefficients. The function compensation coefficient is sent to the encoder to be calibrated; the function compensation coefficient is used to calibrate the encoder to be calibrated.

2. The method according to claim 1, characterized in that, The step of fitting a sine function to the sequence of positions to be processed, the corresponding sequence of compensation errors, and the first set of coefficients to obtain the function compensation coefficients includes: The sequence of positions to be processed, the corresponding sequence of compensation errors, and the first set of coefficients are fitted with an eighth-order sine function to obtain the function compensation coefficients.

3. The method according to claim 1, characterized in that, The step of determining the compensation error sequence corresponding to the position sequence to be processed based on the position sequence to be processed and the reference position sequence includes: The error sequence is obtained by subtracting the position sequence to be processed and the reference position sequence. The average error is obtained by averaging the error series. Subtract the average error from each element in the error sequence to obtain the compensation error sequence.

4. An encoder calibration method, characterized in that, Applied to an encoder, the method includes: A compensation function is obtained, wherein the compensation coefficients in the compensation function are obtained by fitting a sine function to the sequence of positions to be processed, the corresponding compensation error sequence, and a first coefficient set; the first coefficient set is determined based on a preset number of frequencies with the highest percentage; the preset number of frequencies with the highest percentage are determined based on a spectrum function; the spectrum function is obtained by performing a fast Fourier transform on the sequence of positions to be processed and the time corresponding to each position; the compensation error sequence is determined based on the sequence of positions to be processed and a reference position sequence; the reference position sequence corresponds to the sequence of positions to be processed; the sequence of positions to be processed is obtained by the encoder being sampled and output at regular intervals during rotation, and by the main drive system configured with a photoelectric encoder driving the encoder to rotate at a constant speed; Obtain the current position of the encoder, input the current position into the compensation function, and obtain the position compensation value; The current position is calibrated based on the position compensation value to obtain the target position.

5. An encoder calibration device, characterized in that, The device includes a host computer and an encoder to be calibrated, and is used to implement the steps of the method according to any one of claims 1 to 4.

6. A host computer, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 3.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

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

    CN116046044A

  • On-line compensation apparatus for feedback positions of encoder and method for operating the same

    US20120029726A1