Dual-encoder error compensation and power-up position recovery method, joint module, robot and storage medium

CN122524170BActive Publication Date: 2026-10-09HANGZHOU YUNSHENCHU TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202611001388.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-07-07
Publication Date
2026-10-09
Estimated Expiration
2046-07-07

AI Technical Summary

Technical Problem

[0008]本发明的目的在于提供一种双编码器的误差补偿及上电位置恢复方法,以解决现有技术中低成本单圈绝对值编码器无法消除正反转机械回差误差、断电后无法记忆高速端位置导致需要重新回零的技术问题

Benefits of technology

第一,通过控制关节模组分别进行正向旋转和反向旋转,并利用高精度的高速端编码器作为基准对低速端编码器进行标定,解决了低速端大磁环离轴单磁编码器因安装偏心、磁场分布不均、离轴测量误差等因素导致的原始角度误差大的问题,显著提高了低速端编码器的绝对角度测量精度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122524170B_ABST
    Figure CN122524170B_ABST
Patent Text Reader

Abstract

The application discloses a double-encoder error compensation and power-on position recovery method, a joint module, a robot and a storage medium, and the method comprises the following steps: controlling the joint module to rotate forward and reversely respectively, obtaining the angle value of a high-speed end encoder and converting the angle value into an output end reference angle according to a deceleration ratio; collecting the original angle of a low-speed end encoder according to a preset angle division point, and establishing a forward rotation compensation table and a reverse rotation compensation table; receiving a zero position setting instruction, and saving a forward rotation zero position offset and a reverse rotation zero position offset; compensating the original angle according to a corresponding compensation table according to a motion direction, subtracting the corresponding zero position offset to obtain a compensated angle; reading the original angle of the low-speed end encoder after power-on, and calculating the initialization number of turns of the high-speed end encoder after compensation and ring average processing. The application calibrates the low-speed end encoder bidirectionally by using the high-speed end encoder, establishes double compensation tables and sets double zero position offsets, and realizes low-cost and high-precision angle measurement and position recovery after power failure.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of robot position detection technology, and more specifically, to a method for error compensation and power-on position recovery using dual encoders, a joint module and robot, and a storage medium. Background Technology

[0002] This section provides only background information relevant to this disclosure and is not necessarily prior art.

[0003] With the rapid development of robotics technology, joint modules, as core moving components of robots, directly affect the robot's motion control performance and end effector accuracy through their position detection accuracy and angle measurement accuracy. In position detection schemes for joint modules, encoders are typically used to obtain the angular position information of the motor shaft or output shaft. Common encoder types in existing technologies include magnetic encoders and photoelectric encoders. Among them, magnetic encoders are widely used in robot joint modules due to their advantages such as simple structure, strong anti-interference ability, and moderate cost.

[0004] However, existing robot joint modules using a single low-speed magnetic encoder suffer from significant position measurement accuracy issues. Specifically, the low-speed end (i.e., the reducer output side) typically employs a large magnetic ring paired with a single off-axis magnetic encoder. Due to factors such as uneven magnetic field caused by the large magnetic ring's manufacturing process, assembly eccentricity, and off-axis measurement errors, the absolute angular error at the output end can reach approximately ±5°, failing to meet the requirements of high-precision joint control. Such errors are unacceptable in high-precision robot applications. More critically, due to the combined effects of manufacturing processes, installation errors, and magnetic pole uniformity, the error curve of the low-speed encoder is not linear and exhibits significant asymmetry, with substantial differences between the error curves for forward and reverse rotation. This asymmetry prevents traditional single static compensation meter solutions from simultaneously addressing error compensation needs in both directions, as the compensation effect of the same static compensation meter deviates considerably between forward and reverse rotation.

[0005] Furthermore, in existing schemes using a single zero-position offset, the zero-position offset value is measured in a specific direction, which creates a step-like deviation in the overall position reading when switching directions. This is because the zero-position offset during forward rotation and the zero-position offset during reverse rotation should actually be different. If a uniform zero-position offset is used for calculation, the output angle will jump at the instant of switching between forward and reverse directions, affecting the smoothness and positioning accuracy of the control system. This problem is particularly prominent in high-reduction-ratio joint modules, because the reduction ratio of the reducer is usually between 10:1 and 100:1. A small angular error at the high-speed end (i.e., the motor shaft or the reducer input shaft) is amplified by the reduction ratio and becomes a larger angular error at the output end, further exacerbating the position measurement accuracy problem.

[0006] On the other hand, existing technologies also face challenges in multi-turn position recovery from high-speed encoders. High-speed encoders are typically incremental encoders or single-turn absolute encoders. When the joint module is powered off and then powered on again, only the absolute position of the motor shaft for a single turn can be obtained, and the number of turns already rotated cannot be directly obtained. This results in the loss of the robot joint's position state after power-on, requiring a homing operation to re-establish the absolute position coordinate system. Traditional homing methods usually rely on external sensors or mechanical limit devices, requiring the joint to be rotated to a specific mechanical position to complete the calibration. This is not only cumbersome but also difficult to implement in certain application scenarios (such as when the joint's range of motion is limited). Some existing high-precision solutions use multi-turn absolute encoders to directly obtain the number of turns, but the cost of multi-turn absolute encoders is much higher than that of single-turn encoders, significantly increasing the overall cost of the joint module.

