Filtering method and device for encoder output pulse signal and encoder
The Kalman filter method is used to dynamically process the encoder output pulse signal, which solves the problem that traditional methods cannot effectively handle errors at non-uniform speeds, improves the accuracy and stability of the encoder, and reduces the impact of outliers.
Patent Information
- Application Number
- CN202110842964.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-26
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-07-26
AI Technical Summary
When traditional encoders deal with non-uniform speed changes such as uniform acceleration and variable acceleration, fixed compensation methods cannot effectively handle non-periodic fluctuations and periodic errors, and occasional stains can lead to outliers and distort the output results.
Using the Kalman filter method, by obtaining the output pulse signal, calculate the Kalman filter prediction value and covariance of the rotating axis under constant speed, uniform acceleration and variable acceleration. Combined with the actual measured values, determine the filtering results, and dynamically adjust the Kalman gain to Filter out Gaussian noise and handle outliers.
Effectively filter out the Gaussian noise of the encoder output pulse signal, maintain good filtering effect and followability, reduce outliers caused by stains, and improve the position linearity and accuracy of the encoder.
Smart Images

Figure CN113630105B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of encoders, and specifically relates to a filtering method, device and encoder for a pulse signal output by an encoder. Background Art
[0002] The encoder is a sensor that converts the rotation angle of the rotating shaft into a digital quantity that can be used by the computer. Encoders have been widely used in the field of automatic control. With the development of modern technology, encoder measurement results are required to be more accurate and less volatile. However, the angles measured by the encoder usually have errors, including accidental errors caused by electrical noise, quantization error, non-periodic jump, light interference, etc., as well as periodic errors caused by code disk pattern errors, code disk process accuracy, code disk and shaft eccentricity, periodic jump, etc. The main compensation method for the error is to compensate the amplitude, phase, and DC components on the subdivided sine and cosine signals, and to obtain a more accurate measurement angle by using a specific device segmented compensation method on the output pulse signal. The above compensation method can only handle the noise in the data with uniform speed changes. In fact, uniform acceleration and variable acceleration are often encountered during the operation of the encoder. The results after using fixed compensation methods and device compensation still have large non-periodic fluctuations and some residual periodic errors. If the encoder has occasional stains, it will have large abnormal values, resulting in distortion of the encoder output results, large fluctuations in the motor speed, inaccurate positioning, and other problems. Summary of the invention
[0003] In order to at least overcome to a certain extent the problem that the results of compensation by traditional fixed compensation methods and devices still have large non-periodic fluctuations and some residual periodic errors, are greatly affected by stains, and cause encoder output distortion, the present application provides a filtering method, device and encoder for an encoder output pulse signal.
[0004] In a first aspect, the present application provides a method for filtering an encoder output pulse signal, comprising:
[0005] Get output pulse signal;
[0006] Calculate the Kalman filter prediction value of the rotating shaft connected to the encoder under a uniform speed state according to the output pulse signal;
[0007] Compare the Kalman filter prediction value under the uniform speed state with the actual measurement value to obtain the actual motion state of the rotating shaft connected to the encoder;
[0008] The filtering result is determined according to the actual motion state of the rotating shaft to which the encoder is connected.
[0009] Further, the calculating of the Kalman filter prediction value of the rotating shaft connected to the encoder under a uniform speed state according to the output pulse signal includes:
[0010] Kalman filter prediction value under uniform speed state Y(k)=X(k-1)+[X(k-1)-X(kn)] / n;
[0011] Among them, k represents the current moment, k-1 represents the previous moment, X(k-1) represents the filtering result at the previous moment, X(kn) represents the filtering result at a certain moment in history, and n≥2.
[0012] Furthermore, it also includes:
[0013] Calculating the covariance of the predicted value according to the output pulse signal;
[0014] Calculating a first Kalman gain according to the covariance of the predicted value;
[0015] A filtering result is calculated according to the first Kalman gain.
[0016] Further, the calculating the covariance of the predicted value according to the output pulse signal includes:
[0017] Covariance of predicted values P'(k) = P(k-1) + Q
[0018] Among them, P(k-1) represents the covariance of the predicted value at the previous moment, and Q represents the covariance of the noise in the uniform speed state prediction process.
[0019] Further, the calculating the first Kalman gain according to the covariance of the predicted value includes:
[0020] First Kalman gain Kg = P'(k) / [P(k)+R]
[0021] Wherein, P'(k) represents the covariance of the predicted value, P(k) is the initial value of the covariance of the predicted value, and R represents the covariance of the measurement noise in the uniform velocity state.
[0022] Further, calculating the filtering result according to the first Kalman gain includes:
[0023] Filter result X(k)=Y(k)+Kg*[Y(k)-Z(k)]
[0024] Among them, Y(k) represents the Kalman filter prediction value under uniform speed state, Kg represents the first Kalman gain, and Z(k) represents the output pulse signal.
[0025] Furthermore, the step of comparing the Kalman filter prediction value under the uniform speed state with the actual measurement value to obtain the actual motion state of the rotating shaft connected to the encoder includes:
[0026] Calculate the difference between the Kalman filter prediction value and the actual measurement value at each moment in the uniform speed state A(k)=Y(k)-Z(k), where Z(k) represents the output pulse signal;
[0027] Determine whether the absolute value of the difference A(k) between the Kalman filter prediction value and the actual measurement value under the uniform speed state is within a first threshold range;
[0028] If so, enter the uniform speed state and filter the result to solve.
[0029] Further, determining the filtering result according to the actual motion state of the rotating shaft connected to the encoder includes:
[0030] Obtain the second Kalman gain p of the unit after it has been running for a period of time;
[0031] Uniform speed state filtering result X(k)=Y(k)+p*A(k)
[0032] Among them, Y(k) represents the Kalman filter prediction value under uniform speed state, and A(k) represents the difference between the Kalman filter prediction value and the actual measurement value under uniform speed state at the current moment and the previous moment.
[0033] Furthermore, the first threshold range is that the Gaussian noise of the pulse signal output by the uniform speed encoder approximately meets Three times the boundary value scope.
[0034] Furthermore, the step of comparing the Kalman filter prediction value under the uniform speed state with the actual measurement value to obtain the actual motion state of the rotating shaft connected to the encoder further includes:
[0035] If the absolute value of the difference A(k) between the Kalman filter prediction value and the actual measurement value under the uniform speed state is not within the first threshold range, then the increase in the difference between the Kalman filter prediction value and the actual measurement value under the uniform speed state at the current moment and the previous moment is calculated as A'(k)=A(k)-A(k-1);
[0036] Determining whether the absolute value of the increase amount A'(k) is within a second threshold range;
[0037] If so, enter the uniform acceleration state and filter the result to solve.
[0038] Further, determining the filtering result according to the actual motion state of the rotating shaft connected to the encoder includes:
[0039] Calculate the third Kalman gain q=p+{[atan(a(k) / m)] / (PI / 2)}*(1-p), where p is the second Kalman gain of the unit after running for a period of time, a(k) represents acceleration, and m represents the convergence speed coefficient of the third Kalman gain value with the increase of acceleration;
[0040] Uniform acceleration state filtering result X(k)=Y(k)+A(k)*q
[0041] Among them, Y(k) represents the Kalman filter prediction value under uniform speed state, and A(k) represents the difference between the Kalman filter prediction value and the actual measurement value under uniform speed state at the current moment and the previous moment.
[0042] Furthermore, the second threshold range is that the Gaussian noise of the output pulse signal under uniform acceleration approximately meets Three times the boundary value scope.
[0043] Furthermore, it also includes:
[0044] If the absolute value of the increase amount A'(k) is not within the second threshold range, the variable acceleration state is entered to filter the result solution.
[0045] Further, determining the filtering result according to the actual motion state of the rotating shaft connected to the encoder includes:
[0046] Variable acceleration state filtering result X(k)=Z(k)
[0047] Wherein, Z(k) represents the output pulse signal.
[0048] In a second aspect, the present application provides a filtering device for an encoder output pulse signal, comprising:
[0049] An acquisition module, used for acquiring an output pulse signal;
[0050] A calculation module, used for calculating a Kalman filter prediction value of a rotating shaft connected to the encoder under a uniform speed state according to the output pulse signal;
[0051] A comparison module, used for comparing the Kalman filter prediction value under the uniform speed state with the actual measurement value to obtain the actual motion state of the rotating shaft connected to the encoder;
[0052] The determination module is used to determine the filtering result according to the actual motion state of the rotating shaft connected to the encoder.
[0053] In a third aspect, the present application provides an encoder, comprising:
[0054] A processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement a filtering method for an encoder output pulse signal as described in any one of the first aspects.
[0055] The technical solution provided by the embodiments of the present application may have the following beneficial effects:
[0056] The filtering method, device and encoder for filtering encoder output pulse signals provided in the embodiments of the present invention include obtaining the output pulse signal, calculating the Kalman filter prediction value of the rotating shaft connected to the encoder under a uniform speed state according to the output pulse signal, comparing the Kalman filter prediction value under the uniform speed state with the actual measurement value to obtain the actual motion state of the rotating shaft connected to the encoder, and determining the filtering result according to the actual motion state of the rotating shaft connected to the encoder. The Gaussian noise of the encoder output pulse signal can be effectively filtered out, and good filtering effect and tracking performance can still be maintained in the case of sudden changes in the encoder speed. The problem of large abnormal values caused by accidental stains on the encoder can also be solved to a certain extent.
[0057] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0059] Figure 1 A flowchart of a method for filtering an encoder output pulse signal provided in one embodiment of the present application.
[0060] Figure 2 A flowchart of a method for filtering an encoder output pulse signal provided in accordance with another embodiment of the present application.
[0061] Figure 3 A flowchart of another method for filtering an encoder output pulse signal provided by an embodiment of the present application.
[0062] Figure 4 A functional structure diagram of a filtering device for an encoder output pulse signal provided in one embodiment of the present application. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be described in detail below. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other implementation methods obtained by ordinary technicians in the field without creative work belong to the scope of protection of the present application.
[0064] Figure 1 A flowchart of a method for filtering an encoder output pulse signal provided by an embodiment of the present application is shown in FIG. Figure 1 As shown, the filtering method of the encoder output pulse signal includes:
[0065] S11: Obtain output pulse signal;
[0066] S12: Calculating a Kalman filter prediction value of the rotating shaft connected to the encoder under a uniform speed state according to the output pulse signal;
[0067] S13: Compare the Kalman filter prediction value under the uniform speed state with the actual measurement value to obtain the actual motion state of the rotating shaft connected to the encoder;
[0068] S14: Determine a filtering result according to an actual motion state of the rotating shaft to which the encoder is connected.
[0069] The compensation method of traditional encoder output pulse signal can only deal with the noise in the data of uniform speed change. In fact, uniform acceleration, variable acceleration and other situations are often encountered during the operation of the encoder. The results after using fixed compensation methods and devices for compensation still have large non-periodic fluctuations and some residual periodic errors. If the encoder has occasional stains, large abnormal values will appear, causing distortion of the encoder output results, large fluctuations in the motor speed, inaccurate positioning and other problems.
[0070] The filtering method of the encoder output pulse signal provided in this embodiment is different from the traditional method of compensating according to the difference between the reference encoder and the correction encoder. The present application predicts the filtering result based on the Kalman filter prediction value, which can effectively improve the linearity and accuracy of the encoder position.
[0071] In this embodiment, the filtering method of the encoder output pulse signal includes obtaining the output pulse signal, calculating the Kalman filter prediction value of the rotating shaft connected to the encoder under a uniform speed state based on the output pulse signal, comparing the Kalman filter prediction value under the uniform speed state with the actual measurement value to obtain the actual motion state of the rotating shaft connected to the encoder, and determining the filtering result based on the actual motion state of the rotating shaft connected to the encoder. This can effectively filter out the Gaussian noise of the encoder output pulse signal, and still maintain good filtering effect and followability when the encoder speed changes suddenly. It can also solve the problem of large abnormal values caused by accidental stains on the encoder to a certain extent.
[0072] The embodiment of the present invention provides another method for filtering a pulse signal output by an encoder, such as Figure 2 The flowchart shown in the figure shows that the filtering method of the encoder output pulse signal includes:
[0073] S21: Obtain output pulse signal;
[0074] S22: Calculating a Kalman filter prediction value of the rotating shaft connected to the encoder under a uniform speed state according to the output pulse signal;
[0075] Specifically include:
[0076] Kalman filter prediction value under uniform speed state Y(k)=X(k-1)+[X(k-1)-X(kn)] / n;
[0077] Among them, k represents the current moment, k-1 represents the previous moment, X(k-1) represents the filtering result at the previous moment, X(kn) represents the filtering result at a certain moment in history, and n≥2.
[0078] In the traditional Kalman filter calculation process, the predicted value
[0079] Y(k)=X(k-1)+[(v(k)+a(k)*T*0.5]*T, where X(k-1) represents the filtering result at time k-1, v(k) is the speed, a(k) is the acceleration, and T is the encoder sampling period. It can be seen that the predicted value Y(k) is related to the speed and acceleration, and the calculation of speed and acceleration is relatively complex, which has high requirements on the chip computing power and the calculation time is long, which cannot meet the requirements of the encoder response speed. Therefore, this application optimizes the calculation method of the predicted value Y(k), and the formula is:
[0080] Y(k)=X(k-1)+[X(k-1)-X(kn)] / n
[0081] Where n≥2, the difference between X(k-1) and X(kn) is the position difference, and the time difference between X(k-1) and X(kn) is n times T. Since the encoder sampling period T is fixed during the entire processing process, the prediction effect of speed and acceleration can be reflected by the difference between X(k-1) and X(kn). Therefore, calculating the prediction value in this way can ensure the accuracy of the Kalman prediction value, while reducing the calculation process and effectively reducing the requirements of the filtering process on the chip computing power.
[0082] Among them, X(k-1) represents the filtering result at the previous moment, and X(kn) represents the calculation process of the filtering result at a certain moment in history, including:
[0083] S221: Calculate the covariance of the predicted value according to the output pulse signal;
[0084] Covariance of predicted values P'(k) = P(k-1) + Q
[0085] Among them, P(k-1) represents the covariance of the predicted value at the previous moment, and Q represents the covariance of the noise in the uniform speed state prediction process.
[0086] S222: Calculate the first Kalman gain according to the covariance of the predicted value;
[0087] First Kalman gain Kg = P'(k) / [P(k)+R]
[0088] Wherein, P'(k) represents the covariance of the predicted value, P(k) is the initial value of the covariance of the predicted value, and R represents the covariance of the measurement noise in the uniform velocity state.
[0089] S223: Calculate a filtering result according to the first Kalman gain.
[0090] Filter result X(k)=Y(k)+Kg*[Y(k)-Z(k)]
[0091] Among them, Y(k) represents the Kalman filter prediction value under uniform speed state, Kg represents the first Kalman gain, and Z(k) represents the output pulse signal.
[0092] S23: Compare the Kalman filter prediction value in the uniform speed state with the actual measurement value to obtain the actual motion state of the rotating shaft connected to the encoder, where the actual motion state includes a uniform speed state, a uniform acceleration state, and a variable acceleration state;
[0093] like Figure 3 As shown, in some embodiments, the Kalman filter prediction value under the uniform speed state is compared with the actual measurement value to obtain the actual motion state of the rotating shaft connected to the encoder, including:
[0094] S231: Calculate the difference between the Kalman filter prediction value and the actual measurement value at each moment in the uniform speed state A(k)=Y(k)-Z(k), where Z(k) represents the output pulse signal;
[0095] S232: Determine whether the absolute value of the difference A(k) between the Kalman filter prediction value and the actual measurement value in the uniform speed state is within a first threshold range;
[0096] In some embodiments, the first threshold range is that the Gaussian noise of the pulse signal output by the uniform speed encoder approximately meets Three times the boundary value scope.
[0097] S233: If yes, enter the uniform speed state filtering result solution.
[0098] S234: Otherwise, calculate the increase in the difference between the Kalman filter prediction value and the actual measurement value under the uniform speed state at the current moment and the previous moment, A'(k)=A(k)-A(k-1);
[0099] S235: Determine whether the absolute value of the increase amount A'(k) is within a second threshold range;
[0100] In some embodiments, the second threshold range is that the Gaussian noise of the encoder output pulse signal in the uniform acceleration state approximately meets Three times the boundary value scope.
[0101] S236: If yes, enter the uniform acceleration state to filter the result and solve it.
[0102] S237: Otherwise, enter the variable acceleration state to solve the filtering result.
[0103] S24: Determine the filtering result according to the actual motion state of the rotating shaft connected to the encoder:
[0104] If the filter enters the uniform speed state, the solution is:
[0105] Obtain the second Kalman gain p of the unit after it has been running for a period of time;
[0106] Uniform speed state filtering result X(k)=Y(k)+p*A(k)
[0107] Among them, Y(k) represents the Kalman filter prediction value under uniform speed state, and A(k) represents the difference between the Kalman filter prediction value and the actual measurement value under uniform speed state at the current moment and the previous moment.
[0108] If the filter enters the uniform acceleration state, the solution is:
[0109] Calculate the third Kalman gain q=p+{[atan(a(k) / m)] / (PI / 2)}*(1-p), where p is the second Kalman gain of the unit after running for a period of time, a(k) represents acceleration, and m represents the convergence speed coefficient of the third Kalman gain value with the increase of acceleration;
[0110] It should be noted that q gradually transitions from p to 1 as a(k) increases, and those skilled in the art can adjust the value of m according to actual conditions. Enter the uniform acceleration state to filter the results. The faster the acceleration, the less reliable the predicted value obtained by the first Kalman gain. Therefore, the third Kalman gain q value is used to replace the first Kalman gain, so that the filtering result is more biased towards the measured value.
[0111] Uniform acceleration state filtering result X(k)=Y(k)+A(k)*q
[0112] Among them, Y(k) represents the Kalman filter prediction value under uniform speed state, and A(k) represents the difference between the Kalman filter prediction value and the actual measurement value under uniform speed state at the current moment and the previous moment.
[0113] If the filter enters the variable acceleration state, the solution is:
[0114] Variable acceleration state filtering result X(k)=Z(k)
[0115] Wherein, Z(k) represents the output pulse signal.
[0116] In this embodiment, with respect to the operating conditions of the encoder, the Kalman filter calculation process is first simplified, and then the different motion states of the encoder are judged. Different gain coefficient curves and different filtering schemes are used for the encoder output pulses according to the different motion states. Compared with the traditional Kalman filter, the system responds faster in processing real-time signals and adapts to a wider range of working conditions, which is beneficial to improving the accuracy and stability of the encoder and the performance of the servo system, and can solve the problem of non-periodic fluctuations in the encoder output pulse signal. To a certain extent, it solves the problem of large abnormal values of the encoder due to accidental stains, thereby achieving the purpose of enhancing the resolution and accuracy of the encoder.
[0117] The embodiment of the present invention provides a filtering device for an encoder output pulse signal, such as Figure 4 As shown in the functional structure diagram, the filtering device for the encoder output pulse signal includes:
[0118] An acquisition module 41 is used to acquire an output pulse signal;
[0119] A calculation module 42, used for calculating a Kalman filter prediction value of a rotating shaft connected to the encoder under a uniform speed state according to the output pulse signal;
[0120] A comparison module 43, used for comparing the Kalman filter prediction value under the uniform speed state with the actual measurement value to obtain the actual motion state of the rotating shaft connected to the encoder;
[0121] The determination module 44 is used to determine the filtering result according to the actual motion state of the rotating shaft to which the encoder is connected.
[0122] In this embodiment, the output pulse signal is obtained by the acquisition module, the calculation module calculates the Kalman filter prediction value of the rotating shaft connected to the encoder under a uniform speed state according to the output pulse signal, the comparison module compares the Kalman filter prediction value under a uniform speed state with the actual measurement value to obtain the actual motion state of the rotating shaft connected to the encoder, and the determination module determines the filtering result according to the actual motion state of the rotating shaft connected to the encoder. This can solve the problem of non-periodic fluctuation of the encoder output pulse signal, and to a certain extent solves the problem of large abnormal values of the encoder due to accidental stains, thereby achieving the purpose of enhancing the resolution and accuracy of the encoder.
[0123] An embodiment of the present invention provides an encoder, including:
[0124] A processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement the filtering method of the encoder output pulse signal as described in the above embodiment.
[0125] It can be understood that the same or similar parts of the above embodiments can be referenced to each other, and the contents not described in detail in some embodiments can refer to the same or similar contents in other embodiments.
[0126] It should be noted that, in the description of this application, the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, the meaning of "plurality" refers to at least two.
[0127] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0128] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0129] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0130] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0131] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0132] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0133] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
[0134] It should be noted that the present invention is not limited to the above-mentioned optimal implementation mode. Those skilled in the art can derive other various forms of products under the guidance of the present invention. However, no matter what changes are made in the shape or structure, all technical solutions that are the same or similar to those of the present application fall within the protection scope of the present invention.
Claims
1. A filtering method for an encoder output pulse signal, characterized in that: include: Get output pulse signal; Calculate the Kalman filter prediction value of the rotating shaft connected to the encoder under a uniform speed state according to the output pulse signal; Compare the Kalman filter prediction value under the uniform speed state with the actual measurement value to obtain the actual motion state of the rotating shaft connected to the encoder; Determining a filtering result according to an actual motion state of a rotating shaft to which the encoder is connected; The step of comparing the Kalman filter prediction value under the uniform speed state with the actual measurement value to obtain the actual motion state of the rotating shaft connected to the encoder includes: Calculate the difference between the Kalman filter prediction value and the actual measurement value at each moment in the uniform speed state A(k)=Y(k)-Z(k), where Z(k) represents the output pulse signal; Determine whether the absolute value of the difference A(k) between the Kalman filter prediction value and the actual measurement value under the uniform speed state is within a first threshold range; If so, enter the uniform speed state and filter the result to solve; If the absolute value of the difference A(k) between the Kalman filter prediction value and the actual measurement value under the uniform speed state is not within the first threshold range, then the increase in the difference between the Kalman filter prediction value and the actual measurement value under the uniform speed state at the current moment and the previous moment is calculated as A'(k)=A(k)-A(k-1); Determining whether the absolute value of the increase amount A'(k) is within a second threshold range; If so, enter the uniform acceleration state and filter the result to solve.
2. The filtering method for the encoder output pulse signal according to claim 1, characterized in that: The calculating, according to the output pulse signal, a Kalman filter prediction value of the rotating shaft connected to the encoder in a uniform speed state comprises: Kalman filter prediction value under uniform speed state Y(k)=X(k-1)+[X(k-1)-X(kn)] / n; Among them, k represents the current moment, k-1 represents the previous moment, X(k-1) represents the filtering result at the previous moment, X(kn) represents the filtering result at a certain moment in history, and n≥2.
3. The filtering method of the encoder output pulse signal according to claim 2, characterized in that: Also includes: Calculating the covariance of the predicted value according to the output pulse signal; Calculating a first Kalman gain according to the covariance of the predicted value; A filtering result is calculated according to the first Kalman gain.
4. The filtering method of the encoder output pulse signal according to claim 3, characterized in that: The calculating the covariance of the predicted value according to the output pulse signal comprises: Covariance of predicted values P'(k) = P(k-1) + Q Among them, P(k-1) represents the covariance of the predicted value at the previous moment, and Q represents the covariance of the noise in the uniform speed state prediction process.
5. The filtering method of the encoder output pulse signal according to claim 3, characterized in that: The calculating the first Kalman gain according to the covariance of the predicted value comprises: First Kalman gain Kg = P'(k) / [P(k)+R] Wherein, P'(k) represents the covariance of the predicted value, P(k) is the initial value of the covariance of the predicted value, and R represents the covariance of the measurement noise in the uniform velocity state.
6. The filtering method of the encoder output pulse signal according to claim 3, characterized in that: The calculating the filtering result according to the first Kalman gain includes: Filter result X(k)=Y(k)+Kg*[Y(k)-Z(k)] Among them, Y(k) represents the Kalman filter prediction value under uniform speed state, Kg represents the first Kalman gain, and Z(k) represents the output pulse signal.
7. The filtering method of the encoder output pulse signal according to claim 1, characterized in that: The step of determining the filtering result according to the actual motion state of the rotating shaft to which the encoder is connected comprises: Obtain the second Kalman gain p of the unit after it has been running for a period of time; Uniform speed state filtering result X(k)=Y(k)+p*A(k) Among them, Y(k) represents the Kalman filter prediction value under uniform speed state, and A(k) represents the difference between the Kalman filter prediction value and the actual measurement value under uniform speed state at the current moment and the previous moment.
8. The filtering method of the encoder output pulse signal according to claim 1, characterized in that: The step of determining the filtering result according to the actual motion state of the rotating shaft to which the encoder is connected comprises: Calculate the third Kalman gain q=p+{[atan(a(k) / m)] / (PI / 2)}*(1-p), where p is the second Kalman gain of the unit after running for a period of time, a(k) represents acceleration, and m represents the convergence speed coefficient of the third Kalman gain value with the increase of acceleration; Uniform acceleration state filtering result X(k)=Y(k)+A(k)*q Among them, Y(k) represents the Kalman filter prediction value under uniform speed state, and A(k) represents the difference between the Kalman filter prediction value and the actual measurement value under uniform speed state at the current moment and the previous moment.
9. The filtering method of the encoder output pulse signal according to claim 1, characterized in that: Also includes: If the absolute value of the increase amount A'(k) is not within the second threshold range, the variable acceleration state is entered to filter the result solution.
10. The method for filtering the encoder output pulse signal according to claim 9, characterized in that: The step of determining the filtering result according to the actual motion state of the rotating shaft to which the encoder is connected comprises: Variable acceleration state filtering result X(k)=Z(k) Wherein, Z(k) represents the output pulse signal.
11. A filtering device for an encoder output pulse signal, characterized in that: include: An acquisition module, used for acquiring an output pulse signal; A calculation module, used for calculating a Kalman filter prediction value of a rotating shaft connected to the encoder under a uniform speed state according to the output pulse signal; A comparison module, used for comparing the Kalman filter prediction value under the uniform speed state with the actual measurement value to obtain the actual motion state of the rotating shaft connected to the encoder; A determination module, used to determine a filtering result according to an actual motion state of a rotating shaft to which the encoder is connected; Wherein, the comparison module is specifically used for: Calculate the difference between the Kalman filter prediction value and the actual measurement value at each moment in the uniform speed state A(k)=Y(k)-Z(k), where Z(k) represents the output pulse signal; Determine whether the absolute value of the difference A(k) between the Kalman filter prediction value and the actual measurement value under the uniform speed state is within a first threshold range; If so, enter the uniform speed state and filter the result to solve; If the absolute value of the difference A(k) between the Kalman filter prediction value and the actual measurement value under the uniform speed state is not within the first threshold range, then the increase in the difference between the Kalman filter prediction value and the actual measurement value under the uniform speed state at the current moment and the previous moment is calculated as A'(k)=A(k)-A(k-1); Determining whether the absolute value of the increase amount A'(k) is within a second threshold range; If so, enter the uniform acceleration state and filter the result to solve.
12. An encoder, characterized in that: include: A processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement the filtering method for the encoder output pulse signal as described in any one of claims 1 to 10.
Citation Information
Patent Citations
TMR magnetic encoder system based on Kalman filtering
CN111121827A
