CN108959183B - Forward interpolation method for angle sensor and rotary encoder - Google Patents

Forward interpolation method for angle sensor and rotary encoder Download PDF

Info

Publication number
CN108959183B
CN108959183B CN201810568513.0A CN201810568513A CN108959183B CN 108959183 B CN108959183 B CN 108959183B CN 201810568513 A CN201810568513 A CN 201810568513A CN 108959183 B CN108959183 B CN 108959183B
Authority
CN
China
Prior art keywords
interpolation
data
sampling
angle
time
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.)
Active
Application number
CN201810568513.0A
Other languages
Chinese (zh)
Other versions
CN108959183A (en
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.)
Shanghai Magntek Microelectronics Inc
Original Assignee
Shanghai Magntek Microelectronics Inc
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 Shanghai Magntek Microelectronics Inc filed Critical Shanghai Magntek Microelectronics Inc
Priority to CN201810568513.0A priority Critical patent/CN108959183B/en
Publication of CN108959183A publication Critical patent/CN108959183A/en
Application granted granted Critical
Publication of CN108959183B publication Critical patent/CN108959183B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/17Function evaluation by approximation methods, e.g. inter- or extrapolation, smoothing, least mean square method
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Abstract

The invention discloses a forward interpolation method of an angle sensor and a rotary encoder, which is characterized in that the angle of a current mechanical structure is pre-judged before the sampling output of the next sensor; according to different application scenes and the requirements of prediction precision, selecting the outputs of different numbers of sampling inductors as the input conditions of an interpolation algorithm; when two sampling outputs are used as interpolation base values, the uniform accelerated motion is simplified into the uniform motion. The forward interpolation method of the angle sensor and the rotary encoder effectively breaks through the limitation of a low-speed sampling sensing unit, greatly improves the effective data refreshing of the angle sensor and the rotary encoder, and provides the real-time angle information of the rotor in time. The algorithm avoids high-frequency noise caused by errors of interpolation prediction and actual sampling results, and enables output to be smoother.

Description