[0007] In summary, existing technologies for robot joint module position detection suffer from the following technical problems: large absolute angle errors and asymmetry in forward and reverse rotation of the low-speed large magnetic ring single magnetic encoder; the inability of a single static compensation meter to effectively balance compensation accuracy in both directions; step-like deviations caused by a single zero-position offset during direction switching; difficulty in recovering multi-turn positions after power failure and restoration at high-speed speeds; further amplification of output errors due to high reduction ratios; and reliance on high-cost multi-turn absolute encoders for high-precision position detection. These problems hinder further improvements in the position detection accuracy and control performance of robot joint modules, necessitating a solution that effectively addresses these technical issues. Summary of the Invention

[0008] The purpose of this invention is to provide a method for error compensation and power-on position recovery of dual encoders, so as to solve the technical problems in the prior art where low-cost single-turn absolute encoders cannot eliminate mechanical backlash errors in forward and reverse rotation, and cannot remember the high-speed end position after power failure, thus requiring re-zeroing.

[0009] To achieve the above objectives, the first aspect of this application proposes a method for error compensation and power-on position recovery using dual encoders, comprising: The joint module is controlled to rotate in the forward and reverse directions respectively to obtain the original high-speed end angle value output by the high-speed end encoder, and the original high-speed end angle value is converted into the output end reference angle value according to the reduction ratio. During forward and reverse rotation, the original low-speed end angle output by the low-speed end encoder is collected at preset angle points, and forward rotation compensation table and reverse rotation compensation table are established respectively. Upon receiving the zero-position setting command, the current position of the joint module is compensated and saved as the forward zero-position offset and the reverse zero-position offset; Based on the current motion direction of the joint module, the corresponding compensation table is selected and called to compensate the original low-speed end angle. The compensation result is then subtracted from the corresponding zero offset to obtain the low-speed end compensation angle. When the joint module is powered on, it reads the original angle currently output by the low-speed encoder, performs compensation and ring averaging on the reading result to obtain the compensation angle, and calculates the number of revolutions of the high-speed encoder, using the number of revolutions as the initial number of revolutions.

[0010] According to the error compensation and power-on position recovery method for dual encoders provided in this application, the step of collecting the original low-speed end angle output by the low-speed end encoder at preset angle points during forward and reverse rotation, and establishing forward rotation compensation table and reverse rotation compensation table respectively, includes: The joint module is driven to step by a given angle in a position mode, performing one revolution in the forward direction and one revolution in the reverse direction. Divide 0-360° into n preset angle points. Record the original low-speed end angles according to the preset angle points when the joint module rotates forward and when it rotates backward, respectively forming forward sampling sequence and reverse sampling sequence. The forward sampling sequence and the reverse sampling sequence are sorted to obtain the forward compensation table and the reverse compensation table.

[0011] According to the error compensation and power-on position recovery method of dual encoders provided in this application, 0-360° is divided into 256 preset angle division points.

[0012] According to the error compensation and power-on position recovery method for dual encoders provided in this application, the compensation for the original low-speed end angle includes: The original low-speed end angle is read in real time, and a forward or reverse compensation table is selected according to the movement direction of the joint module. Linear interpolation compensation is performed based on the range of the original low-speed end angle.

[0013] According to the error compensation and power-on position recovery method for dual encoders provided in this application, the step of receiving the zero-position setting command and compensating the current position of the joint module and saving it as a forward zero-position offset and a reverse zero-position offset includes: Upon receiving a zero-position setting command, and with the joint module in a stationary state, mark the current position as zero. Calculate the compensation angle at the current position based on the forward rotation compensation table and the reverse rotation compensation table; The angle at the current position is sampled multiple times and the compensation angle is calculated. The compensation result is then averaged using a circular averaging process, and the average value is saved as the forward zero-position offset and the reverse zero-position offset, respectively.

[0014] According to the error compensation and power-on position recovery method for dual encoders provided in this application, the step of performing compensation and circumferential averaging on the reading results to obtain the compensation angle includes: The original low-speed end angle output by the low-speed end encoder is sampled multiple times, and the average value of the multiple sampled values ​​is obtained by ring averaging. The average value is passed through the forward compensation table and the reverse compensation table respectively, and then a circular average is performed on the compensation results to obtain the compensation angle θ of the low-speed encoder. out .

