CN117589221A - Encoder calibration method, device, upper computer and storage medium - Google Patents

Encoder calibration method, device, upper computer and storage medium Download PDF

Info

Publication number
CN117589221A
CN117589221A CN202311577385.3A CN202311577385A CN117589221A CN 117589221 A CN117589221 A CN 117589221A CN 202311577385 A CN202311577385 A CN 202311577385A CN 117589221 A CN117589221 A CN 117589221A
Authority
CN
China
Prior art keywords
encoder
processed
compensation
function
sequence
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311577385.3A
Other languages
Chinese (zh)
Inventor
请求不公布姓名
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Xhorse Electronics Co Ltd
Original Assignee
Shenzhen Xhorse Electronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Xhorse Electronics Co Ltd filed Critical Shenzhen Xhorse Electronics Co Ltd
Priority to CN202311577385.3A priority Critical patent/CN117589221A/en
Publication of CN117589221A publication Critical patent/CN117589221A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01DMEASURING NOT SPECIALLY ADAPTED FOR A SPECIFIC VARIABLE; ARRANGEMENTS FOR MEASURING TWO OR MORE VARIABLES NOT COVERED IN A SINGLE OTHER SUBCLASS; TARIFF METERING APPARATUS; MEASURING OR TESTING NOT OTHERWISE PROVIDED FOR
    • G01D18/00Testing or calibrating apparatus or arrangements provided for in groups G01D1/00 - G01D15/00
    • G01D18/001Calibrating encoders

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Transmission And Conversion Of Sensor Element Output (AREA)

Abstract

The application relates to an encoder calibration method, an encoder calibration device, an upper computer and a storage medium. The method comprises the following steps: acquiring a to-be-processed position array output by a to-be-calibrated encoder and a reference position array corresponding to the to-be-processed position array; determining a compensation error sequence corresponding to the position sequence to be processed based on the position sequence to be processed and the reference position sequence; fitting the position number sequence to be processed and the corresponding compensation error number sequence to obtain a function compensation coefficient; transmitting the function compensation coefficient to the encoder to be calibrated; the function compensation coefficient is used for calibrating the encoder to be calibrated. The method can improve the position accuracy.

Description