Forward interpolation method for angle sensor and rotary encoder
Technical Field
The invention belongs to the technical field of semiconductors, relates to an angle sensor and a rotary encoder, and particularly relates to a forward interpolation method of the angle sensor and the rotary encoder based on a discrete rotation inertia principle.
Background
Angle sensors and rotary encoders are important carriers for measuring angular information during rotation of various mechanical structures. At present, it is widely used in various fields such as industrial equipment control automobiles, smart homes, smart multimedia devices, internet of things, and the like.
In the current mainstream sensing elements (such as hall sensor type, magnetoresistive sensor type, electromagnetic induction sensor type, etc.), the angle determination method mainly obtains the current angular position of the device according to the direction and strength of the magnetic field.
Due to the increasing requirements for precision and real-time performance of angle information in practical application scenarios, sensors are required to provide more accurate angle information more quickly. The current sensor sampling induction part does not meet the high precision and real-time requirement.
In view of the above, there is an urgent need to design a new angle information acquisition method to overcome the above-mentioned defects of the existing angle acquisition method.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: the forward interpolation method of the angle sensor and the rotary encoder is provided, so that the effective data refreshing of the angle sensor and the rotary encoder can be improved, and the real-time angle information of a rotor can be provided in time; high frequency noise caused by errors of interpolation prediction and actual sampling results is avoided, and output is smoother.
In order to solve the technical problems, the invention adopts the following technical scheme:
a forward interpolation method of an angle sensor and a rotary encoder is used for predicting angle change of an object in a later period of time by utilizing angle information of the object at a known moment; the method comprises the following steps:
assuming that the rigid body rotation follows the principle of uniform acceleration motion in a short time according to the inertia theorem of the rigid body motion;
calculating on the basis of the angle position information obtained at the latest sampling moments to obtain the angular velocity and the angular acceleration value of the predicted initial position;
and carrying out forward interpolation prediction calculation under the requirement of output frequency according to the angle information, the angular velocity information and the angular acceleration information of the initial position.
The method comprises the following specific steps:
step S1, judging whether the rigid body rotates; when the rigid body rotates at an angle, according to the inertia principle of rotation, between two adjacent sampling points, because the time is short, the motion is supposed to follow the uniform angular acceleration; namely:
β (t) ═ β (0) + α × t formula (1)
Then, the amount of change in angle within time t can be calculated:
Figure GDA0003631320230000021
θ(t)=θ(0)+β(0)*t+α*t2/2 formula (3)
Under the scene of high data refresh rate, forward interpolation calculation is carried out by using the formula as a prediction, the refresh frequency of data is increased, and higher precision is kept;
at the moment when the sampling induction device outputs effective data for updating, in order to avoid instantaneous angle mutation caused by errors between interpolation calculation and a real induction result, high-frequency noise is filtered by adopting a mode of firstly outputting an interpolation calculation result and then carrying out superposition compensation in a subsequent sampling induction period;
step S2, according to the principle of formula (3), before the next sensor is sampled and output, the angle of the current mechanical structure is pre-judged; according to different application scenes and the requirements of prediction precision, selecting the outputs of different numbers of sampling inductors as the input conditions of an interpolation algorithm; the number is at least two points and at most any number of points; when two sampling outputs are adopted as interpolation base values, the uniform acceleration motion is simplified into uniform motion;
taking the example of selecting three sampling output data to perform interpolation operation, the angular positions sampled at the first three sampling times are: theta01And theta2
And assuming that the rotation of the rigid body from position 0 to position 2 follows the principle of inertia, i.e. uniform angular acceleration, and the initial angular velocity at position 0 is β0Then the following equation is obtained:
θ10=β0*t+α*t2formula/2 (4)
θ21=β1*t+α*t2/2=β0*t+3α*t2Formula/2 (5)
The relationship between the values of the initial angular velocity and angular acceleration and the sampled angle is easily deduced according to equations (4) and (5):
Figure GDA0003631320230000022
Figure GDA0003631320230000031
based on the initial angle and angular acceleration and the predicted initial angular position θ2Estimating the current angle position; because of the adoption of discretized data output, the current position is theta2The time of the position is delayed by nt/m, so the result is obtained after substituting the formula:
Figure GDA0003631320230000032
in a digital system implementing this algorithm, 3 sets of the latest sample data need to be saved for calculation; and when each new sampling data comes, refreshing the data-holding register in time to generate a new forward interpolation output;
counting by using a high-frequency clock, and generating a signal n required by calculation by using timing overflow interruption accumulation; the signal m comes from the multiple relation between the sensing sampling output frequency and the frequency of the digital signal high-frequency signal; in order to adapt to different application scenes and different sensing sampling rates, a register configuration method is adopted in the implementation to generate different data refreshing periods and sensing sampling frequencies, and then different m values are generated;
when the new angle signal is transmitted in the period, refreshing the data buffer register group; storing the latest angle into a second cache data register, and storing second cache data stored in the original second cache data register into a first cache data register; similarly, the first cache data stored in the original first cache data register is stored in the zeroth cache data register to finish the synchronous refreshing of the three registers;
step S3, under the condition that the number of the input data points is judged to be more than or equal to 4 through interpolation, an average filtering algorithm is adopted to filter out errors caused by the noise of the signal; calculating the data of every three adjacent time nodes to obtain the angular velocity; then multiplying by weight, considering that the closer data is higher in fidelity, the maximum weight is obtained, and the earlier data is obtained with smaller weight; finally, adding all the weighted angular velocities to obtain the angular velocity used for the final interpolation calculation; the weighted mean filtering method for the angular acceleration is completely consistent with the angular velocity filtering mode;
step S4, when the current interpolation reaches the time of refreshing the node of the last data of a signal sampling period, if the signal obtained by sampling is directly output, instantaneous sudden change of the signal caused by interpolation prediction deviation can be caused, and high-frequency noise is introduced; in the algorithm system, in order to avoid the problem of abrupt change of angle output caused by the noise to the system, the following method is adopted:
first, the value predicted by the interpolation calculation is output as an effective value at this timing;
then, comparing the result of interpolation prediction with the result of actual signal sampling to obtain a difference value;
finally, the difference is evenly distributed to m points in the following sampling period for progressive accumulation;
therefore, high-frequency noise is successfully filtered, and finally, the error of interpolation prediction is compensated to an angle output value.
At time 1, the sampling sensing unit has output data θ1And in the interpolation output calculation, the data theta at the time 0 is used0And the predicted value of the previous data obtaining time 1 is theta1_pre. Then, according to the present algorithm, the effective data actually output at time 1 is θ1_pre(ii) a The base point of the forward interpolation for data after time 1 is also θ1_pre. Meanwhile, in order to compensate for the prediction error at time 1, a compensation value is superimposed on the nth interpolation point after time 1:
Dcomp(n)=n*(θ1–θ1_pre)/m
the final interpolated signal is then:
Figure GDA0003631320230000041
in a preferred embodiment of the present invention, in step S3, the mean filtering algorithm is a weighted average mean filtering algorithm.
A forward interpolation method of an angle sensor and a rotary encoder is used for predicting angle change of an object in a later period of time by utilizing angle information of the object at a known moment; the method comprises the following steps:
step S1, according to the inertia theorem of rigid body motion, assuming that the rigid body rotation follows the principle of uniform acceleration motion in a short time, the relation between the angular position, the angular velocity and the angular acceleration can be calculated;
step S2, calculating on the basis of the angle position information obtained at the latest sampling moments to obtain the angular velocity and the angular acceleration value of the predicted initial position;
and step S3, performing forward interpolation prediction calculation according to the angle information and the angular velocity information of the initial position and the angular acceleration information under the requirement of output frequency.
As a preferable aspect of the present invention, the step S1 specifically includes:
according to the inertia principle of rigid body rotation, the motion of the rigid body is carried out according to the uniform angular acceleration rule in a short period of time; given that angular velocity β and angular acceleration α, as well as angular position θ, are both functions that vary over time t, the equation for the uniform angular acceleration motion can be expressed as:
β (t) ═ β (0) + α ═ t formula (1)
Then, the amount of change in angle within time t can be calculated:
Figure GDA0003631320230000042
θ(t)=θ(0)+β(0)*t+α*t2formula/2 (3)
Under the scene of high-speed data refresh rate, forward interpolation calculation is carried out by taking the forward interpolation as a prediction formula, the refresh frequency of data is increased, and higher precision is kept;
at the moment when the sampling induction device outputs effective data for updating, in order to avoid instantaneous angle mutation caused by errors between interpolation calculation and a real induction result, high-frequency noise is filtered by adopting a mode of firstly outputting an interpolation calculation result and then carrying out superposition compensation in a subsequent sampling induction period;
as a preferable embodiment of the present invention, the step S2 specifically includes:
according to the principle of the formula (3), before the sampling output of the next sensor, the angle of the current mechanical structure is judged in advance; according to different application scenes and the requirements of prediction precision, selecting the outputs of different numbers of sampling inductors as the input conditions of an interpolation algorithm; the number is at least two points and at most any number of points; when two sampling outputs are adopted as interpolation base values, the uniform accelerated motion is simplified into the uniform motion;
taking the example of selecting three sampling output data to perform interpolation operation, the angular positions sampled at the first three sampling times are: theta01And theta2
And assuming that the rotation of the rigid body from position 0 to position 2 follows the principle of inertia, i.e. uniform angular acceleration, and the initial angular velocity at position 0 is β0Then the following equation is obtained:
θ10=β0*t+α*t2formula/2 (4)
θ21=β1*t+α*t2/2=β0*t+3α*t2Formula/2 (5)
The relationship between the values of the initial angular velocity and angular acceleration and the sampled angle is easily deduced according to equations (4) and (5):
Figure GDA0003631320230000051
Figure GDA0003631320230000052
based on the initial angle and angular acceleration and the predicted initial angular position θ2Estimating the current angle position; because of the adoption of discretized data output, the current position is theta2The time of the position is delayed by nt/m, so the angle position of the time of nt/m is obtained by substituting the formula:
Figure GDA0003631320230000053
in a digital system implementing this algorithm, 3 sets of the latest sample data need to be saved for calculation; and when each new sampling data arrives, refreshing the data-holding register in time to generate a new forward interpolation output;
counting by using a high-frequency clock, and generating a signal n required by calculation by using timing overflow interruption accumulation; the signal m comes from the multiple relation between the sensing sampling output frequency and the frequency of the digital signal high-frequency signal; in order to adapt to different application scenes and different sensing sampling rates, a register configuration method is adopted in the implementation to generate different data refreshing periods and sensing sampling frequencies, and then different m values are generated;
when a new angle signal is transmitted in the period, refreshing the data cache register group; storing the latest angle into a second cache data register, and storing second cache data stored in the original second cache data register into a first cache data register; similarly, the first cache data stored in the original first cache data register is stored in the zeroth cache data register to finish synchronous refreshing of the three registers.
As a preferable embodiment of the present invention, the step S3 specifically includes:
step S31, under the condition that the number of the input data points is judged to be more than or equal to 4 through interpolation, an average filtering algorithm is adopted to filter out errors caused by the noise of the signal; calculating the data of every three adjacent time nodes to obtain the angular velocity; then multiplying by weight, considering that the closer data is higher in fidelity, the maximum weight is obtained, and the earlier data is obtained with smaller weight; finally, adding all the weighted angular velocities to obtain the angular velocity used by the final interpolation calculation; the weighted mean filtering method for the angular acceleration is completely consistent with the angular velocity filtering mode;
as a preferable embodiment of the present invention, the step S3 specifically includes:
step S32, when the current interpolation reaches the time (n ═ m) of the last data refresh node of a signal sampling period, if the signal obtained by sampling is directly output, instantaneous sudden change of the signal due to interpolation prediction deviation will be caused, and high-frequency noise is introduced; in the algorithm system, in order to avoid the problem of abrupt change of angle output caused by the noise to the system, the following method is adopted:
first, the value predicted by the interpolation calculation is output as an effective value at this timing;
then, comparing the result of interpolation prediction with the result of actual signal sampling to obtain a difference value;
finally, the difference is evenly distributed to m points in the following sampling period for progressive accumulation;
therefore, high-frequency noise is successfully filtered, and the error of interpolation prediction is finally compensated to an angle output value;
at time 1, the sampling sensing unit has output data theta1And in the interpolation output calculation, the data theta is calculated according to the time 00And the predicted value of the previous data obtaining time 1 is theta1_pre. Then, according to the present algorithm, the valid data actually output at time 1 is θ1_pre(ii) a The base point for the forward interpolation of data after time 1 is also θ1_pre. Meanwhile, in order to compensate for the prediction error at time 1, a compensation value is superimposed on the nth interpolation point after time 1:
Dcomp(n)=n*(θ1–θ1_pre)/m
the final interpolated signal is then:
Figure GDA0003631320230000061
in a preferred embodiment of the present invention, in step S31, the mean filtering algorithm is a weighted average mean filtering algorithm.
The invention has the beneficial effects that: the forward interpolation method of the angle sensor and the rotary encoder based on the discrete rotation inertia principle effectively breaks through the limitation of a low-speed sampling sensing unit, greatly improves the effective data refreshing of the angle sensor and the rotary encoder, and provides the real-time angle information of the rotor in time. The algorithm avoids high-frequency noise caused by errors of interpolation prediction and actual sampling results, and enables output to be smoother.
Drawings
Fig. 1 is a timing diagram of an output rate higher than a sampling rate.
Fig. 2 is a schematic view of the change of angular rotation.
Fig. 3 is a block diagram of the digital circuit implementation algorithm.
Fig. 4 is a weighted mean filtering method for angular velocity and angular acceleration, which performs interpolation calculation on more than four sample data.
Fig. 5 is a schematic diagram of a method for filtering out high-frequency noise generated due to prediction error.
Detailed Description
Preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
Example one
Referring to fig. 1, the present invention discloses a forward interpolation method for an angle sensor and a rotary encoder based on the principle of discrete rotational inertia, which is used to predict the angle change of an object in a later period of time by using the angle information of the object at a known moment. The method comprises the following steps: assuming that the rigid body rotation follows the principle of uniform acceleration in a short time according to the theorem of inertia of rigid body motion (corresponding to step S1 below); calculating based on the angular position information obtained at the latest several sampling times to obtain the angular velocity and the angular acceleration value of the predicted start position (corresponding to step S2 below); based on the angular information of the start position, the angular velocity information, and the angular acceleration information, a forward interpolation prediction calculation is performed in response to the output frequency (corresponding to steps S3 and S4 below).
The method specifically comprises the following steps:
step S1, judging whether the rigid body rotates; when the rigid body rotates at an angle, according to the inertia principle of rotation, between two adjacent sampling points, because the time is short, the motion is supposed to follow the uniform angular acceleration; namely:
β (t) ═ β (0) + α ═ t formula (1)
Then, the amount of change in angle within time t can be calculated:
Figure GDA0003631320230000081
θ(t)=θ(0)+β(0)*t+α*t2formula/2 (3)
Under the scene of high-speed data refresh rate, forward interpolation calculation is carried out by taking the forward interpolation as a prediction formula, the refresh frequency of data is increased, and higher precision is kept;
at the moment when the sampling induction device outputs effective data for updating, in order to avoid instantaneous angle mutation caused by errors between interpolation calculation and a real induction result, high-frequency noise is filtered by adopting a mode of firstly outputting an interpolation calculation result and then carrying out superposition compensation in a subsequent sampling induction period;
step S2, according to the principle of the formula (3), before the sampling output of the next sensor, the angle of the current mechanical structure is judged in advance; according to different application scenes and the requirements of prediction precision, selecting the outputs of different numbers of sampling inductors as the input conditions of an interpolation algorithm; the number is at least two points and at most any number of points; when two sampling outputs are adopted as interpolation base values, the uniform acceleration motion is simplified into uniform motion;
here, taking the example of selecting three sampling output data to perform interpolation operation (of course, other numbers are possible), the angular positions sampled at the first three sampling times are: theta01And theta2
And assuming that the rotation of the rigid body from position 0 to position 2 follows the principle of inertia, i.e. uniform angular acceleration, and the initial angular velocity at position 0 is β0Then the following equation is obtained:
θ10=β0*t+α*t2formula/2 (4)
θ21=β1*t+α*t2/2=β0*t+3α*t2Formula/2 (5)
The relationship between the values of the initial angular velocity and angular acceleration and the sampled angle is easily deduced according to equations (4) and (5):
Figure GDA0003631320230000082
Figure GDA0003631320230000083
based on the initial angle and angular acceleration and the predicted initial angular position θ2Estimating the current angle position; because of the adoption of discretized data output, the current position is theta2The time of the position is delayed by nt/m, so the result is obtained after substituting the formula:
Figure GDA0003631320230000084
in a digital system implementing this algorithm, 3 sets of the latest sample data need to be saved for calculation; and when each new sampling data comes, refreshing the data-holding register in time to generate a new forward interpolation output;
counting by using a high-frequency clock, and generating a signal n required by calculation by using timing overflow interruption accumulation; the signal m comes from the multiple relation between the sensing sampling output frequency and the frequency of the digital signal high-frequency signal; in order to adapt to different application scenes and different sensing sampling rates, a register configuration method is adopted in the implementation to generate different data refreshing periods and sensing sampling frequencies, and then different m values are generated.
When the new angle signal is transmitted in the period, refreshing the data buffer register group; storing the latest angle into a second cache data register, and storing second cache data stored in the original second cache data register into a first cache data register; similarly, the first cache data stored in the original first cache data register is stored in the zeroth cache data register to complete synchronous refreshing of the three registers.
Step S3, under the condition that the number of the input data points is judged to be more than or equal to 4 through interpolation, a mean value filtering algorithm (for example, weighted average mean value filtering) is adopted to filter errors caused by the noise of the signal per se; calculating every three adjacent time node data to obtain angular velocity; then multiplying by weight, considering that the closer data is higher in fidelity, the maximum weight is obtained, and the earlier data is obtained with smaller weight; finally, adding all the weighted angular velocities to obtain the angular velocity used for the final interpolation calculation; the weighted mean filtering method for angular acceleration is completely consistent with the angular velocity filtering method.
Step S4, when the current interpolation reaches the time (n ═ m) of the last data refresh node of one signal sampling period, if the signal obtained by sampling is directly output, instantaneous sudden change of the signal due to interpolation prediction deviation is caused, so that high-frequency noise is introduced; in the algorithm system, in order to avoid the problem of abrupt change of the angle output caused by the noise to the system, the following method is adopted in the embodiment:
first, the value predicted by the interpolation calculation is output as an effective value at this timing;
then, comparing the result of interpolation prediction with the result of actual signal sampling to obtain a difference value;
finally, the difference is averagely distributed to m points in the following sampling period to be accumulated in a progressive mode;
therefore, high-frequency noise is successfully filtered, and finally, the error of interpolation prediction is compensated to an angle output value.
At time 1, the sampling sensing unit has output data θ1And in the interpolation output calculation, the data theta is calculated according to the time 00And the predicted value of the previous data obtaining time 1 is theta1_pre. Then, according to the present algorithm, the effective data actually output at time 1 is θ1_pre(ii) a The base point of the forward interpolation for data after time 1 is also θ1_pre. Meanwhile, in order to compensate for the prediction error at time 1, a compensation value is superimposed on the nth interpolation point after time 1:
Dcomp(n)=n*(θ1–θ1_pre)/m
the final interpolated signal is then:
Figure GDA0003631320230000101
example two
The present embodiment is different from the first embodiment in that, in the present embodiment, the present invention discloses a forward interpolation method for an angle sensor and a rotary encoder based on the principle of discrete rotational inertia, which is used to realize the prediction of the angle change of an object in a later period of time by using the angle information of the object at a known time. The method comprises the following steps: assuming that the rigid body rotation follows the principle of uniform acceleration motion in a short time according to the inertia theorem of the rigid body motion; calculating on the basis of the angle position information obtained at the latest sampling moments to obtain the angular velocity and the angular acceleration value of the predicted initial position; and carrying out forward interpolation prediction calculation under the requirement of output frequency according to the angle information, the angular velocity information and the angular acceleration information of the initial position.
In conclusion, the forward interpolation method of the angle sensor and the rotary encoder based on the discrete rotation inertia principle effectively breaks through the limitation of a low-speed sampling sensing unit, greatly improves the effective data refreshing of the angle sensor and the rotary encoder, and provides the real-time angle information of the rotor in time. The algorithm avoids high-frequency noise caused by errors of interpolation prediction and actual sampling results, and enables output to be smoother.
The description and applications of the invention herein are illustrative and are not intended to limit the scope of the invention to the embodiments described above. Variations and modifications of the embodiments disclosed herein are possible, and alternative and equivalent various components of the embodiments will be apparent to those skilled in the art. It will be clear to those skilled in the art that the present invention may be embodied in other forms, structures, arrangements, proportions, and with other components, materials, and parts, without departing from the spirit or essential characteristics thereof. Other variations and modifications of the embodiments disclosed herein may be made without departing from the scope and spirit of the invention.