[0015] According to the error compensation and power-on position recovery method for dual encoders provided in this application, the step of calculating the number of revolutions of the high-speed encoder and using the number of revolutions as the initial number of revolutions includes: Read the compensation angle θ of the low-speed encoder out The reduction ratio GR and the single-turn resolution CPR of the high-speed end encoder; Calculate the theoretical total count C of the high-speed encoder. theory =θ out ×GR×CPR / 2π; Read the single-turn position information θ of the high-speed encoder when it is powered on. m0 ; Calculate the current single-lap count C single =θ m0 ×CPR / 2π; Calculate the number of candidate laps N init =round((C theory -C single ( / CPR); Calculate the initial total count C init =C single +N init ×CPR; According to |C theory -Cinit |>CPR / 2, corrected lap number N init’ =N init ±1, output high-speed terminal initialization number N init’ ; According to |C theory -C init |≤CPR / 2, output the initial number of high-speed loops N init .

[0016] The second aspect of this application proposes a joint module, including a motor, a reducer connected to the output shaft of the motor, a high-speed encoder disposed on the input side of the motor shaft or the reducer, a low-speed encoder disposed on the output side of the reducer, and a controller, characterized in that the controller is configured to perform the error compensation and power-on position recovery method of the dual encoder in any of the above technical solutions.

[0017] The joint module of this invention has the same advantages as the above-described dual encoder error compensation and power-on position recovery method, which will not be repeated here.

[0018] A third aspect of this application proposes a robot comprising a joint module of any of the above-described technical solutions.

[0019] The robot of this invention has the same advantages as the joint module described above, and will not be repeated here.

[0020] The fourth aspect of this application proposes a computer-readable storage medium having a computer program stored thereon, which, when executed by a controller, implements the error compensation and power-on position recovery method for dual encoders according to any of the above technical solutions.

[0021] The computer-readable storage medium of this invention has the same advantages as the error compensation and power-on position recovery method of the dual encoder described above, and will not be repeated here.

[0022] Compared with the prior art, the present invention has the following beneficial effects: First, by controlling the joint module to rotate forward and backward respectively, and using a high-precision high-speed encoder as a reference to calibrate the low-speed encoder, the problem of large original angle error caused by factors such as installation eccentricity, uneven magnetic field distribution, and off-axis measurement error of the low-speed large magnetic ring off-axis single magnetic encoder is solved, which significantly improves the absolute angle measurement accuracy of the low-speed encoder.

[0023] Secondly, by establishing forward rotation compensation tables and reverse rotation compensation tables respectively during forward and reverse rotation, error compensation is performed for the forward and reverse motion directions respectively. This solves the problem of asymmetric forward and reverse rotation errors caused by reducer backlash, friction hysteresis and magnetic field directionality differences, enabling the joint module to obtain high-precision angle output in different motion directions.

[0024] Third, by receiving the zero-position setting command, the current position is compensated and saved as the forward and reverse zero-position offsets. During operation, the corresponding zero-position offset is subtracted according to the direction of movement, eliminating the overall step deviation during direction switching and ensuring the continuity and consistency of angle output during forward and reverse switching.

[0025] Fourth, by reading the original angle currently output by the low-speed encoder after power-on, and calculating the initial number of turns of the high-speed encoder after compensation and ring averaging, the power-on position recovery function without the need for a high-cost multi-turn absolute encoder is realized. This allows the joint module to accurately restore its position before power failure when power is restored after a power failure, without having to return to zero again, which greatly reduces system cost and improves ease of use.

[0026] In summary, without adding a high-cost dual-redundant absolute value sensor, this invention utilizes the existing dual encoder structure in the joint module and employs a comprehensive set of technical means, including bidirectional calibration, dual-meter compensation, dual zero-position correction, and power-on position estimation, to achieve low-cost, high-precision, and high-reliability angle measurement at the joint module output end and position retention after power failure. Attached Figure Description

[0027] The accompanying drawings, which form part of this application, are used to provide a further understanding of the application and to make other features, objects, and advantages of the application more apparent. The illustrative embodiments and descriptions of this application are used to explain the application and do not constitute an undue limitation of the application. In the drawings: Figure 1 This is a flowchart of the error compensation and power-on position recovery method for dual encoders provided in an embodiment of the present invention; Figure 2 This is a flowchart for calculating the number of revolutions of the high-speed encoder, as provided in an embodiment of the present invention, and using the number of revolutions as the initial number of revolutions. Detailed Implementation

[0028] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0029] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0030] In this application, the terms "upper," "lower," "left," "right," "front," "rear," "top," "bottom," "inner," "outer," "middle," "vertical," "horizontal," "lateral," and "longitudinal" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. These terms are primarily for the purpose of better describing this application and its embodiments, and are not intended to limit the indicated device, element, or component to having a specific orientation, or to be constructed and operated in a specific orientation.

[0031] Furthermore, in addition to indicating location or positional relationship, some of the aforementioned terms may also have other meanings. For example, the term "above" may also be used in some cases to indicate a certain dependency or connection relationship. Those skilled in the art can understand the specific meaning of these terms in this application based on the specific circumstances.

[0032] Furthermore, the terms "installation," "setup," "equipped with," "connection," "linked," and "socketing" should be interpreted broadly. For example, "connection" can be a fixed connection, a detachable connection, or an integral structure; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or an internal connection between two devices, components, or parts. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.

[0033] This invention provides a method for error compensation and power-on position recovery using dual encoders. The method is applied to a joint module, which includes a motor, a reducer connected to the motor's output shaft, a high-speed encoder mounted on the motor shaft or the reducer's input shaft, and a low-speed encoder mounted on the reducer's output side. The high-speed encoder is typically an on-shaft single magnetic encoder used to measure the angular displacement and angular velocity of the motor shaft or the reducer's input shaft, offering high accuracy. The low-speed encoder is typically a large magnetic ring combined with a single off-shaft magnetic encoder used to measure the absolute angle of the reducer's output shaft, offering lower cost but with a larger initial error. This method is executed by the joint module's controller.