Encoder calibration method, device, upper computer and storage medium
Technical Field
The application relates to the technical field of computers, in particular to an encoder calibration method, an encoder calibration device, an upper computer and a storage medium.
Background
Today, where industry is developed and will continue to develop, engineering technicians are increasingly demanding high precision and high reliability measuring devices. Angular position and angular velocity measuring devices are one type of these demanding measuring devices. Angular position and angular velocity measuring devices are used very widely in industry, in particular in the field of motor control. High performance servo motor control requires that the measuring device provide high accuracy and high reliability position and angular velocity measurements. Position sensors are common in the motor control field: photoelectric encoder, magnetic encoder, inductive encoder, capacitive encoder, and rotary transformer.
Along with the development of the times, the requirements of industrial production on angular position measurement are higher and higher, and the strict requirements on high precision, quick response, stronger anti-interference performance and the like of the angular position measurement enable a part of traditional angular position sensors to be incapable of better adapting to the current product requirements. The position error of the output of the conventional encoder is large.
Disclosure of Invention
In view of the foregoing, it is desirable to provide an encoder calibration method, apparatus, host computer, and storage medium that can improve the positional accuracy.
A method of encoder calibration, the method comprising:
acquiring a to-be-processed position array output by a to-be-calibrated encoder and a reference position array corresponding to the to-be-processed position array;
determining a compensation error sequence corresponding to the position sequence to be processed based on the position sequence to be processed and the reference position sequence;
fitting the position number sequence to be processed and the corresponding compensation error number sequence to obtain a function compensation coefficient;
transmitting the function compensation coefficient to the encoder to be calibrated; the function compensation coefficient is used for calibrating the encoder to be calibrated.
An encoder calibration method applied to an encoder, the method comprising:
Obtaining a compensation function, wherein a function compensation coefficient in the compensation function is obtained by fitting a position number sequence to be processed and a corresponding compensation error number sequence; the compensation error sequence is determined based on the to-be-processed position sequence and a reference position sequence; the position number array to be processed is output by the encoder; the reference position number array corresponds to the position number array to be processed;
acquiring the current position of the encoder, and inputting the current position into the compensation function to obtain a position compensation value;
and calibrating the current position based on the position compensation value to obtain a target position.
The upper computer comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes the steps of each encoder calibration method embodiment when executing the computer program.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the respective encoder calibration method embodiments.
According to the encoder calibration method, the device, the upper computer and the storage medium, the reference position number sequence is obtained, the compensation error number sequence is determined based on the to-be-processed position number sequence and the reference position number sequence, the reference position number sequence and the compensation error number sequence are subjected to fitting processing, the function compensation coefficient is obtained, the function compensation coefficient is sent to the encoder to be calibrated, namely, errors brought by the encoder to be calibrated can be calibrated, and the position accuracy is improved. And moreover, after the encoder is installed, the encoder is only required to be calibrated once, so that the calibration time is greatly shortened, the working efficiency is improved, and the maintenance cost is reduced.
Drawings
FIG. 1 is a diagram of an application environment for an encoder calibration method in one embodiment;
FIG. 2 is a diagram of an application environment of an encoder calibration method in another embodiment;
FIG. 3 is a flow chart of a method of calibrating an encoder in one embodiment;
FIG. 4 is a graph illustrating a fit function in one embodiment;
FIG. 5 is a flow chart of an encoder calibration method according to another embodiment;
fig. 6 is an internal structural diagram of the upper computer in one embodiment.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without undue burden, are within the scope of the present application.
It should be noted that all directional indicators (such as up, down, left, right, front, and rear … …) in the embodiments of the present application are merely used to explain the relative positional relationship, movement conditions, etc. between the components in a specific posture (as shown in the drawings), if the specific posture is changed, the directional indicators correspondingly change, and the connection may be a direct connection or an indirect connection.
In addition, descriptions such as those related to "first," "second," and the like, are provided for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated in this application. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions of the embodiments may be combined with each other, but it is necessary to base that the technical solutions can be realized by those skilled in the art, and when the technical solutions are contradictory or cannot be realized, the combination of the technical solutions should be regarded as not exist and not within the protection scope of the present application.
The terms "first," "second," and the like, as used herein, may be used to describe various data, but such data is not limited by these terms. These terms are only used to distinguish one data element from another. For example, 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, without departing from the scope of the present application. Both the first coefficient set and the second coefficient set are coefficient sets, but they are not the same coefficient set.
It is to be understood that in the following embodiments, "connected" is understood to mean "electrically connected", "communicatively connected", etc., if the connected circuits, modules, units, etc., have electrical or data transfer between them.
The encoder calibration method provided by the application can be applied to an application environment as shown in fig. 1. FIG. 1 is a diagram of an application environment for an encoder calibration method in one embodiment. Including a host computer 110 and an encoder 120 to be calibrated. The host computer 110 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. The kind of encoder 120 to be calibrated is not limited. The encoder calibration method in the embodiments of the present application can be applied to calibration of various photoelectric encoders, magnetic encoders, inductive encoders, capacitive encoders and rotary transformers. The position may be a displacement, or may be an angular position, etc., without being limited thereto.
In one embodiment, the encoder is an important device for registering motor bearing rotation angle and speed. The rotation of the motor typically requires control and feedback in conjunction with an encoder. As shown in fig. 2, an application environment diagram of an encoder calibration method in another embodiment is shown. The device comprises a servo motor 1 controller, a servo motor 1, a coupler, a servo motor 2 and an upper computer which are connected. The main towing system comprises a servo motor 1 controller, a servo motor 1, a coupler and a servo motor 2. The servo motor 1 controller is used for controlling the servo motor 1 to rotate at a constant speed. The servo motor 1 is provided with a high-precision photoelectric encoder. The servo motor 1 is connected with the servo motor 2 through a coupler. The servo motor 2 is provided with an encoder to be calibrated. The servo motor 2 is driven to rotate at a constant speed by configuring a main dragging system of the high-precision photoelectric encoder, namely the high-precision photoelectric encoder provides relatively accurate rotation feedback for the servo motor 2 to rotate, and the servo motor 2 is ensured to rotate accurately. And testing the encoder to be calibrated under the condition that the servo motor 2 rotates accurately, and obtaining the number series of the positions to be processed output by the encoder to be calibrated. The reference position array can be regarded as an accurate value and corresponds to the positions to be processed one by one.
In one embodiment, as shown in fig. 3, a flow chart of an encoder calibration method in one embodiment includes:
step 302, a to-be-processed position array output by the encoder to be calibrated and a reference position array corresponding to the to-be-processed position array are obtained.
Wherein the reference position array may be considered as a set of correct positions. The reference position number column includes a plurality of reference positions. The reference position may specifically be a reference position preset in the upper computer.
The array of pending locations includes a plurality of pending locations. One reference position corresponds to one to-be-processed position. In general, there is a certain error between the position to be processed and the reference position.
The position to be processed can be specifically a position obtained by normalizing and settling a signal output by the programmer to be calibrated.
Specifically, taking the position as an angle as an example, the main dragging system drives the encoder to be calibrated to rotate for one circle, calculates the angle position at regular time, outputs r angles, and obtains a position array to be processed.
Optionally, the main dragging system configured with the high-precision photoelectric encoder rotates according to the reference position number sequence and drives the encoder to be calibrated to rotate, and after the encoder to be calibrated rotates, the upper computer obtains the position number sequence to be processed.
Step 304, determining a compensation error number sequence corresponding to the position number sequence to be processed based on the position number sequence to be processed and the reference position number sequence.
The compensation error sequence includes a plurality of compensation error values. The compensation error sequence corresponding to the position sequence to be processed, namely a current position, has a corresponding compensation error value.
Specifically, the upper computer may respectively perform differences on corresponding elements in the to-be-processed position array and the reference position array, so as to obtain a compensation error array corresponding to the to-be-processed position array.
And 306, fitting the position number sequence to be processed and the corresponding compensation error number sequence to obtain a function compensation coefficient.
The fitting process may be a direct fitting process or a fitting process of a preset function. The function compensation coefficient can be obtained only through one calibration process.
Specifically, the upper computer performs fitting processing on the position array to be processed and the corresponding compensation error array to obtain a compensation function and a corresponding function compensation coefficient.
Step 308, transmitting the function compensation coefficient to the encoder to be calibrated; the function compensation coefficient is used for performing calibration of the encoder to be calibrated.
Specifically, the upper computer sends the function compensation coefficient to the encoder to be calibrated. The encoder to be calibrated acquires the current position of the encoder to be calibrated, and inputs the current position into a compensation function containing the function compensation coefficient to obtain a position compensation value. The encoder to be calibrated compensates the current position based on the position compensation value to obtain the target position.
In this embodiment, the reference position sequence is obtained, the compensation error sequence is determined based on the to-be-processed position sequence and the reference position sequence, the to-be-processed position sequence and the compensation error sequence are subjected to fitting processing to obtain the function compensation coefficient, and the function compensation coefficient is sent to the to-be-calibrated encoder, so that the error brought by the to-be-calibrated encoder can be calibrated, and the position accuracy is improved. And moreover, after the encoder is installed, the encoder is only required to be calibrated once, so that the calibration time is greatly shortened, the working efficiency is improved, and the maintenance cost is reduced.
In one embodiment, fitting the to-be-processed position number sequence and the corresponding compensation error number sequence to obtain a function compensation coefficient includes: and performing sine function fitting on the position number sequence to be processed and the corresponding compensation error number sequence to obtain a function compensation coefficient.
The general expression that the encoder to be calibrated can be fitted with a position sine function is f (x) =a×sin (b×x+c), where x represents the multiplier. Wherein a, b and c are the compensation coefficients of the function.
Specifically, the upper computer performs sine function fitting on the position number sequence to be processed and the corresponding compensation error number sequence to obtain a sine compensation function and a corresponding function compensation coefficient. Specifically, a sum of sin may be used for the function fitting.
In this embodiment, through repeated tests for multiple times, the fitting effect is better when the sinusoidal function fitting is used, so that the obtained compensation function is accurate by performing sinusoidal function fitting on the position number sequence to be processed and the corresponding compensation error number sequence, and the position value obtained by the encoder to be calibrated is more accurate.
In one embodiment, performing sine function fitting on the position number sequence to be processed and the corresponding compensation error number sequence to obtain a function compensation coefficient, including: and performing eighth-order sine function fitting on the position number sequence to be processed and the corresponding compensation error number sequence to obtain a function compensation coefficient.
Specifically, the general expression of the eighth order function fit is
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)
Then the function compensation coefficients are a1, b1, c1, a2, b2, c2 … … a8, b8 and c8. Distinguishing from 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.
In this embodiment, through analysis, the higher the order of function fitting, the more frequency points can be suppressed, so that eight-order sine function fitting is selected, and eight-order sine function fitting is performed on the position number sequence to be processed and the corresponding compensation error number sequence, so that the obtained compensation function fitting effect is good, and the position value obtained by the encoder to be calibrated is more accurate.
In one embodiment, the sequence of positions to be processed is output by sampling at regular time during rotation of the encoder to be calibrated;
performing sine function fitting on the position number sequence to be processed and the corresponding compensation error number sequence to obtain a function compensation coefficient, wherein the method comprises the following steps:
acquiring a first coefficient set; the first coefficient set is determined based on a preset number of frequencies with highest duty ratios; the frequency with the highest preset number of duty ratios is determined based on a frequency spectrum function; the frequency spectrum function is obtained by performing fast Fourier transform on the to-be-processed position sequence and the time corresponding to each to-be-processed position;
and performing sine function fitting on the to-be-processed position array, the time corresponding to each to-be-processed position and the first coefficient set to obtain a function compensation coefficient.
The frequency with the highest duty ratio is the frequency corresponding to the maximum amplitude represented by the spectrum function. The frequency with the highest duty cycle is the frequency of the main effect. The first set of coefficients is predetermined. The first coefficient set 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 fit. For example, the sine function fit is fourth order, then the preset number is 4; the sine function fit is eighth order, then the preset number is 8.
Specifically, the number of the positions to be processed is sampled and output by the encoder to be calibrated at regular time in the rotation process, namely, each position to be processed has corresponding time, and each time is different. Taking the position to be processed and the corresponding time as discrete points, and performing fast Fourier transform to obtain a frequency spectrum function. The spectral function reveals the amplitude versus frequency. The larger the amplitude, the more the frequency is accounted for. From which a preset number of frequencies with highest duty cycles can be determined based on the spectral function. Whereas the first coefficient b is actually ω, ω=2pi f, in relation to the frequency f; thus, f is obtained, ω=2pi f is calculated, and the value of b can be determined.
Therefore, under the condition that the first coefficient set is known, only the second coefficient set and the third coefficient set remain undissolved in the sine function expression at the moment, and then the sine function fitting is carried out on the position number sequence to be processed and the corresponding compensation error number sequence, so that the function compensation coefficient is obtained.
Optionally, the preset number may be 8, and the to-be-processed position number sequence and the corresponding compensation error number sequence, and the first coefficient set are subjected to eighth-order sine function fitting, so as to obtain the function compensation coefficient. As shown in fig. 4, a graph of the fitting function in one embodiment is shown. The x-axis in fig. 4 represents the position and the y-axis represents the error compensation value. The black dots represent the positions to be processed and the corresponding error compensation values. And the curve is the compensation function corresponding to the compensation function coefficient. As can be seen from fig. 4, the compensation function obtained by fitting substantially coincides with the error compensation value, indicating that calibration based on the compensation coefficient of the function can reduce the error well.
In the embodiment, the accuracy of the obtained function compensation coefficient can be quickly fitted and improved by pre-determining the first coefficient set and then performing sine function fitting; in addition, the accuracy of the first coefficient set obtained through spectrum analysis is high, and the accuracy of a function obtained through fitting can be improved.
In one embodiment, determining a compensation error sequence corresponding to the pending position sequence based on the pending position sequence and the reference position sequence includes:
performing difference processing based on the position number sequence to be processed and the reference position number sequence to obtain an error number sequence;
averaging the error number sequence to obtain an error average value;
and subtracting the error average value from each element in the error sequence to obtain a compensation error sequence.
Specifically, assuming that the encoder rotates one turn, the positions are calculated at fixed time, and the number of positions to be processed Xn is output, for a total of r positions:
Xn={X0,X1,X2,…,Xr-1}
the first position value is taken as a starting value, and the reference position number sequence Gn is obtained by taking 2 pi/r as a tolerance:
Gn={G0,G1,G2,…,Gr-1}
={X0,X0+2π/r,X0+4π/r,…,X0+(r-1)*2π/r}
error number column:
Hn=Xn-Gn={H0,H1,H2,…,Hr-1}={X0-G0,X1-G1,X2-G2,…,Xr-1–Gr-1}
calculating the average value of the error number columns:
H_average=(H0+H1+H2+…+Hr-1)/r
subtracting the average value from each element of the error sequence Hn yields a compensated error sequence:
Kn={K0,K1,K2,…,Kr-1}
={H0-H_average,H1-H_average,H2-H_average,…,Hr-1-H_average}
in this embodiment, the difference processing is performed based on the position sequence to be processed and the reference position sequence, the obtained error sequence is averaged to obtain an error average value, and then each element in the error sequence is subtracted from the error average value to obtain a compensation error sequence, so that the sampling bias can be reduced, and the accuracy can be improved.
In one embodiment, the position array to be processed is obtained after a main dragging system of the photoelectric encoder is configured to drive the encoder to be calibrated to rotate at a constant speed.
In this embodiment, the precision of the photoelectric encoder is higher, so that the main dragging system can be guaranteed to drive the encoder to be calibrated to rotate at a constant speed, and therefore, the determined position number sequence to be processed and the reference position number sequence are accurate, and the accuracy of fitting data is improved.
In one embodiment, normalizing the signal output by the encoder to be calibrated to obtain a normalized signal and a normalized parameter value; and after resolving the normalized data, obtaining a position number array to be processed.
An inductive encoder is described as an example. First, the basic principle of the inductive encoder is introduced: the physical principle of eddy currents is used to detect the position of a metal target moving over a coil.
First the position sensor chip will input an alternating current into the transmitter coil and generate an alternating magnetic field. The magnetic field induces a voltage in the receiver coil. Under the condition of no metal target, zero output is realized on each pair of ports after the induced voltage is compensated due to anti-serial connection and balance between line segments.
If a metal target is placed over the coil:
a. the magnetic field induces eddy currents on the surface of the metal target.
b. The eddy currents create a demagnetizing field, thereby reducing the overall magnetic flux density below.
c. The voltage induced in the region of the receiver coil below the target is reduced, creating a voltage imbalance in the anti-series coil.
d. The voltage signal is output with an amplitude and polarity that varies with the target location.
The encoder will be described by taking an example of an encoder including an inner coil and an outer coil. The inner ring refers to a set of coils near the center on the encoder. The inner ring includes a transmitting coil and at least two receiving coils. The outer ring refers to a set of coils on the encoder that are far from the center. The outer ring also includes a transmitting coil and at least two receiving coils. Taking two receiving coils as an example, one receiving coil is used for generating a sine signal and the other receiving coil is used for generating a cosine signal. The signal generated by the inner loop receiving coil is called an inner loop signal, and includes an inner loop sine signal and an inner loop cosine signal. The signals generated by the outer ring receiving coil are called outer ring signals, and comprise outer ring sine signals and outer ring cosine signals. That is, the inner ring signal and the outer ring signal are both signals generated by the receiving coil. The signals are voltage signals. In this embodiment, a position is described as an example.
The encoder system rotates at a constant speed at a frequency of F Hz. Then the frequency of the inner circle sine and cosine is F Hz, and the frequency of the sine and cosine is n×f Hz. In order to acquire the magnitudes of the Vsin and Vcos actually generated as much as possible, each sine and cosine wave should acquire enough points, it is assumed here that M points are acquired for each sine and cosine wave of the outer ring, P sine and cosine waves are acquired, the sampling interval of each sampling point is the same, the sampling frequency is n×f×mhz, the maximum and minimum values of the Vsin and Vcos of the M points are obtained by comparing each acquisition of the M points, and the maximum and minimum values of the P Vsin and Vcos are assumed to be Vsina, vsinb, vcosa, vcosb by averaging.
The bias voltages for Vsin and Vcos can be obtained:
Vsin_offset=(Vsina+Vsinb)/2
Vcos_offset=(Vcosa+Vcosb)/2
amplitude of Vsin and Vcos:
Vsin_pp=Vsina–Vsinb
Vcos_pp=Vcosa–Vcosb
normalization factor of Vsin and Vcos:
Q=Vsin_pp/Vcos_pp
then let the following steps before each calculation of the position
V_sin=V_sin-Vsin_offset
V_cos=Q*(V_cos-Vcos_offset)
(where V_sin, V_cos are the values of the sine and cosine voltages actually sampled at the current location)
The normalization process for the inner ring is the same as above. The normalization parameter values obtained are the bias voltage and the normalization factor.
2. The upper computer obtains a function compensation coefficient:
assuming that the encoder rotates one turn, the position is calculated at fixed time, and r position values are output as
Xn={X0,X1,X2,…,Xr-1}
The array Xn is transmitted to the upper computer, and the next work is transmitted to the upper computer for completion.
A group of series are obtained by taking the first position value as the initial value and taking 2 pi/r as the tolerance
Gn={G0,G1,G2,…,Gr-1}
={X0,X0+2π/r,X0+4π/r,…,X0+(r-1)*2π/r}。
Error array
Hn=Xn-Gn={H0,H1,H2,…,Hr-1}
={X0-G0,X1-G1,X2-G2,…,Xr-1–Gr-1}
Calculating the average value of the error sequence
H_average=(H0+H1+H2+…+Hr-1)/r
Subtracting the average value from each element of the error sequence Hn yields a compensated error sequence kn= { K0, K1, K2, …, kr-1}
={H0-H_average,H1-H_average,H2-H_average,…,Hr-1-H_average}
Here, for convenience of presentation effect, function compensation curve fitting is performed using matlab, with the x-axis being the number series Xn and the y-axis being the number series Kn.
Through tests, the effect of fitting is good when sumofsin is used for performing function fitting, and the higher the order of the function fitting is, the more frequency points can be suppressed. An 8 th order function fit is chosen here.
The fitting formula is:
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)
before fitting, the spectrum analysis is performed by FFT (Fast Fourier transform ) to obtain 8 points with the highest spectrum amplitude (here, 8 points are taken because of 8 steps selected by function compensation). Through practical spectrum analysis, the points with higher frequencies are found to be 1,9, 10, 11, 20, 30, 40 and 80 respectively, and curve fitting is carried out by taking the 8 points as initial frequencies.
And then the upper computer transmits the function fitting coefficients to the encoder, and the encoder writes the normalized parameters and the function fitting coefficients into the internal flash, so that the calibration flow is completed.
In this embodiment, due to various factors such as production errors and environmental influences, the input signals are not completely ideal, and errors exist in the calculated angle, so that the precision and accuracy of angle detection can be remarkably improved, and the encoder can be calibrated only once after the encoder is installed, so that the time required to be calibrated before each use of a plurality of measuring devices is greatly reduced, the working efficiency is improved, and the maintenance cost is reduced. An experimental environment is set up to carry out actual comparison test, as shown in fig. 4, and it is proved that the embodiment can realize error analysis and calibration of the inductive angular position sensor.
In one embodiment, the encoder comprises an inner ring and an outer ring, each comprising a transmit coil and at least two receive coils; acquiring a current position of an encoder, comprising: acquiring an inner ring signal, wherein the inner ring signal comprises an inner ring sine signal and an inner ring cosine signal; determining an inner ring position based on the inner ring sine signal and the inner ring cosine signal; determining a current sector corresponding to the inner ring position based on the inner ring position and the position corresponding to the sector; the current position of the encoder is determined based on the current sector and outer ring positions.
The position of the inner ring refers to the position of an object indicated by the inner ring. The position is understood to be an angle, a linear displacement, etc. The inner ring position may be an inner ring mechanical angle, which is used to represent an absolute angle. The range of the position of the inner ring is 0-2 pi. The outer ring position may be an outer ring relative angle, not indicative of a mechanical angle. The value range of the outer ring position is 0-2 pi.
Specifically, when the object is within the detection range of the encoder, the encoder receives the inner ring signal and the outer ring signal, and the object is at different positions, and the amplitude of the signals generated by the coils is different.
The inner circle sine signal and the inner circle cosine signal can be signals after normalization processing. The normalization process removes the bias of the inner loop signal and adjusts the amplitude of the inner loop sine signal and the inner loop cosine signal to match.
And inputting the inner ring sine signal and the inner ring cosine signal into a position resolving rule to obtain the inner ring position. The position calculation rule is as follows:
Position inner part =arctan(Vsin Inner part /Vcos Inner part )
Vsin Inner part Representing the voltage value of the inner loop sinusoidal signal, vcos Inner part Representing the voltage value of the inner circle cosine signal. In general, the value of the inner ring position is in the range of 0 to 2 pi.
The position corresponding to a sector refers to a sector, that is, a position represented by an outer ring signal period. Taking pi/2 as an example of the position corresponding to the sector. The current sector indicates which sector is currently located. And the current sector is an integer, and the value is 0-N-1 (the total number N of the sectors), such as 0-3. I.e., the current sector may be located in sector 0, sector 1, sector 2, or sector 3.
And the current sector corresponding to the inner ring position is obtained by rounding the ratio of the inner ring position to the position corresponding to the sector. For example, the inner ring position is 2π/3, the sector corresponding position is π/2, and the current sector= [2π/3/(π/2) ]=1. ([ x ] is rounded).
The outer ring sine signal and the outer ring cosine signal can be signals after normalization processing. The normalization process removes the offset of the outer ring signal and adjusts the amplitude of the outer ring sine signal and the outer ring cosine signal to match.
And inputting the outer ring sine signals and the outer ring cosine signals into a position resolving rule to obtain the outer ring position. The position calculation rule is as follows:
Position outer part =arctan(Vsin Outer part /Vcos Outer part )
Vsin Outer part Representing the voltage value, vcos, of the outer ring sinusoidal signal Outer part Representing the voltage value of the outer ring cosine signal. In general, the range of the outer ring positions is within the range of 0-2 pi in each outer ring signal period. And one inner ring signal period corresponds to N outer ring signal periods, so that in one inner ring signal period, the outer ring signal period has N0-2 pi.
The inner ring position calculates a rough position, and the outer ring position can refine the rough position further. And obtaining a coarse positioning position based on the current sector and the position corresponding to the sector. And obtaining a fine positioning position by the ratio of the outer ring position to the total number N of the sectors. The sum of the coarse positioning position and the fine positioning position is the current position of the encoder.
In this embodiment, the position processing is performed based on the encoder including the inner coil and the outer coil, the inner coil position is determined by the inner coil sine signal and the inner coil cosine signal, the outer coil position is determined based on the outer coil sine signal and the outer coil cosine signal, the current sector corresponding to the inner coil position is calculated, the current position of the encoder is determined based on the current sector and the outer coil position, coarse positioning and fine positioning are performed respectively, and the accuracy of the position output by the encoder is improved.
In one embodiment, determining the inner circle position based on the inner circle sine signal and the inner circle cosine signal includes: determining a current inner ring partition corresponding to the inner ring signal; acquiring a position resolving rule corresponding to the current inner ring partition; and resolving the inner ring sine signal and the inner ring cosine signal based on the current inner ring partition and the corresponding position resolving rule to obtain the position of the inner ring.
The inner ring partition can be divided according to requirements. A specific inner ring partition may be 8. For example, the inner ring is divided into 8 zones of [0, pi/4 ], [ pi/4, pi/2 ], [ pi/2, 3 pi/4 ], [3 pi/4, pi ], [ pi, 5 pi/4 ], [5 pi/4, 3 pi/2), [3 pi/2, 7 pi/4), [7 pi/4, 2 pi).
The encoder may combine the inner loop sine signal and the inner loop cosine signal to determine a current inner loop partition corresponding to the inner loop signal.
Each inner ring partition corresponds to a position resolution rule. The position resolving rules corresponding to different inner ring partitions can be the same or different. The position resolving rule corresponding to the inner ring partition is used for avoiding infinite results at the position of pi/2 times. I.e. an algorithm that modifies tan to be either cot or-cot over a multiple of pi/2. For example, in the vicinity of pi/2 and 3pi/2 positions, a position resolution rule including a complementary relation is employed. The position of the inner ring finally obtained is in the position range corresponding to the inner ring partition.
TABLE 1
Partition numbering Partition(s) Position calculation rule
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)
And resolving the inner ring sine signal and the inner ring cosine signal based on a position resolving rule corresponding to the current inner ring partition, and determining the position in the current inner ring partition to obtain the inner ring position. For example, the current inner ring partition is 1, i.e., at [ pi/4, pi/2); based on the inner circle Position calculation rule position=arcot (Vcos/Vsin), the inner circle Position can be obtained; and since the current inner ring partition is 1, the range of the solution is [ pi/4, pi/2), and the position of the solution inner ring is located within [ pi/4, pi/2) interval.
It will be appreciated that the partitions and corresponding position resolution rules of table 1 may be applied to the inner ring signal as well as to the outer ring signal. For example, determining the outer ring position based on the outer ring sine signal and the outer ring cosine signal includes: determining a current outer ring partition corresponding to the outer ring signal; acquiring a position resolving rule corresponding to the current outer ring partition; and resolving the outer ring sine signal and the outer ring cosine signal based on the current outer ring partition and the corresponding position resolving rule to obtain the outer ring position.
In this embodiment, the position error calculated in some partitions according to the conventional manner is larger, the position calculation rule corresponding to the current inner ring partition is obtained by determining the current inner ring partition corresponding to the inner ring signal, and the inner ring sine signal and the inner ring cosine signal are calculated based on the position calculation rule already corresponding to the current inner ring partition, so that the inner ring position is obtained, the error can be reduced, and the position accuracy is improved.
In one embodiment, determining a current inner ring partition corresponding to an inner ring signal includes:
determining partition conditions met by the voltage values of the inner ring signals, and taking the inner ring partition corresponding to the met partition conditions as the current inner ring partition.
The partitions can be set according to requirements. Such as dividing the interval by pi/4. As shown in table 2, a tabular representation of the partition conditions and the current inner ring partition is shown. The partition condition satisfied by the determined voltage value refers to a partition condition satisfied by the voltage value of the sine signal and the voltage value of the cosine signal together. 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), the interval is located in [0, pi/4 ], that is, partition 0.
TABLE 2
It will be appreciated that the partitioning conditions in this embodiment can also be applied to the outer ring. Partitioning processing is carried out based on the outer ring sine signal and the outer ring cosine signal to obtain a current outer ring partition, and the partitioning method comprises the following steps: determining partition conditions met by the voltage values of the outer ring signals, and taking the outer ring partition corresponding to the met partition conditions as the current outer ring partition.
In this embodiment, the partition condition satisfied by the voltage value of the inner ring signal is determined, and the inner ring partition corresponding to the satisfied partition condition is used as the current inner ring partition, so that different position resolving rules can be selected according to different partitions, thereby improving the accuracy of the position output by the encoder.
In one embodiment, the partitioning condition includes a magnitude relation between a voltage value of the inner-loop sine signal and 0, a magnitude relation between a voltage value of the inner-loop cosine signal and 0, and a magnitude relation between an absolute value of a voltage value of the inner-loop sine signal and an absolute value of a voltage value of the inner-loop cosine signal.
Specifically, taking an example list 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, table 3 is obtained.
TABLE 3 Table 3
/>
In Table 3, the condition is Vsin > 0, vcos > 0, and |Vsin| > |Vcos|. It will be appreciated that Vsin > 0, vcos > 0, and |Vsin| < |Vcos| may also be conditioned. It may be conditioned on Vsin < 0, vcos < 0, and |Vsin| > |Vcos|. It may be conditioned on Vsin > 0, vcos > 0, and |Vsin| < |Vcos|.
As is clear from the fact that the numbers indicated by 110 and 111 in table 3 are 7 and … …, each of the different conditions is satisfied with a unique value, and also corresponds to a single interval. Therefore, the condition of the division may be that the voltage value of the inner-circle sine signal is greater than or less than 0, the voltage value of the inner-circle cosine signal is greater than or less than 0, and the voltage value of the inner-circle sine signal is greater than or less than the voltage value of the inner-circle cosine signal.
It will be appreciated that the partitioning conditions in this embodiment can also be applied to the outer ring. The partitioning condition includes a magnitude relation between a voltage value of the outer ring sine signal and 0, a magnitude relation between a voltage value of the outer ring cosine signal and 0, and a magnitude relation between an absolute value of a voltage value of the outer ring sine signal and an absolute value of a voltage value of the outer ring cosine signal. In this embodiment, the partitioning is performed according to three preset conditions, so that the obtained inner ring partition has uniqueness, and features of each signal can be effectively represented, so that different solutions are performed on signals of different partitions, and accuracy of the obtained position is improved.
In one embodiment, the position resolution rules of the different inner ring partitions are each represented by a tangent correlation function; and the inner ring partition corresponding to pi/2 and the inner ring partition corresponding to 3 pi/2 are expressed by tangent correlation functions containing the cotangent relation.
Specifically, since it takes a long time to calculate the cot and arcot functions in hardware, the position calculation rules concerning the cot function are each expressed as a tangent correlation function. The location resolution rules are as in table 4, corresponding to fig. 3. A specific operation to avoid the occurrence of infinity at the positions pi/2 and 3 pi/2 is to set the partial equation in the position resolution rule to Vcos/Vsin.
TABLE 4 Table 4
Partition numbering Partition(s) Position calculation rule
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)
It will be appreciated that the above-mentioned partition is only required to avoid the situation that infinity occurs at the positions of pi/2 and 3 pi/2, for example, partition number 0, partition may be changed to [0, pi/3 ], partition number 1 corresponds to [ pi/3, pi) …, and the like.
It will be appreciated that the present embodiment is equally applicable to outer ring partitions. The position resolving rules of different outer ring partitions are expressed by tangent correlation functions; and the inner ring partition corresponding to pi/2 and the inner ring partition corresponding to 3 pi/2 are expressed by tangent correlation functions containing the cotangent relation.
In this embodiment, the position error obtained after the inner ring partition corresponding to pi/2 and the inner ring partition corresponding to 3 pi/2 are solved in the conventional manner is larger, so that the calculation is performed by adopting a function containing a cotangent relation, namely, the function is set to be Vcos/Vsin, so as to avoid the condition of infinity at the two positions; because the hardware is used for resolving the arcot function with longer time, the position resolving rules of different inner ring partitions are all expressed by tangent correlation functions, and the corresponding inner ring partitions of pi/2 and 3 pi/2 are expressed by tangent correlation functions containing the cotangent relation, so that the accuracy of the position of the encoder can be improved, and the position resolving efficiency can be improved.
In one embodiment, determining the current sector corresponding to the inner ring position based on the inner ring position and the position corresponding to the sector includes:
determining a reference sector corresponding to the inner ring position based on the inner ring position and the position corresponding to the sector;
and when the position of the inner ring is not in the sector connection range of the outer ring signal, rounding the reference sector to obtain the current sector.
Wherein the current sector is used to indicate which sector is currently in. The reference sector may be a decimal or an integer.
The sector concatenation range is used to represent the range around the concatenation between two sectors of an encoder. If the range of the connection between the 1 st outer ring signal period and the 2 nd outer ring signal period is the sector connection range, the range of the connection between the 2 nd outer ring signal period and the 3 rd outer ring signal period is also the sector connection range. The sector linking range is expressed by a number, namely k×2pi/n±s (k=0, 1,2, …, N-1, and k is an integer), k is an integer, and refers to the kth period, and S is a judgment threshold.
And when the periodic position range of the outer ring signal where the inner ring position is located is not in the k x 2 pi/N+/-S range, namely is not in the sector connection range, rounding the reference sector to obtain the current sector. For example, let the inner ring position be 3 pi/4, the corresponding position of the sector be pi/2, separated by pi/2, S be pi/9, i.e. the inner ring position is in the range of [7 pi/18,11 pi/18 ], [8 pi/9, 10 pi/9 ], [25 pi/18, 29 pi/18 ] and [17 pi/9, 2 pi ] and [0, pi/9 ], i.e. in the sector linking range. Then the reference sector is 1.5 and 3pi/4 is not within the sector concatenation range, so the current sector is 1, which rounds 1.5.
It is understood that the determination of whether the inner ring position is within the sector engagement range of the outer ring signal may also be based on the reference sector determination. Taking s=pi/9 as an example, for example, if the fractional part of the reference sector is within the range of [0,0.22], [0.78,1), if not, the inner ring position is not within the sector linking range of the outer ring signal. Wherein 0.22= (11 pi/18)/pi/2 (outer ring signal period) -1,0.78 = (7 pi/18)/pi/2.
In this embodiment, when the inner ring position is not within the sector engagement range, it is indicated that the inner ring position and the outer ring position are matched, and the positions are accurate, so that the reference sector can be rounded to obtain the current sector.
In one embodiment, determining the current sector corresponding to the inner ring position based on the inner ring position and the position corresponding to the sector further includes:
when the position of the inner ring is in the sector engagement range of the outer ring signal, determining the sector engagement range of the outer ring position; the sector linking range includes a start position range and an end position range;
when the inner ring position and the outer ring position are both in the initial position range or are both in the end position range, rounding the reference sector to obtain a current sector;
When the inner ring position and the outer ring position are not in the same position range, sector adjustment is performed based on the reference sector, and the current sector is obtained.
Wherein, the initial position range and the final position range of the outer ring signal are preset in the encoder. The start position range and the end position range are judged in such a manner that they are located at the start of the period or at the end of the period. If [ k.2pi/N, k.2pi/N+S ] is the starting position range, and [ k.2pi/N-S, k.2pi/N ] is the ending position range. [ k.2pi.k.2pi+A ] is a starting position range, and [ k.2pi-A, k.2pi ] is an end position range. Although the values are different, the same range is indicated.
For example, the inner ring position is within a sector-by-sector range of [ 7pi/18,11 pi/18 ], with [ 7pi/18, pi/2) being the end position range, and [ pi/2, 11pi/18 ] being the start position range.
Specifically, when the inner ring position is within the sector engagement range of the outer ring position, the outer ring position is also within the sector engagement range at this time. The method for judging the sector connection range of the outer ring position is whether the sector connection range is in the range of k.2pi+ -A, wherein the range of k.2pi+ -A is consistent with the sector connection range represented by k.2pi/N+ -S. Thus, in the case of s=pi/9, n=4, a takes pi/9*4 =4pi/9. When the outer ring position is located at [0, 4pi/9 ], it is located in the initial position range. When the outer ring position is located at [ 14pi/9, 2pi ], it is located in the end position range.
When the inner ring position and the outer ring position are in the same position range, namely, are both in the initial position range or are both in the end position range, the two are corresponding, and the division of the sectors is correct at the moment, so that the sectors are rounded to obtain the actual current sector.
When the inner ring position and the outer ring position are not in the same position range, namely one position is in the initial position range and the other position is in the end position range, the two positions are not corresponding, and the division of the sectors is wrong at the moment, so that sector adjustment is needed based on the reference sectors, and the current sector is obtained.
In this embodiment, since the error is larger in the sector engagement range of the outer ring signal period, when the inner ring position is in the sector engagement range, further judgment is needed, and when both the inner ring position and the outer ring position are in the initial position range or both the end position range, both the inner ring position and the outer ring position are hardly affected by the error, so that the reference sector is rounded; when the error is affected, the position ranges of the inner ring and the outer ring are different, so that sector adjustment is needed based on the reference sector to obtain an accurate current sector.
In one embodiment, when the inner ring position and the outer ring position are not in the same position range, performing sector adjustment based on the reference sector to obtain the current sector, including:
when the position of the inner ring is in the initial position range and the position of the outer ring is in the end position range, rounding the reference sector, and adjusting the rounded reference sector to the previous sector to obtain the current sector;
when the position of the inner ring is in the range of the end position and the position of the outer ring is in the range of the start position, rounding the reference sector, and adjusting the rounded reference sector to the next sector to obtain the current sector.
Specifically, for example, the position of the inner ring position (1) is in the initial position range of the second outer ring signal period, and the corresponding outer ring position (1) is in the final position range of the first outer ring signal period, the reference sector is assumed to be 1.1, and is 1 after rounding, and the current sector is adjusted to the previous sector, so that the current sector is 0, and the current sector is sector 0, that is, the inner ring completely passes through 0 sectors. Depending on the result of the outer ring position, 0 sectors are correct. The final calculated current position is less than pi/2.
The position of the inner ring position (2) is in the range of the end position of the second outer ring signal period, the corresponding outer ring position (2) is in the range of the start position of the third outer ring signal period, the reference sector is assumed to be 1.9 at this time, the reference sector is 1 after rounding, and the reference sector is adjusted to the subsequent sector, so that the current sector is 2, and the sector where the inner ring is currently 2, namely the inner ring completely passes through 2 sectors. Depending on the result of the outer ring position, 2 sectors are correct. The final calculated current position is greater than pi.
In this embodiment, when the inner ring position is in the initial position range and the outer ring position is in the end position range, the reference sector after rounding is adjusted to the previous sector, that is, to the sector where the outer ring position is located, based on the outer ring position, so as to obtain an accurate current sector; when the position of the inner ring is in the range of the end position and the position of the outer ring is in the range of the start position, the rounded reference sector is adjusted to the next sector, namely the sector where the position of the outer ring is, so that the accurate current sector is obtained.
In one embodiment, determining the current position of the encoder based on the current sector and outer ring positions includes:
determining the product of the current sector and the corresponding position of the sector to obtain a coarse positioning position;
determining the ratio of the outer ring position to the total number of sectors to obtain a fine positioning position; the total number of sectors is the number of signal periods of one inner ring corresponding to the signal periods of the outer ring;
and determining the sum of the coarse positioning position and the fine positioning position to obtain the current position of the encoder.
Specifically, the rough positioning position refers to a position indicated by the inner ring. The fine positioning position is a position indicated by the outer ring. And the current sector indicates which sector is currently located, so the product of the current sector and the corresponding position of the sector is the coarse positioning position. The ratio of the outer ring position to N is the absolute position of the outer ring in the current outer ring signal period. The sum of the coarse positioning position and the fine positioning position is the current position of the encoder.
Taking an example that one inner ring signal period corresponds to 4 outer ring signal periods (sectors):
encoder current position = current sector × pi/2 + position Outer part /4
In this embodiment, by the mutual coordination of the signals of the inner coil and the outer coil, the product of the current sector of the inner ring position and the corresponding position of the sector is obtained, the coarse positioning position is obtained, the ratio of the outer ring position to the total number of sectors is obtained, and the sum of the coarse positioning position and the fine positioning position is obtained, so that the current position of the encoder is obtained, and the position output by the encoder is more accurate.
In one embodiment, a method of encoder calibration includes:
and (a 1) obtaining a to-be-processed position array output by the encoder to be calibrated.
And (a 2) acquiring a reference position array corresponding to the position array to be processed.
And (a 3) determining a compensation error number sequence corresponding to the position number sequence to be processed based on the position number sequence to be processed and the reference position number sequence.
And (a 4) performing fast Fourier transform on the elements in the position array to be processed and the corresponding compensation error array to obtain a frequency spectrum function.
And (a 5) determining a preset number of frequencies with highest duty ratio based on the frequency spectrum function.
Step (a 6), determining a first coefficient set based on a preset number of frequencies with highest duty ratio.
And (a 7) performing sine function fitting on the reference position number sequence, the corresponding compensation error number sequence and the first coefficient set to obtain a function compensation coefficient.
Step (a 8), transmitting function compensation coefficients to the encoder to be calibrated; the function compensation coefficient is used for performing calibration of the encoder to be calibrated.
In this embodiment, the reference position sequence is obtained, the compensation error sequence is determined based on the to-be-processed position sequence and the reference position sequence, the reference position sequence and the compensation error sequence are subjected to fitting processing to obtain the function compensation coefficient, and the function compensation coefficient is sent to the to-be-calibrated encoder, so that the error brought by the to-be-calibrated encoder can be calibrated, and the position accuracy is improved. And moreover, after the encoder is installed, the encoder is only required to be calibrated once, so that the calibration time is greatly shortened, the working efficiency is improved, and the maintenance cost is reduced.
In one embodiment, as shown in fig. 5, a flowchart of an encoder calibration method in another embodiment is applied to an encoder, and includes the following steps:
step 502, obtaining a compensation function, wherein a function compensation coefficient in the compensation function is obtained by fitting a position number sequence to be processed and a corresponding compensation error number sequence; the compensation error number sequence is determined based on the position number sequence to be processed and the reference position number sequence; the position sequence to be processed is output by the encoder; the reference position number array corresponds to the position number array to be processed.
Specifically, the compensation function is stored in advance in the encoder to be calibrated.
Step 504, the current position of the encoder is obtained, and the current position is input into a compensation function to obtain a position compensation value.
Specifically, the known compensation function is 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)
And the coefficients are known, so that x=the current position, and the f (x) value obtained after input is the position compensation value.
Step 506, calibrating the current position based on the position compensation value to obtain the target position.
Specifically, the current position is added with the position compensation value, and the target position corresponding to the current position is obtained.
In this embodiment, the current position is input into the compensation function by obtaining the compensation function, the position compensation value is obtained, the current position is calibrated based on the position compensation value, the target position is obtained, and the position value can be accurately detected.
In one embodiment, the encoder calibration method further comprises: obtaining a normalized parameter value; acquiring a signal obtained when detecting a position; normalizing the signal based on the normalized parameter value to obtain a normalized signal; and calculating based on the normalized signals to obtain the current position.
Wherein the normalized parameter values may be pre-stored in the encoder to be calibrated. The normalized parameter value includes a bias voltage. The normalization parameter value may also comprise a normalization factor.
Specifically, the encoder to be calibrated performs sampling filtering processing on the signals, performs normalization processing on the signals to obtain normalized signals, and obtains the current position based on the normalized signals through calculation.
In this embodiment, the normalized parameter value is obtained, the signal obtained when the position is detected is obtained, normalization processing is performed, and the current position is obtained based on the signal solution after normalization, so that the measurement accuracy of the encoder can be improved.
It should be understood that, although the steps in the flowcharts of fig. 3 and 5 are shown in order as indicated by the arrows, and the steps in steps (a 1) to (a 8) are shown in order as indicated by the numerals, these steps are not necessarily performed in order as indicated by the arrows or numerals. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least a portion of the steps in fig. 3 and 5 may include a plurality of steps or stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the execution of the steps or stages is not necessarily sequential, but may be performed in turn or alternately with at least a portion of the steps or stages in other steps or other steps.
For specific limitations of the encoder calibration means, reference is made to the above limitations of the encoder calibration method, and no further description is given here. The various modules in the encoder calibration apparatus described above may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules can be embedded in the processor in the upper computer in a hardware form or independent from the processor in the upper computer, or can be stored in the memory in the upper computer in a software form, so that the processor can call and execute the operations corresponding to the above modules.
In one embodiment, a host computer is provided, and the host computer may be a terminal device, and an internal structure diagram thereof may be as shown in fig. 6. The upper computer comprises a processor, a memory, a communication interface, a display screen and an input device which are connected through a system bus. Wherein the processor of the upper computer is used for providing computing and control capabilities. The memory of the upper computer comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface of the upper computer is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a method of encoder calibration. The display screen of the upper computer can be a liquid crystal display screen or an electronic ink display screen, and the input device of the upper computer can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the upper computer shell, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 6 is merely a block diagram of a portion of the structure associated with the present application and is not limiting of the upper computer to which the present application is applied, and that a particular upper computer may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a host computer is provided, including a memory and a processor, where the memory stores a computer program, and the processor implements the steps of the method embodiments described above when the processor executes the computer program.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, implements the steps of the method embodiments described above.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer readable storage medium. The processor of the upper computer reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the upper computer executes the steps in the above method embodiments.
Those skilled in the art will appreciate that implementing all or part of the above described methods in accordance with the embodiments may be accomplished by way of a computer program stored in a non-transitory computer readable storage medium, which when executed may comprise the steps of the above described embodiments of the methods. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Stat ic Random Access Memory, SRAM) or dynamic random access memory (Dynami c Random Access Memory, DRAM), and the like.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the claims, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application, or direct or indirect application in other related technical fields are included in the scope of the claims of the present application.