Claims (5)

1. A forward interpolation method of an angle sensor and a rotary encoder is characterized in that the method is used for predicting the angle change of an object in a later period of time by using the angle information of the object at the known moment; the method comprises the following steps:
according to the inertia theorem of rigid body motion, assuming that the rigid body rotation follows the principle of uniform acceleration motion in a short time, calculating the relation between the angular position and the angular velocity as well as the angular acceleration;
calculating on the basis of the angle position information obtained at the latest sampling moments to obtain the angular velocity and the angular acceleration value of the predicted initial position;
according to the angle information, the angular velocity information and the angular acceleration information of the initial position, carrying out forward interpolation prediction calculation under the requirement of output frequency;
the method comprises the following specific steps:
step S1, according to the inertia principle of rigid rotation, in a short period of time, the rigid motion follows the uniform angular acceleration rule; given that angular velocity β and angular acceleration α, as well as angular position θ, are both functions that vary over time t, the equation for the uniform angular acceleration motion can be expressed as:
β (t) ═ β (0) + α ═ t formula (1)
Then, the amount of change in angle within time t can be calculated:
Figure FDA0003631320220000011
θ(t)=θ(0)+β(0)*t+α*t2formula/2 (3)
Under the scene of high-speed data refresh rate, forward interpolation calculation is carried out by taking the forward interpolation as a prediction formula, the refresh frequency of data is increased, and higher precision is kept;
at the moment when the sampling induction device outputs effective data for updating, in order to avoid instantaneous angle mutation caused by errors between interpolation calculation and a real induction result, high-frequency noise is filtered by adopting a mode of firstly outputting an interpolation calculation result and then carrying out superposition compensation in a subsequent sampling induction period;
step S2, according to the principle of formula (3), before the next sensor is sampled and output, the angle of the current mechanical structure is pre-judged; according to different application scenes and the requirements of prediction precision, selecting the outputs of different numbers of sampling inductors as the input conditions of an interpolation algorithm; the number is at least two points and at most any number of points; when two sampling outputs are adopted as interpolation base values, the uniform acceleration motion is simplified into uniform motion;
three sampling output data are selected for interpolation operation, and the angle positions sampled at the first three sampling moments are respectively as follows: theta01And theta2
And assuming that the rotation of the rigid body from position 0 to position 2 follows the principle of inertia, i.e. uniform angular acceleration, and the initial angular velocity at position 0 is β0Then the following equation is obtained:
θ10=β0*t+α*t2formula/2 (4)
θ21=β1*t+α*t2/2=β0*t+3α*t2Formula/2 (5)
The relationship between the values of the initial angular velocity and angular acceleration and the sampled angle is easily deduced according to equations (4) and (5):
Figure FDA0003631320220000021
Figure FDA0003631320220000022
based on the initial angle and angular acceleration and the predicted initial angular position θ2Estimating the current angle position; because of the adoption of discretized data output, the current position is theta2The time of the position is delayed by nt/m, so the angle position of the time of nt/m is obtained by substituting the formula:
Figure FDA0003631320220000023
in a digital system implementing this algorithm, 3 sets of the latest sample data need to be saved for calculation; and when each new sampling data comes, refreshing the data-holding register in time to generate a new forward interpolation output;
counting by using a high-frequency clock, and generating a signal n required by calculation by using timing overflow interruption accumulation; the signal m comes from the multiple relation between the sensing sampling output frequency and the frequency of the digital signal high-frequency signal; in order to adapt to different application scenes and different sensing sampling rates, a register configuration method is adopted in implementation to generate different data refreshing periods and sensing sampling frequencies, and then different m values are generated;
when a new angle signal is transmitted in the period, refreshing the data cache register group; storing the latest angle into a second cache data register, and storing second cache data stored in the original second cache data register into a first cache data register; similarly, the first cache data stored in the original first cache data register is stored in the zeroth cache data register to finish the synchronous refreshing of the three registers;
s3, under the condition that the number of the input data points is judged to be more than or equal to 4 through interpolation, a mean value filtering algorithm is adopted to filter out errors caused by noise of the signal, and the mean value filtering algorithm is a weighted average value filtering algorithm; calculating the data of every three adjacent time nodes to obtain the angular velocity; then multiplying by weight, considering that the more recent data has higher verisimilitude, the maximum weight is obtained, and the earlier data has smaller weight; finally, adding all the weighted angular velocities to obtain the angular velocity used for the final interpolation calculation; the weighted mean filtering method for the angular acceleration is completely consistent with the angular velocity filtering mode;
step S4, when the current interpolation reaches the time of refreshing the node of the last data of a signal sampling period, if the signal obtained by sampling is directly output, instantaneous sudden change of the signal caused by interpolation prediction deviation can be caused, and high-frequency noise is introduced; in the algorithm system, in order to avoid the problem of abrupt change of angle output caused by the noise to the system, the following method is adopted:
first, the value predicted by the interpolation calculation is output as an effective value at this timing;
then, comparing the result of interpolation prediction with the result of actual signal sampling to obtain a difference value;
finally, the difference is evenly distributed to m points in the following sampling period for progressive accumulation;
therefore, high-frequency noise is successfully filtered, and the error of interpolation prediction is finally compensated to an angle output value;
at time 1, the sampling sensing unit has output data theta1And in the interpolation output calculation, the data theta is calculated according to the time 00And the predicted value of the previous data obtaining time 1 is theta1_pre(ii) a Then, according to the present algorithm, the valid data actually output at time 1 is θ1_pre(ii) a The base point for the forward interpolation of data after time 1 is also θ1_pre(ii) a Meanwhile, in order to compensate for the prediction error at time 1, a compensation value is superimposed on the nth interpolation point after time 1:
Dcomp(n)=n*(θ1–θ1_pre)/m
the final interpolated signal is then:
Figure FDA0003631320220000031
2. a forward interpolation method of an angle sensor and a rotary encoder is characterized in that the method is used for predicting the angle change of an object in a later period of time by using the angle information of the object at the known moment; the method comprises the following steps:
step S1, according to the inertia theorem of rigid body motion, supposing that the rigid body rotation follows the principle of uniform acceleration motion in a short time, calculating the relation between the angular position, the angular velocity and the angular acceleration;
step S2, calculating on the basis of the angle position information obtained at the latest sampling moments to obtain the angular velocity and the angular acceleration value of the predicted initial position;
step S3, according to the angle information of the initial position, the angular velocity information and the angular acceleration information, carrying out forward interpolation prediction calculation under the requirement of output frequency;
the step S3 includes: when the forward interpolation reaches the time of refreshing a node by the last data of a signal sampling period, if the signal obtained by sampling is directly output, instantaneous sudden change of the signal caused by interpolation prediction deviation can be caused, so that high-frequency noise is introduced; in order to avoid the problem of abrupt change of the angle output of the system caused by the noise, the method comprises the following steps:
first, the value predicted by the interpolation calculation is output as an effective value at this time;
then, comparing the result of interpolation prediction with the result of actual signal sampling to obtain a difference value;
finally, the difference is evenly distributed to m points in the following sampling period for progressive accumulation;
therefore, high-frequency noise is successfully filtered, and the error of interpolation prediction is finally compensated to an angle output value;
at time 1, the sampling sensing unit has output dataθ1And in the interpolation output calculation, the data theta is calculated according to the time 00And the predicted value of the previous data obtaining time 1 is theta1_pre(ii) a Then, according to the present algorithm, the valid data actually output at time 1 is θ1_pre(ii) a The base point of the forward interpolation for data after time 1 is also θ1_pre(ii) a Meanwhile, in order to compensate for the prediction error at time 1, a compensation value is superimposed on the nth interpolation point after time 1:
Dcomp(n)=n*(θ1–θ1_pre)/m
the final interpolated signal is then:
Figure FDA0003631320220000041
3. the method of forward interpolation of an angle sensor and a rotary encoder according to claim 2, wherein:
the step S1 specifically includes:
according to the inertia principle of rigid body rotation, in a short period of time, the motion of the rigid body follows the uniform angular acceleration rule; given that angular velocity β and angular acceleration α, as well as angular position θ, are both functions that vary over time t, the equation for the uniform angular acceleration motion can be expressed as:
β (t) ═ β (0) + α ═ t formula (1)
Then, the amount of change in angle within time t can be calculated:
Figure FDA0003631320220000042
θ(t)=θ(0)+β(0)*t+α*t2formula/2 (3)
Under the scene of high-speed data refresh rate, forward interpolation calculation is carried out by taking the forward interpolation as a prediction formula, the refresh frequency of data is increased, and higher precision is kept;
at the moment when the sampling induction device outputs effective data for updating, in order to avoid instantaneous angle mutation caused by errors between interpolation calculation and a real induction result, high-frequency noise is filtered by adopting a mode of firstly outputting an interpolation calculation result and then carrying out superposition compensation in a subsequent sampling induction period.
4. The method of forward interpolation of an angle sensor and a rotary encoder according to claim 2, wherein:
the step S2 specifically includes:
according to the principle of the formula (3), before the sampling output of the next sensor, the angle of the current mechanical structure is judged in advance; according to different application scenes and the requirements of prediction precision, selecting the outputs of different numbers of sampling inductors as the input conditions of an interpolation algorithm; the number is at least two points and at most any number of points; when two sampling outputs are adopted as interpolation base values, the uniform acceleration motion is simplified into uniform motion;
three sampling output data are selected for interpolation operation, and the angle positions sampled at the first three sampling moments are respectively as follows: theta01And theta2
And assuming that the rotation of the rigid body from position 0 to position 2 follows the principle of inertia, i.e. uniform angular acceleration, and the initial angular velocity at position 0 is β0Then the following equation is obtained:
θ10=β0*t+α*t2formula/2 (4)
θ21=β1*t+α*t2/2=β0*t+3α*t2Formula/2 (5)
The relationship between the values of the initial angular velocity and angular acceleration and the sampled angle is easily deduced according to equations (4) and (5):
Figure FDA0003631320220000051
Figure FDA0003631320220000052
based on the initial angle and angular acceleration and the predicted initial angular position θ2Estimating the current angle position; because of the adoption of discretized data output, the current position is theta2The time of the position is delayed by nt/m, so the angle position of the time of nt/m is obtained by substituting the formula:
Figure FDA0003631320220000053
in a digital system implementing this algorithm, 3 sets of the latest sample data need to be saved for calculation; and when each new sampling data arrives, refreshing the data-holding register in time to generate a new forward interpolation output;
counting by using a high-frequency clock, and generating a signal n required by calculation by using timing overflow interruption accumulation; the signal m comes from the multiple relation between the sensing sampling output frequency and the frequency of the digital signal high-frequency signal; in order to adapt to different application scenes and different sensing sampling rates, a register configuration method is adopted in the implementation to generate different data refreshing periods and sensing sampling frequencies, and then different m values are generated;
when the new angle signal is transmitted in the period, refreshing the data buffer register group; storing the latest angle into a second cache data register, and storing second cache data stored in the original second cache data register into a first cache data register; similarly, the first cache data stored in the original first cache data register is stored in the zeroth cache data register to finish synchronous refreshing of the three registers.
5. The method of forward interpolation of an angle sensor and a rotary encoder according to claim 2, wherein:
the step S3 specifically includes:
step S31, under the condition that the number of the input data points is judged to be more than or equal to 4 through interpolation, an average filtering algorithm is adopted to filter out errors caused by the noise of the signal; calculating the data of every three adjacent time nodes to obtain the angular velocity; then multiplying by weight, considering that the closer data is higher in fidelity, the maximum weight is obtained, and the earlier data is obtained with smaller weight; finally, adding all the weighted angular velocities to obtain the angular velocity used for the final interpolation calculation; the weighted mean filtering method for angular acceleration is completely consistent with the angular velocity filtering method.
CN201810568513.0A 2018-06-05 2018-06-05 Forward interpolation method for angle sensor and rotary encoder Active CN108959183B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810568513.0A CN108959183B (en) 2018-06-05 2018-06-05 Forward interpolation method for angle sensor and rotary encoder

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810568513.0A CN108959183B (en) 2018-06-05 2018-06-05 Forward interpolation method for angle sensor and rotary encoder