[0034] In some embodiments of the present invention, the high-speed encoder can be a magnetic encoder or a photoelectric encoder, whose output is the absolute angle information of a single revolution of the motor shaft. The resolution of this single-revolution angle information is determined by the number of lines of the encoder, usually expressed as pulses per revolution (CPR). The low-speed encoder uses a scheme of a large magnetic ring combined with a single off-axis magnetic encoder. The large magnetic ring is a single pair of poles. When the motor shaft rotates one revolution, the reducer output shaft rotates an angle of 1 / GR revolution, where GR is the reduction ratio of the reducer. Therefore, one revolution of the high-speed encoder corresponds to one / GR revolution of the low-speed encoder. The controller reads the raw angle data of the two encoders in real time through the communication interface and processes it according to the compensation algorithm of the present invention, finally outputting accurate absolute angle information of the output end.

[0035] The present invention will now be described in detail with reference to specific implementation steps.

[0036] like Figure 1 As shown, the specific operation process for bidirectional calibration is as follows. First, the control joint module enters the calibration mode. In this mode, the controller drives the motor to operate in position mode, performing step rotation at a low angular velocity. Specifically, the drive joint module rotates one revolution in the forward direction by a given angle at a low speed in position mode. The low speed here is, for example, 1 rad / s. The low rotation speed helps to reduce the impact of dynamic errors on calibration accuracy, ensuring that the collected angle data mainly reflects the static error characteristics. One revolution in the forward direction is defined as the output end of the joint module starting from any starting position, rotating 360 degrees in the forward direction, and returning to the same mechanical angle as the starting position. Since the rotation angle of the output end is equal to the rotation angle of the input end divided by the reduction ratio GR, the actual required high-speed end rotation angle is 360 degrees multiplied by GR. During the forward rotation, the original high-speed end angle value In output by the high-speed end encoder is... Angle The value is read in real time by the controller and converted into the output reference angle value Out according to the reduction ratio GR. AngleRef Its calculation formula is Out AngleRef equals InAngle Divide by GR. The purpose of this conversion is to transform the absolute angle information from the high-speed end to the output coordinate system, which can then be used as a reference value during the calibration process.

[0037] During forward rotation, the controller samples according to preset angle points. Specifically, the output range of 0 to 360 degrees is divided into 256 points, meaning the angle value corresponding to each preset angle point is 360 degrees divided by 256 multiplied by N, where N is the point number, ranging from 0 to 255. When the joint module rotates forward, each time it reaches a target point position, i.e., Output... AngleRef When the value equals 360 degrees / N multiplied by N, the controller records the original low-speed end angle value Out output by the low-speed end encoder at this time. AngleOr The recorded forward rotation sampling data forms a forward rotation sampling sequence. This sequence contains the deviation information between the original reading and the theoretical true value of the low-speed encoder at each preset angle point position during the full forward rotation. After one round of forward rotation, all data in the forward rotation sampling sequence are sorted and rearranged according to the magnitude of the output reference angle value to form a forward rotation compensation table. Each point number N in the forward rotation compensation table corresponds to a set of data, including the theoretical reference angle value of that point and the corresponding original low-speed angle measurement value. The difference between the two is the error compensation amount at that point position during forward rotation.

[0038] After completing the forward rotation calibration, the reverse rotation calibration is performed next. The operation procedure for reverse rotation calibration is similar to that of forward rotation calibration, but the direction of movement is reversed. The controller drives the motor to rotate one revolution in the opposite direction at the same low speed mode. During the reverse rotation, sampling is performed according to the aforementioned 256 preset angle points. At each target point position, the original low-speed end angle value output by the low-speed end encoder is recorded, forming a reverse sampling sequence. After sorting the reverse sampling sequence, a reverse compensation table is obtained. The structure of the reverse compensation table is the same as that of the forward rotation compensation table. Each point number N corresponds to a set of data containing the theoretical reference angle value and the original low-speed end angle measurement value. The difference between the two is the error compensation amount when the point is in reverse rotation.

[0039] In some embodiments of the present invention, the process of establishing the forward and reverse compensation tables can be further optimized to improve calibration efficiency and accuracy. Specifically, during forward rotation calibration, the controller drives the joint module to rotate in a step-by-step manner in position mode. The rotation angle of each step is slightly greater than or equal to the angular interval between two adjacent preset division points to ensure that the joint module can sequentially pass through each target division point position. Upon reaching each target division point, the controller locks the current low-speed end original angle measurement value and stores it in the forward rotation sampling sequence. In actual implementation, to ensure the reliability of the sampling data, the original angle value at each division point position can be sampled multiple times continuously, and the most stable set of data is taken as the sampling result for that division point. Simultaneously, between forward and reverse rotation calibration, the joint module is allowed to remain briefly still to eliminate hysteresis errors caused by motion inertia.