Claims (10)

1. A method of calibrating an encoder, the method comprising:
acquiring a to-be-processed position array output by a to-be-calibrated encoder and a reference position array corresponding to the to-be-processed position array;
determining a compensation error sequence corresponding to the position sequence to be processed based on the position sequence to be processed and the reference position sequence;
fitting the position number sequence to be processed and the corresponding compensation error number sequence to obtain a function compensation coefficient;
transmitting the function compensation coefficient to the encoder to be calibrated; the function compensation coefficient is used for calibrating the encoder to be calibrated.
2. The method according to claim 1, wherein the fitting the position number sequence to be processed and the corresponding compensation error number sequence to obtain a function compensation coefficient includes:
and performing sine function fitting on the position number sequence to be processed and the corresponding compensation error number sequence to obtain a function compensation coefficient.
3. The method according to claim 2, wherein said fitting the sine function to the series of positions to be processed and the corresponding series of compensation errors to obtain a function compensation coefficient comprises:
And performing eighth-order sine function fitting on the position number sequence to be processed and the corresponding compensation error number sequence to obtain a function compensation coefficient.
4. The method of claim 2, wherein the sequence of positions to be processed is output by the encoder to be calibrated by timing sampling during rotation;
performing sine function fitting on the position number sequence to be processed and the corresponding compensation error number sequence to obtain a function compensation coefficient, wherein the method comprises the following steps:
acquiring a first coefficient set; the first coefficient set is determined based on a preset number of frequencies with highest duty ratios; the frequency with the highest preset number of duty ratios is determined based on a frequency spectrum function; the frequency spectrum function is obtained by performing fast Fourier transform on the position array to be processed and the time corresponding to each position to be processed;
and performing sine function fitting on the position number sequence to be processed, the corresponding compensation error number sequence and the first coefficient set to obtain a function compensation coefficient.
5. The method of claim 1, wherein the determining a compensation error array corresponding to the pending location array based on the pending location array and the reference location array comprises:
Performing difference processing based on the position number sequence to be processed and the reference position number sequence to obtain an error number sequence;
averaging the error number sequence to obtain an error average value;
and subtracting the error average value from each element in the error sequence to obtain a compensation error sequence.
6. The method of claim 1, wherein the array of positions to be processed is obtained after a main drag system configured with a photoelectric encoder drives the encoder to be calibrated to rotate at a constant speed.
7. An encoder calibration method, applied to an encoder, the method comprising:
obtaining a compensation function, wherein a function compensation coefficient in the compensation function is obtained by fitting a position number sequence to be processed and a corresponding compensation error number sequence; the compensation error sequence is determined based on the to-be-processed position sequence and a reference position sequence; the position number array to be processed is output by the encoder; the reference position number array corresponds to the position number array to be processed;
acquiring the current position of the encoder, and inputting the current position into the compensation function to obtain a position compensation value;
and calibrating the current position based on the position compensation value to obtain a target position.
8. An encoder calibration device comprising a host computer and an encoder to be calibrated, said device being adapted to implement the steps of the method of any one of claims 1 to 7.
9. A host computer comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, carries out the steps of the method according to any one of claims 1 to 7.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
CN202311577385.3A 2023-11-22 2023-11-22 Encoder calibration method, device, upper computer and storage medium Pending CN117589221A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311577385.3A CN117589221A (en) 2023-11-22 2023-11-22 Encoder calibration method, device, upper computer and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311577385.3A CN117589221A (en) 2023-11-22 2023-11-22 Encoder calibration method, device, upper computer and storage medium