Publications (2)

Publication Number Publication Date
CN108959183A CN108959183A (en) 2018-12-07
CN108959183B true CN108959183B (en) 2022-07-12

Family

ID=64493695

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810568513.0A Active CN108959183B (en) 2018-06-05 2018-06-05 Forward interpolation method for angle sensor and rotary encoder

Country Status (1)

Country Link
CN (1) CN108959183B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110154558B (en) * 2019-06-04 2020-11-10 深圳市汉森软件有限公司 Printing precision correction method, system, device and storage medium
CN110557626B (en) * 2019-07-31 2021-06-08 华为技术有限公司 Image display method and electronic equipment
CN110274615A (en) * 2019-08-08 2019-09-24 成都芯进电子有限公司 The circuit and method of incremental encoding ABZ output accuracy are improved in a kind of magnetic angle encoder
CN111781546B (en) * 2020-04-20 2023-04-07 麦歌恩电子(上海)有限公司 Background calibration method and system for eliminating nonidealities of two paths of mutually orthogonal signals
CN112600939B (en) * 2020-12-31 2022-01-18 心科(上海)网络科技有限公司 Monitor control information detection method, system, server and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4467625B2 (en) * 2008-03-31 2010-05-26 三菱電機株式会社 Numerical control apparatus and numerical control method
US8521428B1 (en) * 2009-10-15 2013-08-27 Moog Inc. Heading determination using sensors mounted on rotatable assembly
CN104796051B (en) * 2015-04-17 2017-08-01 天津大学 Rotary transformer linear transformation method and converter based on FPGA
CN106842248A (en) * 2016-11-23 2017-06-13 西安电子科技大学昆山创新研究院 A kind of new method for improving Beidou receiver timing locating speed
CN106685302B (en) * 2017-01-17 2019-01-29 株洲易力达机电有限公司 A kind of Hall-type position sensor decoding algorithm and EPS controller
CN107017959B (en) * 2017-03-22 2019-05-28 广州致远电子股份有限公司 A kind of method and device improving punctual precision using clock synchronization