[0040] The forward and reverse compensation tables record the deviation distribution of the original angle measurements of the low-speed encoder relative to the high-speed reference value under two different motion states: forward rotation and reverse rotation. Due to the combined effects of manufacturing errors, installation errors, and magnetic pole inhomogeneity, the error distribution of the low-speed encoder exhibits obvious nonlinear characteristics, and the error curves for forward and reverse rotation are significantly different. The separate establishment of the forward and reverse compensation tables provides a data foundation for bidirectional compensation during subsequent operation, enabling the controller to select the corresponding compensation table for error correction based on the actual motion direction of the joint module, effectively solving the problem that a single static compensation table cannot simultaneously cover the compensation accuracy in both forward and reverse directions.

[0041] The following describes the bidirectional compensation method according to an embodiment of the present invention. Bidirectional compensation is an error compensation process performed in real time during normal operation of the joint module after calibration. Its purpose is to use the established forward and reverse compensation tables to correct the original angle data output by the low-speed encoder in real time, thereby obtaining high-precision output angle information.

[0042] In some embodiments of the present invention, the specific process for implementing bidirectional compensation is as follows: The controller reads the original low-speed end angle Out output by the low-speed end encoder in real time during the operation of the joint module. AngleOrUnlike the calibration phase, sampling during the operation phase is continuous. The controller samples and updates the raw angle data at a fixed control cycle (e.g., 1 millisecond or higher). After reading the current raw low-speed angle, the controller first needs to determine the current motion direction of the joint module. This determination can be achieved in several ways, such as comparing the trend of the raw angle value between the current sampling moment and the previous sampling moment. If the angle value continues to increase, it is determined to be forward rotation; if the angle value continues to decrease, it is determined to be reverse rotation. If the sign of the angle change changes, it is determined to be a direction switching moment. During a direction switch, the compensation algorithm needs to switch the compensation table accordingly and select the corresponding compensation table based on the new motion direction in subsequent control cycles.

[0043] After determining the direction of motion, the controller selects either the forward or reverse compensation table for compensation calculation. Specifically, if the rotation is determined to be forward, the forward compensation table is selected; if the rotation is determined to be reverse, the reverse compensation table is selected. The core of the compensation calculation is linear interpolation based on the interval where the current original low-speed angle lies. The specific method is as follows: First, the interval containing the current original angle value is found in the selected compensation table. The compensation table contains 256 points, each corresponding to a preset theoretical angle value and the corresponding original angle measurement value. Let the current original angle value be θ. Based on the condition that 360 degrees divided by 256 multiplied by N is less than or equal to θ, and 360 degrees divided by 256 multiplied by N plus 1, the interval where θ lies can be determined to be between the Nth point and the (N+1)th point. Using the theoretical reference angle values ​​of the two endpoints of this interval and the original measured angle value, the compensated angle value is calculated using a linear interpolation formula. The formula for linear interpolation can be expressed as: the compensation angle equals the theoretical angle N plus the theoretical angle N+1 minus the theoretical angle N multiplied by the current angle minus the original angle N divided by the original angle N+1 minus the original angle N, where the theoretical angle N and the theoretical angle N+1 are the output reference angle values ​​corresponding to the sub-points N and N+1, respectively, and the original angle N and the original angle N+1 are the original low-speed end angle measurements corresponding to the sub-points N and N+1, respectively. This linear interpolation method can accurately calculate the compensation angle value at any angular position, effectively eliminating the systematic error of the low-speed end encoder across the entire angle range.

[0044] In some embodiments of the present invention, bidirectional compensation also needs to handle the situation of crossing the 0-degree and 360-degree boundaries. Since the low-speed encoder outputs a single-turn absolute angle value, ranging from 0 to 360 degrees, a loop jump occurs when the angle value reaches 360 degrees, returning to 0 degrees. When rotating forward across the 360-degree boundary, the angle value jumps from a position close to 360 degrees to a position close to 0 degrees; when rotating backward across the 0-degree boundary, the angle value jumps from a position close to 0 degrees to a position close to 360 degrees. If this boundary jump is not handled properly, it will produce incorrect results in the interpolation calculation. Specifically, when the difference between the current original angle value and the angle value at the previous sampling time exceeds a preset threshold (e.g., 180 degrees), the system determines that a boundary jump has occurred. At this point, boundary correction processing is required for the angle values: if a positive crossing of the 360-degree boundary is detected (angle value suddenly decreases by more than 180 degrees), then 360 degrees are added to the current angle value before interpolation calculation; if a negative crossing of the 0-degree boundary is detected (angle value suddenly increases by more than 180 degrees), then 360 degrees are subtracted from the current angle value before interpolation calculation. The boundary-corrected angle values ​​can correctly correspond to the point data in the compensation table during compensation calculation, thus obtaining accurate compensation results.

[0045] After obtaining the compensation angle, bidirectional compensation requires subtracting the corresponding zero-position offset from the compensation angle to obtain the final absolute angle value at the output. In short, the zero-position offset reflects the fixed deviation between the compensation angle and the actual mechanical angle at the joint module's mechanical zero position (or other reference position). By subtracting the corresponding zero-position offset from the compensation angle during operation, the angle measurement value can be precisely aligned to the mechanical reference coordinate system, thereby obtaining an accurate absolute angle output.

