Encoder absolute position angle decoding method and device, equipment and storage medium
By acquiring and combining the signal combination level value and decoding angle of the encoder's cosine signal group in real time, angle judgment and correction are performed, the angle deviation problem in the encoder's absolute position angle decoding is solved, and the stability of the motor is improved. Accuracy of absolute position angle.
Patent Information
- Application Number
- CN202411494809.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-01-10
AI Technical Summary
When existing encoders decode the absolute position angle, there may be an unfixed offset between the levels of the A and B signals and the decoding angle, resulting in an angle deviation of 180° during angle splicing, affecting the accuracy of the absolute position angle. and the stability of the motor.
By obtaining the signal combination level value corresponding to the sine cosine signal group in the encoder in real time and performing combination processing and judgment correction, using preset angle calculation formulas and correction formulas to determine the absolute position of the encoder Angle, reduce angle deviation.
It improves the accuracy of the absolute position angle of the encoder output, enhances the running stability of the motor, and avoids the problem of unstable motor operation caused by angle deviation.
Smart Images

Figure CN119290041A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of motor control, and in particular to an encoder absolute position angle decoding method, device, equipment and storage medium. Background Art
[0002] An encoder is a sensor used to measure angular position. When the encoder rotates one circle, it generates multiple sine and cosine signals. The absolute position angle cannot be determined by decoding these sine and cosine signals alone. Based on this, the prior art generally introduces A and B signals to solve the absolute position angle. However, in actual applications, due to process limitations and device characteristics, there may be an unfixed offset angle between the levels of the A and B signals and the decoded angle. This offset will cause an angle deviation of 180° when the angles are spliced, which will not only affect the accuracy of the decoded absolute position angle, but also affect the electrical angle of the motor, which may cause unstable operation of the motor. Summary of the invention
[0003] The present application provides an encoder absolute position angle decoding method, device, equipment and storage medium, which can improve the accuracy of the absolute position angle output by the encoder, thereby improving the stability of the motor operation and avoiding the problem of unstable motor operation caused by angle deviation.
[0004] In the first aspect, the present application provides a method for decoding the absolute position angle of an encoder, comprising: acquiring in real time the signal combination level value corresponding to the current sine and cosine signal group in the encoder, and the current sine and cosine signal decoding angle, combining the signal combination level value and the current sine and cosine decoding angle to obtain a combined angle; judging the combined angle and the signal combination level value, and correcting the combined angle based on the judgment result to obtain the absolute position angle of the encoder.
[0005] Further, the signal combination level value and the current sin-cosine decoding angle are combined to obtain a combination angle, which specifically includes: substituting the signal combination level value and the current sin-cosine decoding angle into a preset combination angle calculation formula to obtain a combination angle.
[0006] Further, the combination angle and the signal combination level value are judged and processed, specifically including: judging whether the combination angle satisfies a first angle range, and whether the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies a first preset ideal angle; if not, judging whether the combination angle satisfies a second angle range, and whether the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies a second preset ideal angle; when the combination angle satisfies the first angle range, and the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the first preset ideal angle, or when the combination angle satisfies the second angle range, and the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the second preset ideal angle, outputting a judgment result that the first preset rule is satisfied; when the combination angle does not satisfy the second angle range, and / or the ideal sine-cosine signal decoding angle corresponding to the signal combination level value does not satisfy the second preset ideal angle. When the second preset ideal angle is met, it is determined whether the combined angle satisfies the third angle range, and whether the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the third preset ideal angle. If not, it is determined whether the combined angle satisfies the fourth angle range, and whether the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the fourth preset ideal angle. When the combined angle satisfies the third angle range, and the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the third preset ideal angle, or when the combined angle satisfies the fourth angle range, and the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the fourth preset ideal angle, the output judgment result is that the second preset rule is met. When the combined angle does not satisfy the fourth angle range, and / or the ideal sine-cosine signal decoding angle corresponding to the signal combination level value does not satisfy the fourth preset ideal angle, the output judgment result is that the third preset rule is met.
[0007] Furthermore, based on the judgment result, the combined angle is corrected to obtain the absolute position angle of the encoder, specifically including: when the judgment result is that the first preset rule is satisfied, the combined angle is substituted into the preset first angle correction formula to calculate the absolute position angle of the encoder; when the judgment result is that the second preset rule is satisfied, the combined angle is substituted into the preset second angle correction formula to calculate the absolute position angle of the encoder; when the judgment result is that the third preset rule is satisfied, the combined angle is used as the absolute position angle of the encoder.
[0008] Furthermore, the signal combination level value corresponding to the current sine-cosine signal group in the encoder is obtained in real time, specifically including: reading in real time a first sine-cosine signal level state corresponding to the first sine-cosine signal in the encoder, and a second sine-cosine signal level state corresponding to the second sine-cosine signal, and determining the current sine-cosine signal group of the encoder based on the first sine-cosine signal level state and the second sine-cosine signal level state; and determining the signal combination level value corresponding to the current sine-cosine signal group based on a pre-set sine-cosine signal state comparison table.
[0009] Furthermore, the sine-cosine signal state comparison table includes sine-cosine signal groups, and signal combination level values corresponding to each sine-cosine signal group and ideal sine-cosine signal decoding angles.
[0010] In the second aspect, the present application provides an encoder absolute position angle decoding device, comprising: an angle combination module and an angle correction module; wherein the angle combination module is used to obtain in real time the signal combination level value corresponding to the current sine and cosine signal group in the encoder, and the current sine and cosine signal decoding angle, and combine the signal combination level value and the current sine and cosine decoding angle to obtain a combined angle; the angle correction module is used to judge the combined angle and the signal combination level value, and correct the combined angle based on the judgment result to obtain the absolute position angle of the encoder.
[0011] Furthermore, the angle combination module is used to combine the signal combination level value and the current sin-cosine decoding angle to obtain a combined angle, specifically including: substituting the signal combination level value and the current sin-cosine decoding angle into a preset combination angle calculation formula to obtain a combined angle.
[0012] Further, the angle correction module is used to judge and process the combined angle and the signal combination level value, specifically including: judging whether the combined angle satisfies the first angle range, and whether the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the first preset ideal angle; if not, judging whether the combined angle satisfies the second angle range, and whether the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the second preset ideal angle; when the combined angle satisfies the first angle range, and the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the first preset ideal angle, or when the combined angle satisfies the second angle range, and the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the second preset ideal angle, outputting a judgment result that the first preset rule is satisfied; when the combined angle does not satisfy the second angle range, and / or the ideal sine-cosine signal decoding angle corresponding to the signal combination level value When the angle does not satisfy the second preset ideal angle, it is determined whether the combined angle satisfies the third angle range, and whether the ideal sin-cosine signal decoding angle corresponding to the signal combination level value satisfies the third preset ideal angle. If not, it is determined whether the combined angle satisfies the fourth angle range, and whether the ideal sin-cosine signal decoding angle corresponding to the signal combination level value satisfies the fourth preset ideal angle. When the combined angle satisfies the third angle range, and the ideal sin-cosine signal decoding angle corresponding to the signal combination level value satisfies the third preset ideal angle, or when the combined angle satisfies the fourth angle range, and the ideal sin-cosine signal decoding angle corresponding to the signal combination level value satisfies the fourth preset ideal angle, a judgment result is output that the second preset rule is satisfied. When the combined angle does not satisfy the fourth angle range, and / or the ideal sin-cosine signal decoding angle corresponding to the signal combination level value does not satisfy the fourth preset ideal angle, a judgment result is output that the third preset rule is satisfied.
[0013] Furthermore, the angle correction module is used to correct the combined angle based on the judgment result to obtain the absolute position angle of the encoder, specifically including: when the judgment result is that the first preset rule is met, the combined angle is substituted into the preset first angle correction formula to calculate the absolute position angle of the encoder; when the judgment result is that the second preset rule is met, the combined angle is substituted into the preset second angle correction formula to calculate the absolute position angle of the encoder; when the judgment result is that the third preset rule is met, the combined angle is used as the absolute position angle of the encoder.
[0014] Furthermore, the angle combination module is used to obtain in real time the signal combination level value corresponding to the current sine and cosine signal group in the encoder, specifically including: reading in real time a first sine and cosine signal level state corresponding to the first sine and cosine signal in the encoder, and a second sine and cosine signal level state corresponding to the second sine and cosine signal, and determining the current sine and cosine signal group of the encoder based on the first sine and cosine signal level state and the second sine and cosine signal level state; and determining the signal combination level value corresponding to the current sine and cosine signal group based on a pre-set sine and cosine signal state comparison table.
[0015] Furthermore, the sine-cosine signal state comparison table includes sine-cosine signal groups, and signal combination level values corresponding to each sine-cosine signal group and ideal sine-cosine signal decoding angles.
[0016] In the third aspect, the present application provides an electronic device, comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; and at least one memory connected to the at least one bus, wherein the processor is used to implement the steps of the encoder absolute position angle decoding method described in any one of the above items of the present application when executing a program stored in the memory.
[0017] In a fourth aspect, the present application further provides a computer storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the encoder absolute position angle decoding method described in any one of the above items of the present application.
[0018] The above-mentioned technical scheme provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application can ensure that the acquired angle data is the latest by acquiring the signal combination level value corresponding to the sine and cosine signal group in the encoder and the current sine and cosine signal decoding angle in real time, and more accurate angle information can be obtained by combining the signal combination level value and the current sine and cosine decoding angle; subsequently, by judging and processing the combination angle and the signal combination level value, and correcting the combination angle based on the judgment result, the non-fixed offset angle between the level and the decoding angle caused by process limitations and device characteristics can be compensated, thereby reducing the angle deviation that may occur during angle splicing, thereby improving the accuracy of the absolute position angle output by the encoder, thereby improving the stability of the motor operation, and avoiding the problem of unstable motor operation caused by angle deviation. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0020] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0021] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0022] Figure 1 It is a flowchart of an embodiment of an encoder absolute position angle decoding method provided by the present application;
[0023] Figure 2 This is a schematic diagram of position jump of a combination angle of an embodiment provided by the present application;
[0024] Figure 3 It is a schematic diagram of combined angle position jump correction of an embodiment provided by the present application;
[0025] Figure 4 It is a structural schematic diagram of an embodiment of an encoder absolute position angle decoding device provided by the present application;
[0026] Figure 5 It is a structural schematic diagram of an electronic device provided by this application. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0028] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0029] Example 1, see Figure 1 , Figure 1 FIG. 1 is a flow chart of an embodiment of an encoder absolute position angle decoding method provided by the present application. Figure 1 As shown, the method includes steps 101 and 102, which are specifically as follows:
[0030] Step 101: acquiring in real time the signal combination level value corresponding to the current sine and cosine signal group in the encoder and the current sine and cosine signal decoding angle, and combining the signal combination level value and the current sine and cosine decoding angle to obtain a combination angle.
[0031] In one embodiment, the sine-cosine signal group includes a first sine-cosine signal A and a second sine-cosine signal B.
[0032] In one embodiment, a first sin-cosine signal level state corresponding to a first sin-cosine signal and a second sin-cosine signal level state corresponding to a second sin-cosine signal in an encoder are read in real time, and a current sin-cosine signal group of the encoder is determined based on the first sin-cosine signal level state and the second sin-cosine signal level state.
[0033] Specifically, the output pins corresponding to the first sin-cosine signal A and the second sin-cosine signal B of the encoder are connected to the corresponding input pins of the reading device, and the level state of the pins corresponding to the first sin-cosine signal A and the second sin-cosine signal B is read based on the reading device. When the level state is a high level, it is represented as 1, and when the level state is a low level, it is represented as 0.
[0034] Preferably, in addition to reading the level states corresponding to the first sine-cosine signal A and the second sine-cosine signal B based on the pin connection, the first sine-cosine signal A and the second sine-cosine signal B may also be directly read based on the Hall sensor.
[0035] Specifically, when the first sine-cosine signal level state and the second sine-cosine signal level state are both at a high level, the current sine-cosine signal group of the encoder is (1, 1).
[0036] Specifically, when the first sine-cosine signal level state and the second sine-cosine signal level state are both at low levels, the current sine-cosine signal group of the encoder is (0, 0).
[0037] Specifically, when the first sine-cosine signal level state is a high level and the second sine-cosine signal level state is a low level, the current sine-cosine signal group of the encoder is (1, 0).
[0038] Specifically, when the first sine-cosine signal level state is a low level and the second sine-cosine signal level state is a high level, the current sine-cosine signal group of the encoder is (0, 1).
[0039] In one embodiment, the signal combination level value corresponding to the current sine-cosine signal group is determined based on a preset sine-cosine signal state comparison table.
[0040] Specifically, the sine-cosine signal state comparison table includes sine-cosine signal groups, and signal combination level values corresponding to each sine-cosine signal group and ideal sine-cosine signal decoding angles; as shown in Table 1, Table 1 is a sine-cosine signal state comparison table.
[0041] Table 1:
[0042]
[0043] Specifically, after the current sine and cosine signal group is determined, the signal combination level value corresponding to the current sine and cosine signal group is determined by directly acquiring or using a data matching method based on the sine and cosine signal state comparison table.
[0044] In one embodiment, the current sine and cosine signal decoding angle of the encoder can be directly read based on the output interface of the encoder.
[0045] Preferably, since the sine and cosine signals generated by the encoder are continuously changing analog signals, they change with the rotation of the rotor; these sine and cosine signals are continuous sine waves and cosine waves in each cycle, which can correspond to any position within an angle range. Based on this, the current sine and cosine signal decoding angle is an angle range.
[0046] In one embodiment, the signal combination level value and the current sin-cosine decoding angle are combined to obtain the combined angle, and the combined angle is obtained by substituting the signal combination level value and the current sin-cosine decoding angle into a preset combined angle calculation formula.
[0047] Preferably, the combination angle calculation formula is as follows:
[0049] θ=θ1+(X&0x01)*180°;
[0050] Where θ is the combined angle, θ1 is the current sine and cosine decoding angle, X is the signal combined level value, & is the bitwise AND operator, and 0x01 is a binary number.
[0051] Preferably, since the current sine-cosine decoding angle is an angle range, the combined angle calculated based on the current sine-cosine decoding angle is also an angle range.
[0052] The calculation process of the combination angle in this embodiment is illustrated by an example: when the signal combination level value corresponding to the current sine-cosine signal group in the encoder is (1, 1), based on the sine-cosine signal state comparison table, it can be known that the signal combination level value X is 3, and the corresponding ideal sine-cosine signal decoding angle is 180°~270°; but since the current sine-cosine signal group is offset from the decoding angle, the current sine-cosine signal decoding angle θ1 obtained is 135°~180°; based on the combination angle calculation formula, the signal combination level value X and 0x01 are first bitwise ANDed. Since the signal combination level value X is 3, it is represented as 0011 in binary, and 0x01 is represented as 0001 in binary, when the two numbers are bitwise ANDed, each bit of their binary representation is actually compared to obtain X&0x01=1. Based on this, the calculated combination angle θ is the current sine-cosine decoding angle θ1+1*180°, that is, the combination angle θ is 315°~360°, such as Figure 2 As shown, Figure 2 It is a schematic diagram of the position jump of the combined angle.
[0053] Step 102: performing judgment processing on the combined angle and the signal combined level value, and performing correction processing on the combined angle based on the judgment result to obtain the absolute position angle of the encoder.
[0054] In one embodiment, it is determined whether the combination angle satisfies the first angle range, and whether the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the first preset ideal angle. If not, it is determined whether the combination angle satisfies the second angle range, and whether the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the second preset ideal angle.
[0055] Specifically, the ideal sine-cosine signal decoding angle corresponding to the signal combination level value may be acquired based on a sine-cosine signal state comparison table.
[0056] Preferably, based on the above-mentioned sine-cosine signal state comparison table, when the signal combination level value is 0, the corresponding ideal sine-cosine signal decoding angle is (0°~90°); when the signal combination level value is 2, the corresponding ideal sine-cosine signal decoding angle is (90°~180°); when the signal combination level value is 3, the corresponding ideal sine-cosine signal decoding angle is (180°~270°); when the signal combination level value is 1, the corresponding ideal sine-cosine signal decoding angle is (270°~360°).
[0057] Preferably, the first angle range is that the combination angle is greater than 0°, and the combination angle is less than 45°, and the first preset ideal angle is 90° to 180°.
[0058] Preferably, the second angle range is that the combination angle is greater than 135°, and the combination angle is less than 180°, and the second preset ideal angle is 0° to 90°.
[0059] In one embodiment, when the combination angle satisfies the first angle range, and the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the first preset ideal angle, or when the combination angle satisfies the second angle range, and the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the second preset ideal angle, the output judgment result is that the first preset rule is satisfied.
[0060] In one embodiment, when the combination angle does not satisfy the second angle range, and / or the ideal sin-cos signal decoding angle corresponding to the signal combination level value does not satisfy the second preset ideal angle, it is determined whether the combination angle satisfies the third angle range, and whether the ideal sin-cos signal decoding angle corresponding to the signal combination level value satisfies the third preset ideal angle; if not, it is determined whether the combination angle satisfies the fourth angle range, and whether the ideal sin-cos signal decoding angle corresponding to the signal combination level value satisfies the fourth preset ideal angle.
[0061] Preferably, the third angle range is that the combined angle is greater than 180°, and the combined angle is less than 225°, and the third preset ideal angle is 270° to 360°.
[0062] Preferably, the fourth angle range is that the combined angle is greater than 225°, and the combined angle is less than 360°, and the fourth preset ideal angle is 180° to 270°.
[0063] In one embodiment, when the combination angle satisfies the third angle range, and the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the third preset ideal angle, or when the combination angle satisfies the fourth angle range, and the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the fourth preset ideal angle, the output judgment result is that the second preset rule is satisfied.
[0064] In one embodiment, when the combination angle does not satisfy the fourth angle range, and / or the ideal sine-cosine signal decoding angle corresponding to the signal combination level value does not satisfy the fourth preset ideal angle, the output judgment result is that the third preset rule is satisfied.
[0065] In one embodiment, when the judgment result satisfies the first preset rule, the combined angle is substituted into a preset first angle correction formula to calculate the absolute position angle of the encoder.
[0066] Specifically, the first angle correction formula is as follows:
[0068] θ out =θ+180°;
[0069] Among them, θ out is the absolute position angle output by the encoder, and θ is the combined angle.
[0070] In one embodiment, when the judgment result satisfies the second preset rule, the combined angle is substituted into a preset second angle correction formula to calculate the absolute position angle of the encoder.
[0071] Specifically, the second angle correction formula is as follows:
[0073] θ out =θ-180°;
[0074] Among them, θ out is the absolute position angle output by the encoder, and θ is the combined angle.
[0075] In one embodiment, when the judgment result satisfies the third preset rule, the combined angle is used as the absolute position angle of the encoder, as shown below:
[0076] θ out =θ;
[0077] Among them, θ out is the absolute position angle output by the encoder, and θ is the combined angle.
[0078] An example is given of the process of judging and processing the combined angle and the signal combination level value in the present application, and correcting the combined angle based on the judgment result to obtain the absolute position angle of the encoder: After the combined angle θ is calculated based on the combined angle calculation formula, a judgment operation is performed: Step 1: Determine whether the combined angle θ is greater than 0° and less than 45°, and whether the ideal sine-cosine signal decoding angle corresponding to the signal combination level value X is (90°~180°). If the requirements are met, execute step 5, otherwise execute step 2; Step 2: Determine whether the combined angle θ is greater than 135° and less than 180°, and whether the signal combination level value X corresponds to Whether the ideal sine-cosine signal decoding angle is (0°~90°), if it meets the requirements, execute step 5, otherwise execute step 3; Step 3: Determine whether the combination angle θ is greater than 180° and less than 225°, and whether the ideal sine-cosine signal decoding angle corresponding to the signal combination level value X is (270°~360°), if it meets the requirements, execute step 6, otherwise execute step 4; Step 4: Determine whether the combination angle θ is greater than 315° and less than 360°, and whether the ideal sine-cosine signal decoding angle corresponding to the signal combination level value X is 3 (180°~270°), if it meets the requirements, execute step 6, otherwise execute step 7; Step 5: θ out =θ+180°, where: θ out To output the absolute position angle; Step 6: θ out =θ-180°, where: θ out To output the absolute position angle; Step 7: θ out =θ, where: out To output the absolute position angle.
[0079] Taking the above example as an example, when the calculated combined angle θ is 315° to 360°, and the ideal sin-cosine signal decoding angle corresponding to the signal combination level value 3 is (180° to 270°), it meets the requirements in the fourth step that the combined angle θ is greater than 315° and less than 360°, and the ideal sin-cosine signal decoding angle corresponding to the signal combination level value X is (180° to 270°). Therefore, step 6 is executed to subtract 180° from the combined angle θ to obtain a corrected absolute position angle of 135° to 180°; and compared with the ideal sin-cosine signal decoding angle of 180° to 270°, the absolute position angle has a maximum deviation of 45° in the angle range, which does not exceed the maximum deviation of the angle range corresponding to the sin-cosine signal group, where the maximum deviation is + / -45°; Figure 3 As shown, Figure 3 Schematic diagram of combined angle position jump correction.
[0080] Example 4, see Figure 4 , Figure 4: is a schematic diagram of the structure of an embodiment of an encoder absolute position angle decoding device provided by the present application, such as Figure 4 As shown, the device includes an angle combination module 401 and an angle correction module 402 .
[0081] The angle combination module 401 is used to obtain in real time the signal combination level value corresponding to the current sine and cosine signal group in the encoder and the current sine and cosine signal decoding angle, and combine the signal combination level value and the current sine and cosine decoding angle to obtain a combination angle.
[0082] The angle correction module 402 is used to perform judgment processing on the combined angle and the signal combination level value, and to perform correction processing on the combined angle based on the judgment result to obtain the absolute position angle of the encoder.
[0083] In one embodiment, the angle combination module 401 is used to combine the signal combination level value and the current sin-cosine decoding angle to obtain a combined angle, specifically including: substituting the signal combination level value and the current sin-cosine decoding angle into a preset combination angle calculation formula to obtain a combined angle.
[0084] In one embodiment, the angle correction module 402 is used to judge and process the combination angle and the signal combination level value, specifically including: judging whether the combination angle satisfies a first angle range, and whether the ideal sin-cosine signal decoding angle corresponding to the signal combination level value satisfies a first preset ideal angle, if not, judging whether the combination angle satisfies a second angle range, and whether the ideal sin-cosine signal decoding angle corresponding to the signal combination level value satisfies a second preset ideal angle; when the combination angle satisfies the first angle range, and the ideal sin-cosine signal decoding angle corresponding to the signal combination level value satisfies the first preset ideal angle, or when the combination angle satisfies the second angle range, and the ideal sin-cosine signal decoding angle corresponding to the signal combination level value satisfies the second preset ideal angle, outputting a judgment result that the first preset rule is satisfied; when the combination angle does not satisfy the second angle range, and / or the ideal sin-cosine signal decoding angle corresponding to the signal combination level value does not satisfy the second angle range, When the code angle does not satisfy the second preset ideal angle, it is determined whether the combined angle satisfies the third angle range, and whether the ideal sin-cosine signal decoding angle corresponding to the signal combination level value satisfies the third preset ideal angle. If not, it is determined whether the combined angle satisfies the fourth angle range, and whether the ideal sin-cosine signal decoding angle corresponding to the signal combination level value satisfies the fourth preset ideal angle. When the combined angle satisfies the third angle range, and the ideal sin-cosine signal decoding angle corresponding to the signal combination level value satisfies the third preset ideal angle, or when the combined angle satisfies the fourth angle range, and the ideal sin-cosine signal decoding angle corresponding to the signal combination level value satisfies the fourth preset ideal angle, the output judgment result is that the second preset rule is satisfied. When the combined angle does not satisfy the fourth angle range, and / or the ideal sin-cosine signal decoding angle corresponding to the signal combination level value does not satisfy the fourth preset ideal angle, the output judgment result is that the third preset rule is satisfied.
[0085] In one embodiment, the angle correction module 402 is used to correct the combined angle based on the judgment result to obtain the absolute position angle of the encoder, specifically including: when the judgment result is to meet the first preset rule, substituting the combined angle into the preset first angle correction formula to calculate the absolute position angle of the encoder; when the judgment result is to meet the second preset rule, substituting the combined angle into the preset second angle correction formula to calculate the absolute position angle of the encoder; when the judgment result is to meet the third preset rule, using the combined angle as the absolute position angle of the encoder.
[0086] In one embodiment, the angle combination module 401 is used to obtain in real time a signal combination level value corresponding to a current sin-cosine signal group in an encoder, specifically including: reading in real time a first sin-cosine signal level state corresponding to a first sin-cosine signal in the encoder, and a second sin-cosine signal level state corresponding to a second sin-cosine signal, and determining a current sin-cosine signal group of the encoder based on the first sin-cosine signal level state and the second sin-cosine signal level state; and determining a signal combination level value corresponding to the current sin-cosine signal group based on a pre-set sin-cosine signal state comparison table.
[0087] In one embodiment, the sine-cosine signal state comparison table includes sine-cosine signal groups, and signal combination level values corresponding to each sine-cosine signal group and standard sine-cosine signal decoding angles.
[0088] The above encoder absolute position angle decoding device can implement the encoder absolute position angle decoding method of the above method embodiment. The options in the above method embodiment are also applicable to this embodiment and will not be described in detail here.
[0089] like Figure 5 As shown, Figure 5 It is a structural diagram of an electronic device provided by the present application; it includes a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114, and the memory 113 is used to store computer programs.
[0090] In one embodiment of the present application, the processor 111 is used to implement the encoder absolute position angle decoding method provided by any one of the aforementioned method embodiments when executing the program stored in the memory 113.
[0091] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the encoder absolute position angle decoding method provided in any of the aforementioned method embodiments are implemented.
[0092] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0093] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0094] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0095] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for decoding the absolute position angle of an encoder, characterized in that: include: Acquire in real time the signal combination level value corresponding to the current sine and cosine signal group in the encoder and the current sine and cosine signal decoding angle, and combine the signal combination level value and the current sine and cosine decoding angle to obtain a combination angle; The combined angle and the signal combined level value are judged, and based on the judgment result, the combined angle is corrected to obtain the absolute position angle of the encoder.
2. The method according to claim 1, characterized in that The signal combination level value and the current sine-cosine decoding angle are combined to obtain a combined angle, specifically including: Substitute the signal combination level value and the current sine-cosine decoding angle into a preset combination angle calculation formula to obtain a combination angle.
3. The method according to claim 1, characterized in that The combined angle and the signal combined level value are judged and processed, specifically including: Determine whether the combined angle satisfies a first angle range, and whether the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies a first preset ideal angle; if not, determine whether the combined angle satisfies a second angle range, and whether the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies a second preset ideal angle; When the combination angle satisfies the first angle range, and the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the first preset ideal angle, or when the combination angle satisfies the second angle range, and the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the second preset ideal angle, the output judgment result is that the first preset rule is satisfied; When the combined angle does not satisfy the second angle range, and / or the ideal sine-cosine signal decoding angle corresponding to the signal combination level value does not satisfy the second preset ideal angle, determine whether the combined angle satisfies the third angle range, and whether the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the third preset ideal angle; if not, determine whether the combined angle satisfies the fourth angle range, and whether the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the fourth preset ideal angle; When the combination angle satisfies the third angle range, and the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the third preset ideal angle, or when the combination angle satisfies the fourth angle range, and the ideal sine-cosine signal decoding angle corresponding to the signal combination level value satisfies the fourth preset ideal angle, the output judgment result is that the second preset rule is satisfied; When the combination angle does not satisfy the fourth angle range, and / or the ideal sine-cosine signal decoding angle corresponding to the signal combination level value does not satisfy the fourth preset ideal angle, the output judgment result is that the third preset rule is satisfied.
4. The method according to claim 1, characterized in that: The combined angle is corrected based on the judgment result to obtain the absolute position angle of the encoder, specifically including: When the judgment result satisfies the first preset rule, the combined angle is substituted into the preset first angle correction formula to calculate the absolute position angle of the encoder; When the judgment result satisfies the second preset rule, the combined angle is substituted into a preset second angle correction formula to calculate the absolute position angle of the encoder; When the judgment result satisfies the third preset rule, the combined angle is used as the absolute position angle of the encoder.
5. The method according to claim 1, characterized in that: Real-time acquisition of the signal combination level value corresponding to the current sine and cosine signal group in the encoder, including: Reading in real time a first sine-cosine signal level state corresponding to a first sine-cosine signal and a second sine-cosine signal level state corresponding to a second sine-cosine signal in an encoder, and determining a current sine-cosine signal group of the encoder based on the first sine-cosine signal level state and the second sine-cosine signal level state; Based on a preset sine-cosine signal state comparison table, a signal combination level value corresponding to the current sine-cosine signal group is determined.
6. The method according to claim 5, characterized in that The sine-cosine signal state comparison table includes sine-cosine signal groups, and signal combination level values corresponding to each sine-cosine signal group and ideal sine-cosine signal decoding angles.
7. An encoder absolute position angle decoding device, characterized in that: include: Angle combination module and angle correction module; The angle combination module is used to obtain the signal combination level value corresponding to the current sine and cosine signal group in the encoder and the current sine and cosine signal decoding angle in real time, and combine the signal combination level value and the current sine and cosine decoding angle to obtain the combination angle; The angle correction module is used to judge the combined angle and the signal combination level value, and correct the combined angle based on the judgment result to obtain the absolute position angle of the encoder.
8. The device according to claim 7, characterized in that The angle combination module is used to combine the signal combination level value and the current sine-cosine decoding angle to obtain a combined angle, specifically including: Substitute the signal combination level value and the current sine-cosine decoding angle into a preset combination angle calculation formula to obtain a combination angle.
9. An electronic device, comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor coupled to the at least one bus; At least one memory connected to the at least one bus, wherein the processor is used to implement the encoder absolute position angle decoding method according to any one of claims 1-6 when executing the program stored in the memory.
10. A computer storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the encoder absolute position angle decoding method described in any one of claims 1 to 6 of the present application.