Also Published As

Publication number Publication date
CN108959183A (en) 2018-12-07

Similar Documents

Publication Publication Date Title
CN108959183B (en) Forward interpolation method for angle sensor and rotary encoder
CN104142627B (en) A kind of networking brshless DC motor delay compensation and control method of employing Auto Disturbances Rejection Control Technique
Su et al. A simple improved velocity estimation for low-speed regions based on position measurements only
DE102009006581B4 (en) Prediction phase-locked loop system
JP6317437B2 (en) Position sensor device for detecting the position of a moving body
CN104201967B (en) A kind of networking permagnetic synchronous motor delay compensation using Auto Disturbances Rejection Control Technique and control method
JPH10132606A (en) Interpolation circuit for encoder
Jeon State estimation based on kinematic models considering characteristics of sensors
US11162818B2 (en) Sensor device, system and related method
JP5056853B2 (en) Speed detection method and motor control apparatus using the same
RU2477887C1 (en) Digital predictor
JP2000329505A (en) Method and apparatus for generating position detection data
JP2002116058A (en) Encoder data conversion circuit
JP6589107B2 (en) Modulated wave resolver device
JP6825260B2 (en) Speed detector and speed control system
JP3601207B2 (en) Speed detector for rotating body
JP2019020756A (en) Sensor signal processor
CN113804914A (en) Motor speed measuring method and device, computer equipment and storage medium
JP2001178166A (en) Speed control apparatus for motor
US6310458B1 (en) Blended velocity estimation
CN108731703B (en) Angle sensor and rotation direction inversion delaying method of rotary encoder
Kubus et al. A sensor fusion approach to angle and angular rate estimation
CN113541546B (en) Direct prediction torque control method and system for permanent magnet synchronous motor
CN112152522B (en) Multi-model control method for interaction of non-position sensors in full-speed range of motor
JP2002136165A (en) Speed detecting method for motor controller

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
GR01 Patent grant
GR01 Patent grant