[0046] The zero-position setting method of this invention is described below. Zero-position setting is a key step in the error compensation scheme of this invention. Its purpose is to measure and save the zero-position offset values ​​in both the forward and reverse directions when the joint module is in a known mechanical position, so as to provide an accurate reference offset for angle calculation in the subsequent operation process.

[0047] In some embodiments of the present invention, the specific operation process of zero-position setting is as follows. First, the user or host computer system sends a zero-position setting command to the controller. When the controller receives the zero-position setting command, it first checks whether the joint module is currently in a stationary state. If the joint module is in motion, the zero-position setting command is temporarily suspended, waiting for the joint module to come to a complete stop before proceeding with subsequent steps. Requiring the joint module to be in a stationary state before performing zero-position setting is to ensure that the collected angle data is stable static data, free from any error components caused by dynamic motion, thereby guaranteeing the accuracy of the zero-position offset measurement.

[0048] After confirming that the joint module is stationary, the controller marks the current position as zero. This marking operation defines the current mechanical position of the joint module as the reference origin for subsequent angle calculations. After marking, the controller begins to collect compensated angle data at the current position. Specifically, the controller continuously samples the raw angle data of the low-speed encoder at fixed time intervals (preferably 1 millisecond), for a total of 100 samples. After collection, these 100 raw angle sample values ​​are averaged using a circular averaging process to obtain a stable raw angle average. The purpose of the circular averaging process is to correctly handle the angle looping problem at the 0-degree and 360-degree boundaries, ensuring that the averaging result will not be erroneous due to mathematical linear averaging when the angle value crosses the boundary. Specifically, if the sampled values ​​contain data close to 0 degrees and close to 360 degrees, the circular averaging algorithm will treat these data as adjacent points on the angle loop rather than points that are far apart, thereby calculating the correct loop center direction.

[0049] After obtaining the average circular value of the original angle, the controller performs compensation calculations on this average value using both the forward and reverse compensation tables. Specifically, firstly, the average original angle is linearly interpolated using the forward compensation table to obtain the compensation angle value for forward rotation; then, the average original angle is similarly linearly interpolated using the reverse compensation table to obtain the compensation angle value for reverse rotation. Since the compensation tables store error data measured separately under two different motion states (forward and reverse), the compensation angles calculated from the original angle at the same mechanical position using the forward and reverse compensation tables are usually different. This difference reflects the asymmetry of forward and reverse rotation errors.

[0050] After obtaining the forward and reverse compensation angles, the controller performs multiple circular averaging operations on these two compensation angles to obtain the average value. Specifically, the same multiple sampling and circular averaging method as described above can be used, or the 100 original angle data collected can be used to calculate two sets of 100 compensation angle values ​​through two compensation tables, and then the two sets of compensation angle values ​​are averaged separately, with the average value used as the final forward and reverse zero-position offsets. The purpose of the averaging operation is to suppress the influence of random noise by averaging multiple measurements, thereby improving the measurement accuracy and stability of the zero-position offset. The obtained forward and reverse zero-position offsets are stored in the controller's non-volatile memory area, which is retained even after power failure and can be used after the next power-on.

[0051] In some embodiments of the present invention, the zero-point setting process can be further optimized to improve measurement accuracy and reliability. Specifically, when collecting 100 sets of raw angle data, a sliding window filtering method can be used to preprocess the collected raw angle sequence before performing a circular average calculation. For example, the maximum and minimum values ​​in the sequence can be removed first, and then a circular average can be performed on the remaining 98 data points; or a more complex adaptive filtering algorithm can be used to automatically adjust the filtering parameters according to the dispersion of the data. These preprocessing methods can further reduce the influence of random errors and outliers on the zero-point offset measurement results, making the final zero-point offset value more stable and reliable.

[0052] During subsequent normal operation, after calculating the compensation angle, the bidirectional compensation module needs to perform a subtraction operation based on the current direction of motion by selecting the corresponding zero-position offset. Specifically, if the current rotation is determined to be forward, the forward zero-position offset is subtracted from the compensation angle; if the current rotation is determined to be reverse, the reverse zero-position offset is subtracted from the compensation angle. By using forward and reverse zero-position offsets for correction respectively, the overall step deviation generated during direction switching can be effectively eliminated. This is because at the instant of direction switching, the compensation algorithm synchronously switches the compensation table and zero-position offset used, and the compensation results for the two directions are continuously connected at the zero point, without the angle jump caused by using a single zero-position offset during direction switching.

[0053] In some embodiments of the present invention, the specific process of power-on position recovery is as follows. When the joint module is powered on again, the controller first enters the initialization phase, executing the power-on position recovery algorithm to determine the initial number of revolutions for the high-speed encoder. For example... Figure 2 As shown, the specific operation steps are as follows.