Publications (1)

Publication Number Publication Date
CN117589221A true CN117589221A (en) 2024-02-23

Family

ID=89921434

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311577385.3A Pending CN117589221A (en) 2023-11-22 2023-11-22 Encoder calibration method, device, upper computer and storage medium

Country Status (1)

Country Link
CN (1) CN117589221A (en)

Similar Documents

Publication Publication Date Title
CN110793430B (en) Absolute electrical angle detection method, system and computer readable storage medium
CN107830792B (en) Method for determining the position of a position indicator of a position measuring system
JPH07174586A (en) Method and device for measuring absolute position of movablescale board of incremental position detector
US20200116532A1 (en) Method for Detecting Errors in a Rotating Position Sensor System Having Sine and Cosine Signals
CN104296786B (en) Digital bridge capacitive measuring module
CN102870011B (en) Metal or the detection of magnetic
CN103472414B (en) Magnet sensor arrangement
CN101131329A (en) Correction circuit for coder signal
US11609082B2 (en) Calibration and linearization of position sensor
US11796305B2 (en) Magnetic position sensor system, device, magnet and method
CN103234451B (en) A kind of time gating angular displacement sensor system and method realizing online self-calibration
CN110375694A (en) Method for self-calibrating based on portable articulated coordinate machine Circular gratings angle error
CN109696187B (en) Eccentric correcting device of rotary encoder
JP2008058252A (en) Correction circuit of encoder signal
CN106989762B (en) Encoder
CN115824032A (en) Correction method and device of magnetic encoder and magnetic encoder
EP3705902B1 (en) Method of determining an absolute angle of a magnetic field
CN105571666B (en) Flow-compensated method and compensation device, flow sensor
CN117589221A (en) Encoder calibration method, device, upper computer and storage medium
JPH0496130A (en) Signal calibrating device
CN109164342B (en) Method and device for diagnosing open-circuit fault of three-phase inverter and electronic equipment
CN115950345A (en) Measurement data processor, position measurement device and computer-implemented method
JPH0496131A (en) Signal calibrating device
CN104006781B (en) The computational methods of surface normal vector certainty of measurement
CN117589206A (en) Encoder position processing method, encoder, and computer-readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination