Correction Method, Device, Equipment and Storage Medium for Encoder Position Value Abnormality
By judging the abnormal position value of the acquisition period in the photoelectric encoder and correcting the position value of the overlapping encoding or multiple periods, the problem of poor anti-interference of the encoder is solved, and the stability and feedback reliability of the encoder are improved.
Patent Information
- Application Number
- CN202210951021.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-09
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2042-08-09
AI Technical Summary
The existing photoelectric encoder has poor anti-interference and is easily disturbed by tiny foreign objects such as dust, resulting in abnormal errors in position value encoding, which in turn causes fluctuations in position value feedback from the encoder.
By determining whether the abnormal position value was collected during the current acquisition period, if it is collected, the position value encoding of the previous acquisition period is obtained, and whether there is overlapping encoding between the front end of the abnormal position value encoding and the back end of the previous position value encoding. If there is, the correct position value is determined based on the overlap encoding and preset position value encoding set; if there is no, the correct position value is determined based on the position values of the first N and the next N acquisition periods, and finally the abnormal position value is corrected.
It effectively improves the anti-interference of the encoder, reduces the encoder feedback fluctuations caused by abnormal position values, and ensures the stability and reliability of the encoder.
Smart Images

Figure CN115326117B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and particularly to a method, device, equipment and storage medium for correcting abnormal encoder position values. Background Art
[0002] With the development of technology and the increasingly wide application of optoelectronic encoders, people have higher and higher requirements for the performance reliability and anti-interference ability of optoelectronic encoder applications.
[0003] Due to the high precision of the working principle of optoelectronic encoders, even tiny foreign objects such as dust sticking to the code track may interfere with the optical signals received by the photosensitive elements, resulting in abnormal errors in the position value codes read after the photosensitive elements are processed. Since the M sequence is a serial random sequence, its reading method is serial continuous shift reading, and the M sequence code values at adjacent positions differ greatly. Therefore, an error in the position value code of a certain code bit will cause large-range changes in the position values obtained by subsequent several sampling decodings, resulting in gross errors, and thus causing large fluctuations in the position values fed back by the encoder.
[0004] At the same time, when there are large-range changes in the absolute reading position value of the encoder, the difference between two positions during this period is very likely to pass through the zero point of one circle, which will cause the encoder to report an abnormal multi-turn position error. And tiny foreign objects such as dust may all cause multi-turn alarms of the encoder and lead to sudden abnormal shutdown of the machine. It can be seen that the existing encoders have poor anti-interference ability. Summary of the Invention
[0005] Embodiments of the present invention provide a method, device, equipment and storage medium for correcting abnormal encoder position values, aiming to solve the problem of poor anti-interference ability of existing encoders.
[0006] In a first aspect, embodiments of the present invention provide a method for correcting abnormal encoder position values, which includes:
[0007] Determine whether an abnormal position value is collected in the current acquisition period;
[0008] If the abnormal position value is collected, obtain the first position value code collected in the previous acquisition period;
[0009] Determine whether there is a first overlapping code between the front end of the abnormal position value code corresponding to the abnormal position value and the back end of the first position value code;
[0010] If the first overlapping code exists, determine the correct position value corresponding to the abnormal position value according to the first overlapping code and a preset position value code set;
[0011] If the first coincidence code does not exist, determine the correct position value according to the position values corresponding to each acquisition period in the previous N acquisition periods and the position values corresponding to each acquisition period in the subsequent N acquisition periods, where N is an integer greater than 1;
[0012] Correct the abnormal position value according to the correct position value.
[0013] In a second aspect, an encoder position value abnormal correction device provided by an embodiment of the present invention further includes:
[0014] A processing unit, configured to determine whether an abnormal position value is acquired in the current acquisition period;
[0015] An acquisition unit, configured to acquire a first position value code acquired in the previous acquisition period when the abnormal position value is acquired;
[0016] The processing unit is further configured to determine whether there is a first coincidence code between the front end of the abnormal position value code corresponding to the abnormal position value and the rear end of the first position value code; if the first coincidence code exists, determine the correct position value corresponding to the abnormal position value according to the first coincidence code and a preset position value code set; if the first coincidence code does not exist, determine the correct position value according to the position values corresponding to each acquisition period in the previous N acquisition periods and the position values corresponding to each acquisition period in the subsequent N acquisition periods, where N is an integer greater than 1; correct the abnormal position value according to the correct position value.
[0017] In a third aspect, an electronic device provided by an embodiment of the present invention further includes a memory and a processor, where a computer program is stored on the memory, and when the processor executes the computer program, the above method is implemented.
[0018] In a fourth aspect, a computer-readable storage medium provided by an embodiment of the present invention stores a computer program, where the computer program includes program instructions, and when the program instructions are executed by a processor, the above method can be implemented.
[0019] An embodiment of the present invention provides a method, apparatus, device, and storage medium for correcting abnormal encoder position values. The method includes: determining whether an abnormal position value is collected in the current acquisition period; if the abnormal position value is collected, acquiring the first position value code collected in the previous acquisition period; then determining whether there is a first overlapping code between the front end of the abnormal position value code corresponding to the abnormal position value and the rear end of the first position value code; if the first overlapping code exists, determining the correct position value corresponding to the abnormal position value according to the first overlapping code and a preset position value code set; if the first overlapping code does not exist, determining the correct position value according to the position values corresponding to each acquisition period in the previous N acquisition periods and the position values corresponding to each acquisition period in the next N acquisition periods, where N is an integer greater than 1; and finally correcting the abnormal position value according to the correct position value. In this solution, when an abnormal position value is collected, the abnormal position value can be corrected according to the overlapping code with the position value of the previous acquisition period or the position value corresponding to the position values of the previous and next N acquisition periods, which can improve the anti-interference ability of the encoder. Description of the Drawings
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0021] Figure 1 It is a schematic diagram of the application scenario of the method for correcting abnormal encoder position values provided by the embodiment of the present invention;
[0022] Figure 2 It is a schematic flowchart of the method for correcting abnormal encoder position values provided by the embodiment of the present invention;
[0023] Figure 3 It is a schematic diagram of the reading method of the encoder provided by the embodiment of the present invention;
[0024] Figure 4 It is a schematic sub-flowchart of the method for correcting abnormal encoder position values provided by the embodiment of the present invention;
[0025] Figure 5 It is a schematic diagram of multiple position value codes provided by the embodiment of the present invention;
[0026] Figure 6 It is a schematic flowchart of the method for correcting abnormal encoder position values provided by another embodiment of the present invention;
[0027] Figure 7Schematic block diagram of an encoder position value anomaly correction device provided by an embodiment of the present invention;
[0028] Figure 8 Schematic block diagram of an electronic device provided by an embodiment of the present invention. Detailed implementation manners
[0029] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0030] It should be understood that when used in this specification and the appended claims, the terms "comprises" and "comprising" indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0031] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in this specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" are intended to include the plural forms.
[0032] It should be further understood that the term " / and / " as used in this specification of the present invention and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0033] An embodiment of the present invention provides a method, device, equipment, and storage medium for correcting an abnormal encoder position value.
[0034] The execution subject of the method for correcting the abnormal encoder position value may be the encoder position value anomaly correction device provided by the embodiment of the present invention, or an electronic device integrated with the encoder position value anomaly correction device. Among them, the encoder position value anomaly correction device can be implemented in a hardware or software manner, and the electronic device can be an encoder. Among them, the encoder can be an M-sequence optoelectronic encoder or other processing devices connected to the encoder, such as other terminals (such as a computer) or a server.
[0035] In some embodiments, please refer to Figure 1 , Figure 1 Schematic diagram of an application scenario of the method for correcting an abnormal encoder position value provided by an embodiment of the present invention. The method for correcting the abnormal encoder position value is applied toFigure 1 In the encoder 10, the encoder 10 determines whether an abnormal position value is collected in the current acquisition period; if the abnormal position value is collected, the first position value code collected in the previous acquisition period is obtained; then it is determined whether there is a first overlapping code between the front end of the abnormal position value code corresponding to the abnormal position value and the rear end of the first position value code; if there is the first overlapping code, the correct position value corresponding to the abnormal position value is determined according to the first overlapping code and a preset position value code set; if there is no the first overlapping code, the correct position value is determined according to the position values corresponding to each acquisition period in the previous N acquisition periods and the position values corresponding to each acquisition period in the next N acquisition periods, where N is an integer greater than 1; finally, the abnormal position value is corrected according to the correct position value.
[0036] Figure 2 is a schematic flowchart of a method for correcting an abnormal encoder position value provided by an embodiment of the present invention. Taking the encoder as the execution subject, as Figure 2 shown, the method includes the following steps S110 - S170.
[0037] S110. Determine whether an abnormal position value is collected in the current acquisition period. If so, execute step S120; if not, execute step S170.
[0038] In this embodiment, the encoder itself determines whether the position value collected in the current acquisition period is an abnormal position value. Specifically, the collected position value code is decoded to obtain an absolute position value (the position value in this embodiment is an absolute position value). If the motor rotates normally, the difference between adjacent position values sampled is the same or increases regularly, that is, the motor is in uniform or uniformly variable motion at this time, indicating that the collected absolute value changes continuously. Under normal circumstances, there will be no sudden jump in the absolute value sampled during the operation of the motor. If there is a sudden jump, it indicates that the absolute value changes discontinuously. At this time, it is determined that the absolute value collected in the current sampling period is an abnormal absolute value.
[0039] In the prior art, when an abnormal absolute value is collected, a multi - turn alarm is performed immediately, and the anti - interference ability of the encoder is poor. To solve this problem, in the present invention, when an abnormal absolute value is collected, the first thing to do is to temporarily store the abnormal position value, and then correct the abnormal absolute value. After successful correction, there is no need to perform a multi - turn alarm, so as to improve the anti - interference ability of the encoder.
[0040] In a specific embodiment:
[0041] If one revolution of the encoder has a resolution of 10 bits, that is, 1024 absolute position values, then 1024 bits are defined as the zero point of one revolution. When the sampled position value code is a 10-bit binary code, the absolute position value needs to be obtained through decoding at this time, that is, a continuous absolute position value from 0 to 1023 is obtained. When the encoder samples several times as 300, 600, 900, 200 respectively, that is, the travel of the latter two positions passes through 1024 bits, it is considered that the motor has rotated one revolution, and the multi-turn value is incremented by 1 at this time.
[0042] If there are small foreign objects in the encoder, since the M code is a serial pseudo-random code and the position value code is a 10-bit binary code, changing any one bit in the 10-bit code will cause a large change in the actual position value obtained by decoding. For example, if the sampled values are 300, 600, 200 respectively, and the position values of the latter two samplings also pass through the zero point of one revolution, it will cause the multi-turn value of the encoder to be abnormal and report an encoder multi-turn alarm.
[0043] Specifically, if the motor rotates normally, the difference in the sampled position values is nearly a uniform or uniformly variable motion. For example, if the sampled position values are 0, 300, 600, 900 respectively, it is a uniform motion, and if the sampled position values are 0, 100, 300, 700 respectively, it is a uniformly accelerated motion. At this time, the absolute position values are all continuously changing.
[0044] If the speed of the motor suddenly changes during the current sampling period, such as 0, 300, 600, 200, then there is an obvious jump in the last (current sampling period) sampled value, which is defined as the discontinuity of the absolute position value. At this time, it is determined that an abnormal position value is collected in the current sampling period.
[0045] S120. Obtain the first position value code collected in the previous sampling period.
[0046] Specifically, read the first position value code from the memory. The purpose of obtaining the first position value code is to determine whether there is an overlapping part between the position value code of the current sampling period and the position value code collected in the previous sampling period, so as to determine the correction method.
[0047] S130. Determine whether there is a first overlapping code between the front end of the abnormal position value code corresponding to the abnormal position value and the rear end of the first position value code. If so, execute step S140; if not, execute step S150.
[0048] As Figure 3 shown, the reading method of the encoder in this embodiment is serial continuous shift reading. Generally, there will be a part of overlap between the rear end of the previous sampling period and the front end of the current sampling period. In the figure, the code in a rectangular frame represents the position value code sampled in one sampling period, and the sampling is carried out sequentially from left to right.
[0049] However, if the sampling position of the current sampling is discontinuous, or the motor speed exceeds the general rated speed, or the M-sequence level is relatively low. For example, when the track resolution is 512 and the motor speed is higher than 4,500 revolutions per minute, or the track resolution is 1,024 and the motor speed is higher than 8,000 revolutions per minute, the backend of the previous acquisition period will not coincide with the frontend of the current sampling period.
[0050] It should be noted that when the number of continuously overlapping first and last digits exceeds a preset value, it is only then that it is proved that there is an overlapping code at the beginning and end of the encodings of the two acquisition periods. Among them, the preset value can be 4 or other values, and specific details are not limited here.
[0051] S140. Determine the correct position value corresponding to the abnormal position value according to the first overlapping code and the preset position value encoding set.
[0052] In this embodiment, if there is an overlapping code, the position value encoding starting with the overlapping code is searched in the position value encoding set to determine the correct position value.
[0053] Specifically, please refer to Figure 4 , step S140 includes:
[0054] S1401. Search for candidate position value encodings starting with the first overlapping code in the position value encoding set. If there is 1 candidate position value encoding, execute step S1402. If there are multiple candidate position value encodings, execute step S1404.
[0055] In this embodiment, the position value encodings corresponding to each absolute position value are stored in the position value encoding set, where the position value encoding set is an M-sequence encoding.
[0056] Since the start of the position value encoding of the current acquisition period coincides with the end of the position value encoding of the previous acquisition period, according to the reading method of the encoder, it can be considered that the overlapping part at the front end of the abnormal position value encoding is the correct encoding. At this time, the position value encoding starting with the first overlapping code is searched in the position value encoding set as the candidate position value encoding.
[0057] Specifically, as Figure 5 shown, the overlapping code (i.e., the first overlapping code) existing between the front end of the abnormal position value encoding of the current period and the rear end of the first position value encoding of the previous period is: 0100101.
[0058] At this time, search for the position value encoding starting with 0100101 in the M-sequence encoding.
[0059] S1402. Determine the candidate position value encoding as the correct position value encoding.
[0060] If there is only one candidate position value code, directly use this candidate position value code as the correct position value code.
[0061] S1403. Determine the correct position value according to the correct position value code.
[0062] After obtaining the correct position value code, obtain the correct position value from this correct position value code.
[0063] S1404. Determine the correct position value from the candidate position values according to the position values corresponding to each cycle in the previous P acquisition cycles and the candidate position values corresponding to each candidate position value code.
[0064] Wherein, P is an integer greater than 1. For example, when the value of P is 3, if the position values corresponding to each candidate position value code are 300, 600, and 900, and the position values corresponding to each cycle in the previous P acquisition cycles are 0, 200, and 400 in sequence. At this time, according to the continuous rule of the position values corresponding to each cycle in the previous P acquisition cycles, the position value difference between cycles is 200. At this time, it indicates that the motor is moving at a constant speed, and it can be inferred that the correct position value is 600, and 600 is determined as the correct position value.
[0065] S150. Determine the correct position value according to the position values corresponding to each acquisition cycle in the previous N acquisition cycles and the position values corresponding to each acquisition cycle in the subsequent N acquisition cycles.
[0066] Wherein, N is an integer greater than 1.
[0067] In this embodiment, if there is no such first coincidence code, another method is used to determine the correct position value.
[0068] In some embodiments, step S150 includes:
[0069] a. Respectively determine the speed differences between different acquisition cycles according to the position values corresponding to each acquisition cycle in the previous N acquisition cycles, the position values corresponding to each acquisition cycle in the subsequent N acquisition cycles, and the preset sampling time interval.
[0070] Wherein, if N is 2, extract the position values (X1 and X2) of the previous 2 acquisition cycles and the position values (X3 and X4) of the subsequent 2 acquisition cycles, and perform speed change calculation and judge the continuity of the position values.
[0071] In some embodiments, the encoder sampling time interval is 62.5 us. At this time:
[0072] The speed difference between X2 and X1 is: (x2 - x1) / 62.5;
[0073] The speed difference between X4 and X2 is: (x4 - x2) / (2 * 62.5);
[0074] The speed difference between X5 and X4 is: (x5 - x4) / 62.5.
[0075] b. If the difference between the speed differences is less than or equal to a preset speed difference threshold, then determine the correct position value according to the speed difference and the position values of adjacent acquisition cycles.
[0076] Among them, the speed difference threshold can be 0.2 position value / us, or it can be other values, and it is not specifically limited here.
[0077] The difference between the speed differences being less than or equal to the preset speed difference threshold means that: the values of (x2 - x1) / 62.5, (x4 - x2) / (2 * 62.5), and (x5 - x4) / 62.5 are similar or equal.
[0078] If the difference between the speed differences is less than or equal to the preset speed difference threshold, that is, the calculated speed differences are basically equal, it means that only the position value of this single sampling is abnormal, and the rest of the sampling position values change continuously.
[0079] At this time, it is necessary to determine the correct position value according to the speed difference and the position values of adjacent acquisition cycles. Specifically, in some embodiments, determine the first position value according to the position value corresponding to the previous sampling cycle and the speed difference (for example, X2 + speed difference * 62.5), and determine the second position value according to the position value corresponding to the next sampling cycle and the speed difference (for example, X4 - speed difference * 62.5), and finally determine the average value of the first position value and the second position value as the correct position value.
[0080] It should be noted that if the difference between the speed differences is greater than the speed difference threshold, a multi-turn error alarm is issued.
[0081] S160. Correct the abnormal position value according to the correct position value.
[0082] It should be noted that in order to improve the accuracy of correction. In some embodiments, it is also necessary to further verify the obtained correct position value. If the verification passes, correct the abnormal position value according to the correct position value, correct the encoder multi-turn value, then the position correction is completed, and the abnormal position value of this single sampling will not affect the subsequent position feedback and will not generate cumulative errors.
[0083] If the verification fails, a multi-turn error alarm is issued.
[0084] Among them, the verification method is as follows:
[0085] Determine the coincidence rate between the correct position value code corresponding to the correct position value and the abnormal position value code; if the coincidence rate is greater than the preset coincidence threshold, it indicates that the verification is passed, and step S160 is executed. Otherwise, it indicates that the verification fails, and a multi-turn error alarm is issued. Here, the coincidence rate can be 50%, or other values, and specific values are not limited here.
[0086] As Figure 5 shown, if the calculated correct position value code (M-sequence code) is: "0100101101", and the actually read abnormal position value code is "0100101001", compare the two for coincidence to obtain the coincidence rate.
[0087] If the coincidence rate is greater than or equal to 50%, that is, the proportion of the number of incorrect codes in the total number of single-sampling codes is less than 50%. For example, only 1 or 2 code positions have incorrect codes. At this time, by comparing with the correct position value code, correct the incorrect code value. As Figure 5 shown, change the incorrect code "0" to "1", and correct the abnormal position value code "0100101001" to the correct position value code "0100101101", so as to correct the abnormal discontinuous absolute position value, and then synchronously correct the multi-turn position value of the encoder according to the correct position value.
[0088] If the coincidence rate is less than 50%, it means that the proportion of the number of incorrect codes in the single-sampling code quantity is higher than 50%. For example, if only the codes in the head and tail coincidence part are the same, and the actually read position codes for the rest are all different from the correct codes. At this time, it is impossible to correct the read code errors of all subsequent code positions through the head and tail coincidence part. The encoder reports a multi-turn error, and the encoder needs to be overhauled and analyzed again.
[0089] In this embodiment, because the M-sequence is a serial continuous shift reading method, when there are many head and tail coincidence codes in the two position value codes, the coding regions of the two position values are very close. Then the subsequent sampled position values may still involve this abnormal code position, resulting in the phenomenon of discontinuous absolute position values. Therefore, if there are discontinuous phenomena in several subsequent adjacent position values of this abnormal position value, the above-mentioned processing and judgment process is still used for error code and position value correction.
[0090] After correcting the error code in this embodiment, send the correct position value code to the corresponding servo.
[0091] S170, Normal operation.
[0092] In this embodiment, if it is determined that no abnormal position value is collected in the current sampling period, that is, the currently collected position value is a continuous position value, at this time, continue with the normal sampling work.
[0093] In summary, in this embodiment, it is determined whether an abnormal position value is collected in the current collection period; if the abnormal position value is collected, the first position value code collected in the previous collection period is obtained; then it is determined whether there is a first overlapping code between the front end of the abnormal position value code corresponding to the abnormal position value and the back end of the first position value code; if there is the first overlapping code, the correct position value corresponding to the abnormal position value is determined according to the first overlapping code and a preset set of position value codes; if there is no such first overlapping code, the correct position value is determined according to the position values corresponding to each collection period in the previous N collection periods and the position values corresponding to each collection period in the next N collection periods, where N is an integer greater than 1; finally, the abnormal position value is corrected according to the correct position value. In this solution, when an abnormal position value is collected, the abnormal position value can be corrected according to the overlapping code with the position value of the previous collection period or the position value corresponding to the position values of the previous and next N collection periods, which can improve the anti-interference ability of the encoder.
[0094] Figure 6 It is a schematic flowchart of a method for correcting an abnormal encoder position value provided by another embodiment of the present invention. As Figure 6 shown, the method for correcting an abnormal encoder position value in this embodiment includes steps S210-S290.
[0095] S210. Determine whether an abnormal position value is collected in the current collection period. If so, execute step S220; if not, execute step S209.
[0096] This step is similar to step S110 in the Figure 2 corresponding embodiment, and will not be elaborated here specifically.
[0097] S220. Obtain the first position value code and the second position value code.
[0098] Among them, the first position value code is the position value code collected in the previous collection period, and the second position value code is the position value code collected in the penultimate collection period.
[0099] Specifically, the first position value code and the second position value code are read from the memory.
[0100] S230. Determine whether there is a second overlapping code between the front end of the first position value code and the back end of the second position value code. If so, execute step S240; if not, execute step S270.
[0101] The purpose of reading the first position value code and the second position value code in this embodiment is to make a preliminary selection of the correction method after an abnormal position value is collected. For example, if there is a second coincidence code, the correct position value corresponding to the abnormal position value is determined according to the first coincidence code and a preset set of position value codes. If there is no second coincidence code, the step of determining the correct position value is executed according to the position values corresponding to each acquisition period in the previous N acquisition periods and the position values corresponding to each acquisition period in the next N acquisition periods.
[0102] It should be noted that when the consecutive coincident digits at the head and tail exceed a preset value, it proves that there is a coincidence code at the head and tail of the codes of two acquisition periods. Among them, the preset value can be 4 or other values, and specific values are not limited here.
[0103] As Figure 5 shown, there is a coincidence code between the first position value code and the second position value code. At this time, the second coincidence code is: 1010100.
[0104] S240. Obtain the first position value code.
[0105] S250. Determine whether there is a first coincidence code between the front end of the abnormal position value code corresponding to the abnormal position value and the back end of the first position value code. If so, execute step S260; if not, execute step S270.
[0106] S260. Determine the correct position value corresponding to the abnormal position value according to the first coincidence code and a preset set of position value codes.
[0107] S270. Determine the correct position value according to the position values corresponding to each acquisition period in the previous N acquisition periods and the position values corresponding to each acquisition period in the next N acquisition periods.
[0108] If there is no such second coincidence code, then if there is no such first coincidence code, then
[0109] S280. Correct the abnormal position value according to the correct position value.
[0110] S290. Work normally.
[0111] Among them, steps S240 - S290 are similar to S120 - S170 in the Figure 2 corresponding embodiment, and will not be elaborated here.
[0112] In summary, when an abnormal position value is collected in this embodiment, the abnormal position value can be corrected according to the coincidence code with the position value of the previous acquisition period or the position value corresponding to the position values of the previous and next N acquisition periods, which can improve the anti-interference ability of the encoder.
[0113] Figure 7 is a schematic block diagram of an encoder position value abnormal correction device provided by an embodiment of the present invention. As Figure 7 shown, corresponding to the above correction method for the abnormal encoder position value, the present invention also provides an encoder position value abnormal correction device. The encoder position value abnormal correction device includes a unit for executing the above correction method for the abnormal encoder position value, and the device can be configured in the encoder. Specifically, please refer to Figure 7 , the encoder position value abnormal correction device 700 includes an acquisition unit 701 and a processing unit 702.
[0114] The processing unit 702 is used to determine whether an abnormal position value is acquired in the current acquisition period;
[0115] The acquisition unit 701 is used to acquire the first position value code acquired in the previous acquisition period when the abnormal position value is acquired;
[0116] The processing unit 702 is further used to determine whether there is a first overlapping code between the front end of the abnormal position value code corresponding to the abnormal position value and the back end of the first position value code; if there is the first overlapping code, the correct position value corresponding to the abnormal position value is determined according to the first overlapping code and a preset position value code set; if there is no such first overlapping code, the correct position value is determined according to the position values corresponding to each acquisition period in the previous N acquisition periods and the position values corresponding to each acquisition period in the subsequent N acquisition periods, where N is an integer greater than 1; the abnormal position value is corrected according to the correct position value.
[0117] In some embodiments, when the processing unit 702 executes the step of determining the correct position value corresponding to the abnormal position value according to the first overlapping code and the preset position value code set, it specifically is used for:
[0118] Search for a candidate position value code starting with the first overlapping code in the position value code set;
[0119] If there is 1 candidate position value code, the candidate position value code is determined as the correct position value code;
[0120] Determine the correct position value according to the correct position value code;
[0121] If there are multiple candidate position value codes, the correct position value is determined from the candidate position values according to the position values corresponding to each period in the previous P acquisition periods and the candidate position values corresponding to each candidate position value code, where P is an integer greater than 1.
[0122] In some embodiments, when the processing unit 702 executes the step of determining the correct position value according to the position values corresponding to each acquisition period in the previous N acquisition periods and the position values corresponding to each acquisition period in the subsequent N acquisition periods, it is specifically configured to:
[0123] According to the position values corresponding to each acquisition period in the previous N acquisition periods, the position values corresponding to each acquisition period in the subsequent N acquisition periods, and the preset sampling time interval, respectively determine the speed differences between different acquisition periods;
[0124] If the difference between the speed differences is less than or equal to a preset speed difference threshold, then determine the correct position value according to the speed differences and the position values of adjacent acquisition periods.
[0125] In some embodiments, after the processing unit 702 executes the step of respectively determining the speed differences between different acquisition periods according to the position values corresponding to each acquisition period in the previous N acquisition periods, the position values corresponding to each acquisition period in the subsequent N acquisition periods, and the preset sampling time interval, it is further configured to:
[0126] If the difference between the speed differences is greater than the speed difference threshold, then issue a multi-turn error alarm.
[0127] In some embodiments, before the processing unit 702 executes the step of correcting the abnormal position value according to the correct position value, it is further configured to:
[0128] Judge the coincidence rate between the correct position value code corresponding to the correct position value and the abnormal position value code;
[0129] At this time, when the processing unit 702 executes the step of correcting the abnormal position value according to the correct position value, it is specifically configured to:
[0130] If the coincidence rate is greater than or equal to a preset coincidence threshold, then correct the abnormal position value according to the correct position value.
[0131] In some embodiments, after the processing unit 702 executes the step of judging the coincidence rate between the correct position value code corresponding to the correct position value and the abnormal position value code, it is further configured to:
[0132] If the coincidence rate is less than the preset coincidence threshold, then issue a multi-turn error alarm.
[0133] In some embodiments, after the processing unit 702 executes the step of judging whether an abnormal position value is collected in the current acquisition period, it is further configured to:
[0134] Obtain the first position value code and the second position value code collected in the acquisition period two before the previous one;
[0135] Determine whether there is a second overlapping code at the front end of the first position value code and the rear end of the second position value code;
[0136] If there is the second overlapping code, execute the step of obtaining the first position value code collected in the previous acquisition period;
[0137] If there is no such second overlapping code, execute the step of determining the correct position value according to the position values corresponding to each acquisition period in the previous N acquisition periods and the position values corresponding to each acquisition period in the subsequent N acquisition periods.
[0138] In summary, when the encoder position value anomaly correction device 700 in this embodiment collects an abnormal position value, it can correct the abnormal position value according to the overlapping code with the position value of the previous acquisition period or the position value corresponding to the position values of the previous and subsequent N acquisition periods, which can improve the anti-interference ability of the encoder.
[0139] It should be noted that those skilled in the art can clearly understand that the specific implementation processes of the above encoder position value anomaly correction device and each unit can refer to the corresponding descriptions in the foregoing method embodiments. For the sake of convenience and brevity of description, they will not be elaborated here.
[0140] The above encoder position value anomaly correction device can be implemented in the form of a computer program, and this computer program can run on an electronic device as shown in Figure 8 shown.
[0141] Please refer to Figure 8 , Figure 8 which is a schematic block diagram of an electronic device provided by an embodiment of the present invention. The electronic device 800 may be an encoder.
[0142] Refer to Figure 8 , the electronic device 800 includes a processor 802, a memory, and a network interface 805 connected through a system bus 801. Among them, the memory may include a non-volatile storage medium 803 and an internal memory 804.
[0143] The non-volatile storage medium 803 can store an operating system 8031 and a computer program 8032. The computer program 8032 includes program instructions, and when these program instructions are executed, the processor 802 can execute a method for correcting encoder position value anomalies.
[0144] The processor 802 is used to provide computing and control capabilities to support the operation of the entire electronic device 800.
[0145] The internal memory 804 provides an environment for the operation of the computer program 8032 in the non-volatile storage medium 803. When the computer program 8032 is executed by the processor 802, the processor 802 can be caused to execute a method for correcting an abnormal encoder position value.
[0146] The network interface 805 is used for network communication with other devices. Those skilled in the art can understand that Figure 8 the structure shown in is only a block diagram of some structures related to the solution of the present invention, and does not constitute a limitation on the electronic device 800 to which the solution of the present invention is applied. The specific electronic device 800 may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0147] Among them, the processor 802 is used to run the computer program 8032 stored in the memory to implement the following steps:
[0148] Determine whether an abnormal position value is collected in the current collection period;
[0149] If the abnormal position value is collected, obtain the first position value code collected in the previous collection period;
[0150] Determine whether there is a first overlapping code between the front end of the abnormal position value code corresponding to the abnormal position value and the back end of the first position value code;
[0151] If there is the first overlapping code, determine the correct position value corresponding to the abnormal position value according to the first overlapping code and a preset set of position value codes;
[0152] If there is no such first overlapping code, determine the correct position value according to the position values corresponding to each collection period in the previous N collection periods and the position values corresponding to each collection period in the next N collection periods, where N is an integer greater than 1;
[0153] Correct the abnormal position value according to the correct position value.
[0154] In some embodiments, when the processor 802 implements the step of determining the correct position value corresponding to the abnormal position value according to the first overlapping code and a preset set of position value codes, the following steps are specifically implemented:
[0155] Search for a candidate position value code starting with the first overlapping code in the set of position value codes;
[0156] If there is 1 candidate position value code, determine the candidate position value code as the correct position value code;
[0157] Determine the correct position value according to the determined correct position value coding;
[0158] If there are multiple candidate position value codings, determine the correct position value from the candidate position values according to the position values corresponding to each period in the previous P acquisition periods and the candidate position values corresponding to each candidate position value coding, where P is an integer greater than 1.
[0159] In some embodiments, when the processor 802 implements the step of determining the correct position value according to the position values corresponding to each acquisition period in the previous N acquisition periods and the position values corresponding to each acquisition period in the next N acquisition periods, the following steps are specifically implemented:
[0160] According to the position values corresponding to each acquisition period in the previous N acquisition periods, the position values corresponding to each acquisition period in the next N acquisition periods, and the preset sampling time interval, respectively determine the speed differences between different acquisition periods;
[0161] If the difference between the speed differences is less than or equal to the preset speed difference threshold, determine the correct position value according to the speed difference and the position values of adjacent acquisition periods.
[0162] In some embodiments, after the processor 802 implements the step of respectively determining the speed differences between different acquisition periods according to the position values corresponding to each acquisition period in the previous N acquisition periods, the position values corresponding to each acquisition period in the next N acquisition periods, and the preset sampling time interval, the following steps are further implemented:
[0163] If the difference between the speed differences is greater than the speed difference threshold, issue a multi-turn error alarm.
[0164] In some embodiments, before the processor 802 implements the step of correcting the abnormal position value according to the correct position value, the following steps are further implemented:
[0165] Judge the coincidence rate between the correct position value coding corresponding to the correct position value and the abnormal position value coding;
[0166] At this time, when the processor 802 implements the step of correcting the abnormal position value according to the correct position value, the following steps are specifically implemented:
[0167] If the coincidence rate is greater than or equal to the preset coincidence threshold, correct the abnormal position value according to the correct position value.
[0168] In some embodiments, after the processor 802 implements the step of judging the coincidence rate between the correct position value coding corresponding to the correct position value and the abnormal position value coding, the following steps are further implemented:
[0169] If the coincidence rate is less than the preset coincidence threshold, a multi-turn error alarm is issued.
[0170] In some embodiments, after the processor 802 implements the step of determining whether an abnormal position value is collected in the current acquisition cycle, the following steps are further implemented:
[0171] Obtain the first position value code and the second position value code collected in the penultimate acquisition cycle;
[0172] Determine whether there is a second coincidence code at the front end of the first position value code and the rear end of the second position value code;
[0173] If there is the second coincidence code, execute the step of obtaining the first position value code collected in the previous acquisition cycle;
[0174] If there is no second coincidence code, execute the step of determining the correct position value according to the position values corresponding to each acquisition cycle in the previous N acquisition cycles and the position values corresponding to each acquisition cycle in the subsequent N acquisition cycles.
[0175] It should be understood that in the embodiments of the present invention, the processor 802 may be a central processing unit (CPU), and the processor 802 may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0176] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, and the storage medium is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the flow steps of the embodiments of the above methods.
[0177] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, and the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the following steps:
[0178] Determine whether an abnormal position value is collected in the current collection period;
[0179] If the abnormal position value is collected, obtain the first position value code collected in the previous collection period;
[0180] Determine whether there is a first overlapping code between the front end of the abnormal position value code corresponding to the abnormal position value and the back end of the first position value code;
[0181] If there is the first overlapping code, determine the correct position value corresponding to the abnormal position value according to the first overlapping code and a preset position value code set;
[0182] If there is no first overlapping code, determine the correct position value according to the position values corresponding to each collection period in the previous N collection periods and the position values corresponding to each collection period in the next N collection periods, where N is an integer greater than 1;
[0183] Correct the abnormal position value according to the correct position value.
[0184] In some embodiments, when the processor executes the program instructions to implement the step of determining the correct position value corresponding to the abnormal position value according to the first overlapping code and a preset position value code set, the following steps are specifically implemented:
[0185] Search for a candidate position value code starting with the first overlapping code in the position value code set;
[0186] If there is 1 candidate position value code, determine the candidate position value code as the correct position value code;
[0187] Determine the correct position value according to the correct position value code;
[0188] If there are multiple candidate position value codes, determine the correct position value from the candidate position values according to the position values corresponding to each period in the previous P collection periods and the candidate position values corresponding to each candidate position value code, where P is an integer greater than 1.
[0189] In some embodiments, when the processor executes the program instructions to implement the step of determining the correct position value according to the position values corresponding to each collection period in the previous N collection periods and the position values corresponding to each collection period in the next N collection periods, the following steps are specifically implemented:
[0190] According to the position values corresponding to each collection period in the previous N collection periods, the position values corresponding to each collection period in the next N collection periods, and a preset sampling time interval, respectively determine the speed differences between different collection periods;
[0191] If the difference between the speed differences is less than or equal to a preset speed difference threshold, determine the correct position value according to the speed difference and the position values of adjacent acquisition cycles.
[0192] In some embodiments, after the processor executes the program instructions to implement the step of respectively determining the speed differences between different acquisition cycles according to the position values corresponding to each acquisition cycle in the previous N acquisition cycles, the position values corresponding to each acquisition cycle in the next N acquisition cycles, and the preset sampling time interval, the following steps are further implemented:
[0193] If the difference between the speed differences is greater than the speed difference threshold, issue a multi-turn error alarm.
[0194] In some embodiments, before the processor executes the program instructions to implement the step of correcting the abnormal position value according to the correct position value, the following steps are further implemented:
[0195] Judge the coincidence rate between the correct position value code corresponding to the correct position value and the abnormal position value code;
[0196] At this time, when the processor executes the program instructions to implement the step of correcting the abnormal position value according to the correct position value, the following steps are specifically implemented:
[0197] If the coincidence rate is greater than or equal to a preset coincidence threshold, correct the abnormal position value according to the correct position value.
[0198] In some embodiments, after the processor executes the program instructions to implement the step of judging the coincidence rate between the correct position value code corresponding to the correct position value and the abnormal position value code, the following steps are further implemented:
[0199] If the coincidence rate is less than the preset coincidence threshold, issue a multi-turn error alarm.
[0200] In some embodiments, after the processor executes the program instructions to implement the step of judging whether an abnormal position value is acquired in the current acquisition cycle, the following steps are further implemented:
[0201] Obtain the first position value code and the second position value code acquired in the penultimate acquisition cycle;
[0202] Judge whether there is a second coincidence code at the front end of the first position value code and the rear end of the second position value code;
[0203] If there is the second coincidence code, execute the step of obtaining the first position value code acquired in the previous acquisition cycle;
[0204] If there is no such second coincidence code, execute determining the correct bit according to the position values corresponding to each acquisition period in the previous N acquisition periods and the position values corresponding to each acquisition period in the subsequent N acquisition periods
[0205] The storage medium may be a variety of computer-readable storage media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disc, etc., which can store program codes
[0206] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention
[0207] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed
[0208] The steps in the method embodiments of the present invention can be adjusted, combined, and deleted according to actual needs. The units in the device embodiments of the present invention can be combined, divided, and deleted according to actual needs. In addition, the functional units in each embodiment of the present invention can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit
[0209] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions to enable an electronic device (which may be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present invention
[0210] As described above, it is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of various equivalent modifications or substitutions, and these modifications or substitutions should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A method for correcting abnormal encoder position values, characterized in that, it includes: judging whether an abnormal position value is collected in the current collection period; if the abnormal position value is collected, obtaining the first position value code collected in the previous collection period; judging whether there is a first overlapping code between the front end of the abnormal position value code corresponding to the abnormal position value and the back end of the first position value code; if there is the first overlapping code, determining the correct position value corresponding to the abnormal position value according to the first overlapping code and a preset position value code set; if there is no first overlapping code, determining the correct position value according to the position values corresponding to each collection period in the previous N collection periods and the position values corresponding to each collection period in the next N collection periods, where N is an integer greater than 1; correcting the abnormal position value according to the correct position value.
2. The method according to claim 1, characterized in that, the determining the correct position value corresponding to the abnormal position value according to the first overlapping code and a preset position value code set includes: searching in the position value code set for candidate position value codes starting with the first overlapping code; if there is 1 candidate position value code, determining the candidate position value code as the correct position value code; determining the correct position value according to the correct position value code; if there are multiple candidate position value codes, determining the correct position value from the candidate position values according to the position values corresponding to each period in the previous P collection periods and the candidate position values corresponding to each candidate position value code, where P is an integer greater than 1.
3. The method according to claim 1, characterized in that, the determining the correct position value according to the position values corresponding to each collection period in the previous N collection periods and the position values corresponding to each collection period in the next N collection periods includes: respectively determining the speed differences between different collection periods according to the position values corresponding to each collection period in the previous N collection periods, the position values corresponding to each collection period in the next N collection periods, and a preset sampling time interval; if the difference between the speed differences is less than or equal to a preset speed difference threshold, determining the correct position value according to the speed differences and the position values of adjacent collection periods.
4. The method according to claim 3, characterized in that, after respectively determining the speed differences between different collection periods according to the position values corresponding to each collection period in the previous N collection periods, the position values corresponding to each collection period in the next N collection periods, and a preset sampling time interval, the method further includes: if the difference between the speed differences is greater than the speed difference threshold, sending out a multi-turn error alarm.
5. The method according to claim 1, characterized in that, before correcting the abnormal position value according to the correct position value, the method further includes: judging the coincidence rate between the correct position value code corresponding to the correct position value and the abnormal position value code; the correcting the abnormal position value according to the correct position value includes: if the coincidence rate is greater than or equal to a preset coincidence threshold, correcting the abnormal position value according to the correct position value.
6. The method according to claim 5, wherein, after determining the coincidence rate between the correct position value code corresponding to the correct position value and the abnormal position value code, the method further includes: if the coincidence rate is less than the preset coincidence threshold, a multi-turn error alarm is issued.
7. The method according to any one of claims 1 to 6, wherein, after determining whether an abnormal position value is collected in the current collection period, the method further includes: obtaining the first position value code and the second position value code collected in the penultimate collection period; judging whether there is a second coincidence code at the front end of the first position value code and the rear end of the second position value code; if there is the second coincidence code, performing the step of obtaining the first position value code collected in the previous collection period; if there is no such second coincidence code, performing the step of determining the correct position value according to the position values corresponding to each collection period in the previous N collection periods and the position values corresponding to each collection period in the subsequent N collection periods.
8. An encoder position value abnormal correction device, wherein, comprising: a processing unit, configured to determine whether an abnormal position value is collected in the current collection period; an obtaining unit, configured to obtain the first position value code collected in the previous collection period when the abnormal position value is collected; the processing unit is further configured to judge whether there is a first coincidence code at the front end of the abnormal position value code corresponding to the abnormal position value and the rear end of the first position value code; if there is the first coincidence code, determining the correct position value corresponding to the abnormal position value according to the first coincidence code and a preset position value code set; if there is no such first coincidence code, determining the correct position value according to the position values corresponding to each collection period in the previous N collection periods and the position values corresponding to each collection period in the subsequent N collection periods, where N is an integer greater than 1; and correcting the abnormal position value according to the correct position value.
9. An electronic device, wherein, the electronic device includes a memory and a processor, a computer program is stored on the memory, and when the processor executes the computer program, the method according to any one of claims 1-7 is implemented.
10. A computer-readable storage medium, wherein, the storage medium stores a computer program, the computer program includes program instructions, and when the program instructions are executed by a processor, the method according to any one of claims 1-7 can be implemented.
Citation Information
Patent Citations
Motor encoder detection method and device of mechanical arm, mechanical arm and memory
CN112776004A
Encoder anomaly detection method and device, storage medium, controller and equipment
CN113406979A