[0054] Read the compensation angle θ of the low-speed encoder out After the joint module is powered on, the controller immediately reads the raw low-speed end angle currently output by the low-speed end encoder. Unlike the continuous sampling during normal operation, during the short period of power-on initialization, the controller samples the raw angle data multiple times at fixed intervals (preferably 1 millisecond), for a total of 100 samples. A circular averaging process is then performed on these 100 raw angle samples to obtain a stable raw angle average. The circular averaging process, described in detail above, can correctly handle the angle wrapping problem at the 0-degree and 360-degree boundaries, ensuring the accuracy of the averaging result.

[0055] After obtaining the average value of the original angle using a circular calculation, the controller calculates compensation using both the forward and reverse compensation tables. Specifically, first, the average value of the original angle is linearly interpolated using the forward compensation table to obtain the forward compensation angle; then, the average value of the original angle is linearly interpolated using the reverse compensation table to obtain the reverse compensation angle. Next, the two compensation results, the forward and reverse compensation angles, are again averaged using a circular calculation to obtain the final low-speed output compensation angle θ. out The design employs two cyclic averaging methods (one for the original angle and one for the compensated angle) to ensure that θ remains constant under various boundary conditions and uncertain motion directions. out The values ​​are all stable and reliable. It should be noted that at the initial moment of power-on, the direction of motion of the joint module has not yet been determined. Therefore, it is necessary to use the information from both the forward and reverse compensation tables simultaneously, and fuse the compensation results in the two directions through a circular averaging method to obtain a robust estimate independent of the specific direction of motion.

[0056] Read the reduction ratio GR and the single-turn resolution CPR of the high-speed encoder. The reduction ratio GR is an inherent parameter of the reducer, read from the storage area during the controller initialization phase. The single-turn resolution CPR is an inherent parameter of the high-speed encoder, representing the number of pulses or counts output by the encoder per revolution. These two parameters are known quantities necessary for subsequent calculations of the theoretical total count and the current single-turn count.

[0057] Calculate the theoretical total count C of the high-speed encoder. theory The theoretical total count is based on the compensated angle θ of the output terminal calibrated at the low-speed end. out The derived cumulative count position should be at the high-speed terminal. The specific calculation formula is: C theory =θ out ×GR×CPR / 2π,C theory This represents the total count that the high-speed encoder should accumulate and output under ideal conditions (i.e., assuming the low-speed end measurement is completely accurate).

[0058] Read the single-turn position information θ of the high-speed encoder when it is powered on. m0 Since high-speed encoders are typically single-turn absolute encoders, they can immediately output the absolute angle value (in radians) of the current single turn of the motor shaft after power-on, with a value range of 0 to 2π. Calculate the current single-lap count C single C single =θ m0 ×CPR / 2π; Calculate the number of candidate laps N init N init =round((C theory -C single( / CPR); Calculate the initial total count C init C init =C single +Ninit×CPR; Determine and correct the initial number of laps, based on |C theory -C init |>CPR / 2, corrected lap number N init’ =N init ±1, output high-speed terminal initialization number N init’ According to |C theory -C init If |≤CPR / 2, no correction is needed; directly output the initial high-speed end rotation number N. init .

[0059] The reason for setting CPR divided by 2 as the judgment threshold is as follows: if the deviation exceeds half a circle, it means that the candidate circle number obtained by rounding may have an error of ±1, and it needs to be corrected according to the direction of the deviation; if the deviation is less than or equal to half a circle, it means that the direction of the candidate circle number is correct and no correction is needed. The judgment condition for correcting the circle number ensures that the output initial circle number is correct in all cases.

[0060] In some embodiments of the present invention, the implementation of the above-described power-on position recovery algorithm can also consider the following optimization measures to further improve robustness and accuracy. First, during the first step of sampling the original angle at the low-speed end 100 times, a recursive filtering method can be used to gradually update the mean, instead of waiting for all 100 samples to be completed before calculation. This can shorten the initialization time while ensuring accuracy. Second, when determining whether the candidate number of revolutions needs to be corrected, not only the calculation result at the current moment can be considered, but also the estimated value of the initial number of revolutions from the previous control cycle can be combined for a comprehensive judgment, using time continuity constraints to improve the reliability of the number of revolutions estimation. In addition, after the power-on position recovery is completed, the system can continuously verify the correctness of the initial number of revolutions during subsequent operation. If an anomaly is detected, recalibration or an alarm prompt will be triggered.

[0061] The present invention also provides a joint module, including a motor, a reducer connected to the output shaft of the motor, a high-speed encoder disposed on the motor shaft or the input shaft of the reducer, a low-speed encoder disposed on the output side of the reducer, and a controller, wherein the controller is configured to perform the error compensation and power-on position recovery method of the dual encoder described in any of the above embodiments.

[0062] The present invention also provides a robot including the aforementioned joint module. By employing this joint module in all joints of the robot, the robot can automatically restore the precise position of each joint upon power restoration after a power outage, without needing to return to zero, significantly improving the robot's ability to cope with unexpected power outages and its autonomous operation efficiency.

[0063] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a controller, implements the error compensation and power-on position recovery method for dual encoders as described in any of the above embodiments.

[0064] The aforementioned computer-readable storage medium may be any combination of one or more computer-readable media. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. Computer-readable storage media include, but are not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or flash memory, optical fiber, portable compact disk read-only memory (CDROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device.

[0065] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.

[0066] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0067] Computer program code for performing the operations of embodiments of the present invention can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0068] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0069] Obviously, those skilled in the art should understand that the various units or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device, or fabricating them separately as individual integrated circuit modules, or fabricating multiple modules or steps into a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0070] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A method for error compensation and power-on position recovery using dual encoders, characterized in that, include: The joint module is controlled to rotate in the forward and reverse directions respectively to obtain the original high-speed end angle value output by the high-speed end encoder, and the original high-speed end angle value is converted into the output end reference angle value according to the reduction ratio. During forward and reverse rotation, the original low-speed end angle output by the low-speed end encoder is collected at preset angle points, and forward rotation compensation table and reverse rotation compensation table are established respectively. Receiving a zero-position setting instruction, compensating for the current position of the joint module, and saving it as a forward rotation zero-position offset and a reverse rotation zero-position offset, the process of receiving the zero-position setting instruction, compensating for the current position of the joint module, and saving it as a forward rotation zero-position offset and a reverse rotation zero-position offset includes: Upon receiving the zero-position setting command, when the joint module is stationary, mark the current position as zero position; calculate the compensation angle at the current position according to the forward compensation table and the reverse compensation table; sample the angle at the current position multiple times and calculate the compensation angle; perform a circular averaging process on the compensation result and take the average value, which is then saved as the forward zero-position offset and the reverse zero-position offset, respectively. Based on the current motion direction of the joint module, the corresponding compensation table is selected and called to compensate the original low-speed end angle. The compensation result is then subtracted from the corresponding zero offset to obtain the low-speed end compensation angle. When the joint module is powered on, the original angle currently output by the low-speed encoder is read. Compensation and cyclic averaging are performed on the read result to obtain the compensation angle. The number of revolutions of the high-speed encoder is calculated and used as the initial number of revolutions. The process of performing compensation and cyclic averaging on the read result to obtain the compensation angle includes: sampling the original low-speed angle output by the low-speed encoder multiple times; averaging the multiple sampled values; passing the average value through the forward compensation table and the reverse compensation table respectively; and averaging the compensation result again to obtain the compensation angle θ of the low-speed encoder. out ; The calculation of the number of revolutions of the high-speed encoder, using the number of revolutions as the initial number of revolutions, includes: Read the compensation angle θ of the low-speed encoder out The reduction ratio GR and the single-turn resolution CPR of the high-speed end encoder; Calculate the theoretical total count C of the high-speed encoder. theory =θ out ×GR×CPR / 2π; Read the single-turn position information θ of the high-speed encoder when it is powered on. m0 ; Calculate the current single-lap count C single =θ m0 ×CPR / 2π; Calculate the number of candidate laps N init =round((C theory -C single ( / CPR); Calculate the initial total count C init =C single +N init ×CPR; According to |C theory -C init |>CPR / 2, corrected lap number N init’ =N init ±1, output high-speed terminal initialization number N init’ ; According to |C theory -C init |≤CPR / 2, output the initial number of high-speed loops N init .

2. The method for error compensation and power-on position recovery of dual encoders according to claim 1, characterized in that, The process of collecting the original low-speed end angle output by the low-speed end encoder at preset angle points during forward and reverse rotation, and establishing forward and reverse compensation tables respectively, includes: The joint module is driven to step by a given angle in a position mode, performing one revolution in the forward direction and one revolution in the reverse direction. Divide 0-360° into n preset angle points. Record the original low-speed end angles according to the preset angle points when the joint module rotates forward and when it rotates backward, respectively forming forward sampling sequence and reverse sampling sequence. The forward sampling sequence and the reverse sampling sequence are sorted to obtain the forward compensation table and the reverse compensation table.

3. The method for error compensation and power-on position recovery of dual encoders according to claim 2, characterized in that, Divide 0-360° into 256 preset angle points.

4. The method for error compensation and power-on position recovery of dual encoders according to claim 1, characterized in that, The compensation for the original low-speed end angle includes: The original low-speed end angle is read in real time, and a forward or reverse compensation table is selected according to the movement direction of the joint module. Linear interpolation compensation is performed based on the range of the original low-speed end angle.

5. A joint module, comprising a motor, a reducer connected to the output shaft of the motor, a high-speed encoder disposed on the motor shaft or the input side of the reducer, a low-speed encoder disposed on the output side of the reducer, and a controller, characterized in that, The controller is configured to perform the error compensation and power-on position recovery method for dual encoders as described in any one of claims 1 to 4.

6. A robot, characterized in that, Includes the joint module as described in claim 5.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the controller, it implements the error compensation and power-on position recovery method for dual encoders as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Signal processing method and system based on complex number extraction operation, medium and equipment

    CN116595300A

  • Self-calibration high-precision angle measurement turntable control system and method

    CN121349172A

  • Magnetic encoder calibration method and system based on dynamic interval point sampling

    CN121430701A

  • Encoder calibration method, encoder calibration device, electronic equipment and storage medium

    CN121761957A