Magnetic encoder calibration method and system
By integrating a magnetic encoder calibration system into the joint module controller, and utilizing module calibration algorithms and multi-speed segment sampling, the problems of equipment dependence and operational complexity in existing technologies are solved, achieving efficient and safe magnetic encoder calibration and improving the accuracy and robustness of nonlinear error compensation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-05
- Publication Date
- 2026-04-03
AI Technical Summary
Existing magnetic encoder calibration methods require specialized equipment, are complex to operate, and are time-consuming, thus failing to meet practical needs.
A magnetic encoder calibration system is integrated into the controller program of the joint module. The encoder output value is calibrated through a module calibration algorithm. The system includes a control unit, a data acquisition unit, an analysis unit, an anomaly handling unit, and an information output unit. It utilizes multi-speed segment sampling and rotation data acquisition, combined with mean filtering and error curve analysis, to automatically determine whether to terminate the calibration.
No additional equipment is required, reducing costs and operational complexity, improving the accuracy and robustness of nonlinear error compensation, and ensuring the safety and reliability of the calibration process.
Smart Images

Figure CN121783231A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of encoder calibration technology, specifically a magnetic encoder calibration method and system. Background Technology
[0002] With the rapid development and iteration of embodied intelligent robots, joint modules have become core components that determine the robot's motion accuracy and flexibility. Their performance directly affects the robot's overall operational capabilities and scene adaptability. For joint modules, high-precision and highly adaptable sensing elements are crucial for stable operation. Magnetic encoders, with their outstanding advantages of small size, lightweight, low cost, and long lifespan, have become the preferred solution for joint module position sensors.
[0003] However, due to issues such as magnet misalignment, poor magnetization, or incomplete magnetization, the magnetic field input to the magnetic encoder is distorted, resulting in errors in the measured mechanical angle. Specifically, the encoder output measurement value is nonlinear within the cycle, leading to problems such as poor absolute positioning accuracy, torque fluctuation, and speed fluctuation in the joint module, which in turn affects the control effect of the joint module.
[0004] To address these issues, existing technologies often employ high-precision motors and joint modules for uniform speed alignment, using the built-in calibration function of the magnetic encoder for calibration, thereby directly resolving the nonlinearity problems caused by magnet deviation and chip mounting misalignment. However, this method requires specialized equipment, is complex to operate, time-consuming, and costly, failing to meet practical needs.
[0005] Based on this, a magnetic encoder calibration method and system are provided, which can eliminate the drawbacks of existing technical solutions. Summary of the Invention
[0006] The purpose of this invention is to provide a magnetic encoder calibration method and system to solve the problems of existing methods in the background art requiring specialized equipment and being time-consuming and labor-intensive.
[0007] To achieve the above objectives, the present invention provides the following technical solution: A magnetic encoder calibration system, incorporated in the controller program of a joint module, calibrates the encoder output value using a module calibration algorithm. The calibration system includes: The control unit is used to control the movement of the joint module motor and detect whether there is any abnormality during the control process. If an abnormality is found, the abnormality is transmitted to the abnormality handling unit. The acquisition unit is used to acquire position data fed back by the encoder and open-loop position data of the control unit, and transmit them to the analysis unit. At the same time, it detects whether the acquired data is updated normally and transmits abnormal situations to the anomaly handling unit. The analysis unit performs calculations based on encoder position data and control unit open-loop position data to output correction parameters and transmit the calculation results to the information output unit and storage unit. The exception handling unit is used to analyze and make decisions on abnormal situations, and to determine whether the calibration needs to be terminated based on the analysis results. The information output unit is used to output abnormal information, calculation results, and analysis results to the operator. The storage unit is used to store the data information involved in the calibration process.
[0008] Furthermore, the control process of the control unit includes: The system receives joint module parameters input by the operator, including rated speed, rated current, rated pass threshold, number of rotor pole pairs, phase resistance, phase inductance, and reduction ratio. Adjust the controller's inner current loop parameters based on the phase resistance and phase inductance parameters, set the electrical angle to 0°, and enable FOC control; The direct-axis current is increased at a rate of 1 A / s until it reaches the motor's rated current value, causing the motor rotor to be dragged to a position with an electrical angle of 0°. After waiting 100 ms, the encoder feedback position is recorded. ; Move to a position with an electrical angle of 360° at a speed of 18° / s, wait 100ms, and then record the encoder's feedback position. ; The electrical angle is obtained by multiplying the mechanical angle by the number of pole pairs of the motor rotor. The electrical angle value undergoes cyclic normalization. When the electrical angle value is greater than... If the count is zero, then start counting again from 0. denoted as the number of rotor pole pairs.
[0009] Furthermore, the specific operation of the control unit to detect whether there is an abnormality in the control process includes: calculating the number of rotor pole pairs of the motor using the rotor pole pair number formula, comparing the obtained number of rotor pole pairs of the motor with the number of rotor pole pairs in the input joint module parameters, and if the comparison is inconsistent, transmitting the abnormality to the abnormality handling unit. The expression for the rotor pole pair number formula is as follows: ,in, The number of rotor pole pairs, This is a rounding algorithm. For absolute value algorithms, This represents the total number of encoder revolutions per turn.
[0010] Furthermore, the data acquisition process of the acquisition unit includes: A command is sent to the control unit to move at an electrical angular velocity of 54° / s to the encoder feedback position less than... Location, This represents the number of sampling points; After waiting 100ms, record the current encoder feedback position. and electric angle , Then it rotates at an electrical angular velocity of 18° / s, continuously acquiring the current electrical angle value. Whenever the electric angle and When the difference is greater than the step value, maintain the current position for 10ms and then record the encoder feedback position. and electric angle Until the mechanical angle has rotated one full revolution, a total of [number] records are recorded. Encoder feedback location and electrical angle ; After waiting 100ms, record the current encoder feedback position. and electric angle , Then it rotates at an electrical angular velocity of -18° / s, continuously acquiring the current electrical angle value. Whenever the electric angle and When the difference is greater than the step value, maintain the current position for 10ms and then record the encoder feedback position. and electrical angle Until the mechanical angle has rotated one full revolution, a total of [number] records are recorded. Encoder feedback location and electric angle ; Calculate the two sets of corresponding position values to obtain a preliminary error curve; Continue sending commands to the control unit at (18° / s). electric angular velocity motion, Represents the velocity coefficient and satisfies ; After continuous motion for 1 second, when the encoder feedback position is less than When the position is reached, record the current encoder feedback position as... and electric angle , Continue rotating and continuously acquire the current electrical angle value. Whenever the electric angle and When the difference is greater than the step value, record the encoder feedback position. and electric angle A total of records Encoder feedback location and electrical angle ; Based on encoder feedback position and electrical angle Error curves were obtained under different electric angular velocities. The acquired data is then transmitted to the analysis unit.
[0011] Furthermore, the formula for calculating the step value is as follows: ,in, The step value, The number of rotor pole pairs, This represents the number of sampling points; The formula for calculating any element on the preliminary error curve is: ; in, This is represented as the preliminary error curve. The first on the initial error curve One element; The formula for calculating any element on the error curve under different electric angular velocities is: ; in, The error curves are shown for different electric angular velocities. Error curve The first Each element.
[0012] Furthermore, the data acquisition process of the acquisition unit also includes: After acquiring and transmitting data to the analysis unit, control commands are sent to the control unit. The unit continues to rotate and returns to the position with an electrical angle of 0°. It then resumes rotation at the rated speed, maintaining a constant speed for 1 second before acquiring the current electrical angle. Whenever the electrical angle value exceeds... At that time, the current encoder feedback position value is recorded, the full cycle point acquisition is completed according to the number of reduction ratios, and the multi-cycle data is output to the analysis unit.
[0013] Furthermore, the specific operation of the acquisition unit to detect whether the acquired data is updated normally includes: using the out-of-tolerance formula to calculate the out-of-tolerance value, and comparing the out-of-tolerance value calculated in real time during the data acquisition process with the preset threshold range. If the out-of-tolerance does not meet the preset threshold, i.e. the position deviation exceeds ±20%, the abnormal situation is transmitted to the abnormality processing unit. The expression for the out-of-tolerance formula is: ,in, This is indicated as out of tolerance. For the first The electrical angle of this time, This is an absolute value algorithm.
[0014] Furthermore, the analysis unit performs calculations based on encoder position data and control unit open-loop position data, analyzes multi-loop data, and performs an operation to calculate the average difference coefficient of all data. If the average difference coefficient is greater than the calibration pass threshold, the abnormal situation is transmitted to the abnormality handling unit. Specific operations include: The data from different sets of electric angular velocity were subjected to mean filtering to obtain the error curves under different electric angular velocities after filtering, and the peak-to-peak value of each set of data was calculated. The two sets of corresponding position values collected are used as preliminary data. The preliminary data are then filtered by mean to obtain the preliminary error curve after filtering. The peak-to-peak value of the preliminary data is then calculated. Calculate the ratio of the peak-to-peak value of multiple sets of data to the peak-to-peak value of the initial data, sort the data in ascending order, take out the first 3 sets and calculate the average value, calculate the average difference coefficient of the three sets of data and determine whether it is less than the calibration threshold. If the average difference coefficient between the two sets of data is not less than the calibrated threshold, the first two sets are used to calculate the average difference coefficient between the two sets of data and determine whether it is less than the calibrated threshold. If neither is less than the threshold, the abnormal situation is transmitted to the abnormal handling unit. If the value is less than the calibration threshold, the corresponding average value is used to scale the initial data to complete the data calibration. It outputs a nonlinear error curve and transmits the calculation results to the operator through the information output unit, while storing the data information through the storage unit.
[0015] Furthermore, when the abnormal situation is received, the abnormal handling unit controls the motor to stop safely and transmits the abnormal information to the operator through the information output unit.
[0016] A magnetic encoder calibration method, applied to a magnetic encoder calibration system, specifically includes the following steps: Step S1: The control unit receives parameter input and adjusts the parameters, controls the joint module motor to move according to the preset control process, and detects and reports any abnormal control conditions. Step S2: The acquisition unit acquires encoder position data, control unit open-loop position data and multi-turn data according to the preset data acquisition process, and at the same time detects and reports any abnormal data acquisition situations. Step S3: The analysis unit filters the collected data, calculates peak-to-peak values, performs ratio analysis and determines the average difference coefficient, completes data calibration, and outputs correction parameters. Step S4: The exception handling unit determines whether to terminate the calibration based on the feedback exception situation. If it terminates, it controls the safe shutdown and feeds back the exception information. Step S5: The information output unit outputs abnormal information, calculation results, and analysis results, and performs data information storage operations through the storage unit.
[0017] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention provides a magnetic encoder calibration system integrated within the controller, eliminating the need for additional equipment. The system is embedded in the joint module controller, reducing cost and operational complexity. Through multi-speed-segment sampling and rotational data acquisition, combined with mean filtering and error curve analysis, it effectively suppresses the impact of random noise and motion jitter on calibration accuracy, improving the accuracy and robustness of nonlinear error compensation. This invention introduces a real-time anomaly and feedback mechanism, including rotor pole pair verification, data update detection, and out-of-tolerance judgment, automatically determining whether to terminate the calibration process to ensure its safety and reliability. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the calibration system of the present invention.
[0019] Figure 2 This is a schematic diagram illustrating the steps of the calibration method of the present invention.
[0020] Figure 3 This is a schematic diagram of the calibrated mechanical angle error data of the present invention.
[0021] Figure 4 This is a schematic diagram of mechanical angle error data before calibration in the existing technology.
[0022] Figure label annotations: Control unit 10, acquisition unit 20, analysis unit 30, anomaly handling unit 40, information output unit 50, storage unit 60. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments.
[0024] Example 1 In this embodiment, as Figure 1 As shown, a magnetic encoder calibration system is placed in the controller program of the joint module. It calibrates the encoder output value through a module calibration algorithm. The magnetic encoder is a sensing element that measures position / angle based on the principle of magnetic field induction. It features small size, lightweight, low cost, and long lifespan, and is used to feed back the actual position data of the motor rotor. The joint module is the motion component of an embodied intelligent robot, integrating components such as a motor, reducer, and encoder. The controller is the joint module's controller; it is a built-in program or hardware module used to control the motor's movement, execute the encoder's module calibration algorithm, and process data. This calibration system calibrates the encoder output value through the module calibration algorithm, thereby solving a series of problems caused by the nonlinearity of the encoder output measurement value. The calibration system includes: The control unit 10 is used to control the movement of the joint module motor and detect whether there is any abnormality during the control process. If there is an abnormality, the abnormality is transmitted to the abnormality handling unit 40. The acquisition unit 20 is used to acquire the position data fed back by the encoder and the open-loop position data of the control unit 10, and transmit them to the analysis unit 30. At the same time, it detects whether the acquired data is updated normally and transmits abnormal situations to the abnormal handling unit 40. The open-loop position data refers to the theoretical position data calculated by the control unit based on the preset joint module parameters (without encoder feedback correction) in the control mode without feedback closed-loop adjustment. It is compared with the actual position data fed back by the encoder for error calculation. The analysis unit 30 performs calculations based on encoder position data and control unit open-loop position data to output correction parameters and transmits the calculation results to the information output unit 50 and storage unit 60. The correction parameters are data used to correct encoder nonlinearity errors and to compensate for the deviation between the magnetic encoder output value and the actual mechanical angle. The analysis unit 30 calculates the error curve by collecting multiple sets of data. The correction parameters are the values in the error curve and are used to correct the encoder output value in real time after calibration to make it closer to the actual angle. The exception handling unit 40 is used to analyze and make decisions on abnormal situations, and to determine whether the calibration needs to be terminated based on the analysis results. The information output unit 50 is used to output abnormal information, calculation results, and analysis results to the operator. Storage unit 60 is used to store data information involved in the calibration process; In this embodiment, nonlinear error refers to the deviation between the magnetic encoder measurement value and the actual mechanical angle, and the phenomenon that the deviation is distributed in a non-fixed manner as the mechanical angle changes is the core reason for poor joint positioning accuracy and torque / speed fluctuation.
[0025] Specifically, the control process of the control unit 10 includes: The system receives joint module parameters input by the operator. These parameters include rated speed, rated current, rated pass threshold, number of rotor pole pairs, phase resistance, phase inductance, and reduction ratio. The number of rotor pole pairs is the number of magnetic pole pairs of the motor rotor and is the core parameter for converting electrical angles to mechanical angles. It needs to be verified through a calibration process to ensure consistency with the input values. The controller's inner current loop parameters are adjusted based on the phase resistance and phase inductance parameters. The given electrical angle is 0° and FOC control is enabled. FOC (Field-Oriented Control) refers to field-oriented control, which achieves precise control of motor torque and speed by controlling the d / q axis components of the motor stator current. The direct-axis current is increased at a rate of 1 A / s until it reaches the motor's rated current value, causing the motor rotor to be dragged to a position with an electrical angle of 0°. After waiting 100 ms, the encoder feedback position is recorded. ; Move to a position with an electrical angle of 360° at a speed of 18° / s, wait 100ms, and then record the encoder's feedback position. ; The electrical angle is obtained by multiplying the mechanical angle by the number of pole pairs of the motor rotor. The electrical angle value undergoes cyclic normalization. When the electrical angle value is greater than... If the count is zero, then start counting again from 0. The number of rotor pole pairs is used. All electrical angle values in this invention are subjected to cyclic normalization. The mechanical angle is the physical angle of the actual rotation of the motor rotor. The measurement target of the magnetic encoder is this angle.
[0026] Specifically, the specific operations of the control unit 10 in detecting whether there is an abnormality in the control process include: calculating the number of rotor pole pairs of the motor using the rotor pole pair number formula, comparing the obtained number of rotor pole pairs of the motor with the number of rotor pole pairs in the input joint module parameters, and if the comparison is inconsistent, transmitting the abnormality to the abnormality processing unit 40. The formula for the number of rotor pole pairs is: ,in, The number of rotor pole pairs, This is a rounding algorithm. For absolute value algorithms, This refers to the total count per revolution of the encoder, that is, the total number of pulses or count points output during a single revolution of the magnetic encoder. and All of these are encoder feedback positions corresponding to the electrical angles recorded above.
[0027] Specifically, the data acquisition process of the acquisition unit 20 includes: A command is sent to control unit 10 to move at an electrical angular velocity of 54° / s to the encoder feedback position less than... Location, The number of sampling points represents the total number of times the mechanical angle of a single motor revolution is sampled during the calibration process. The larger the value, the higher the resolution of the error curve and the better the calibration accuracy; After waiting 100ms, record the current encoder feedback position. and electrical angle , Then it rotates at an electrical angular velocity of 18° / s, continuously acquiring the current electrical angle value. Whenever the electric angle and The difference is greater than the step value, i.e. At that time, after maintaining the current position for 10ms, record the encoder feedback position. and electrical angle Until the mechanical angle has rotated one full revolution, a total of [number] records are recorded. Encoder feedback location and electrical angle ; After waiting 100ms, record the current encoder feedback position. and electrical angle , Then rotate at an electrical angular velocity of -18° / s to continuously acquire the current electrical angle value. Whenever the electric angle and The difference is greater than the step value, i.e. At that time, after maintaining the current position for 10ms, record the encoder feedback position. and electrical angle Until the mechanical angle has rotated one full revolution, a total of [number] records are recorded. Encoder feedback location and electrical angle ; Calculate the two sets of corresponding position values to obtain the preliminary error curve. Preliminary error curve The formula for calculating any element above is: ,in, This is represented as the preliminary error curve. The first on the initial error curve One element; Continue sending commands to control unit 10 at (18° / s). electric angular velocity motion, Represents the velocity coefficient and satisfies This means the first calibration speed. Double speed; After continuous motion for 1 second, when the encoder feedback position is less than When the position is reached, record the current encoder feedback position as... and electrical angle , Continue rotating and continuously acquire the current electrical angle value. Whenever the electric angle and The difference is greater than the step value, i.e. Record the encoder feedback position at that time. and electrical angle A total of records Encoder feedback location and electrical angle ; Based on encoder feedback position and electrical angle Error curves were obtained under different electric angular velocities. Error curves at different electric angular velocities The formula for calculating any element above is: ,in, The error curves are shown for different electric angular velocities. Error curve The first One element; Finally, the acquired data is transmitted to the analysis unit 30 to obtain 6 sets of data: 5 sets of encoder feedback position, electrical angle, error curve and other data under different electrical angular velocities and 1 set of corresponding values, error curve and other data of the initial record; The data acquisition process of acquisition unit 20 also includes: After acquiring data and sending it to the analysis unit 30, the system continues to send control commands to the control unit 10. It then rotates back to the position with an electrical angle of 0°, resumes rotation at the rated speed, maintains a constant speed for 1 second, and then begins acquiring the current electrical angle. Whenever the electrical angle value exceeds... When the motor rotates half a turn, the current encoder feedback position value is recorded, the full cycle of point acquisition is completed according to the number of reduction ratios, and the multi-turn data is output to the analysis unit 30.
[0028] Specifically, the formula for calculating the step value is as follows: ,in, This is the step value, which is the electrical angle interval between sampling points performed by the acquisition unit 20. It is used to control the uniform distribution of sampling points. The number of rotor pole pairs, This represents the number of sampling points.
[0029] Specifically, the specific operations of the acquisition unit 20 in detecting whether the acquired data is updated normally include: calculating the deviation value using the deviation formula, and comparing the deviation value calculated in real time during the data acquisition process with the preset threshold range. If the deviation does not meet the preset threshold, i.e., the position deviation exceeds ±20%, then a control deviation occurs. or In the event of an abnormal situation, the abnormal situation will be transmitted to the abnormal handling unit 40; The expression for the out-of-tolerance formula is: ,in, This is indicated as out of tolerance. For the first The electrical angle of this time, This is an absolute value algorithm.
[0030] Specifically, the analysis unit 30 performs calculations based on encoder position data and control unit open-loop position data, analyzes multi-loop data, and performs an operation to calculate the average difference coefficient of all data. If the average difference coefficient is greater than the calibration pass threshold, the abnormal situation is transmitted to the abnormality handling unit 40. The specific operations include: Mean filtering was applied to the collected data of different electric angular velocities (the 5 sets of data mentioned above) to obtain the error curves under different electric angular velocities after filtering. The peak-to-peak value of each set of data was calculated. Mean filtering is a data preprocessing algorithm that takes the average value of the collected data to filter out random noise and make the error curve more closely match the true deviation law. Peak-to-peak value is the difference between the maximum and minimum values in a set of error data, which is used to quantify the fluctuation range of the error. The two sets of corresponding position values collected are used as preliminary data (the first set of data mentioned above refers to the two sets of corresponding position values collected in the first bidirectional rotation). The preliminary data is mean filtered to obtain the preliminary error curve after filtering. The peak-to-peak value in the preliminary data is calculated. Since there is random noise and electromagnetic interference in the encoder sampling process, mean filtering of the preliminary data can effectively smooth data fluctuations, avoid the negative impact of abnormal sampling points on the error curve, and improve the reliability and repeatability of calibration results. Calculate the ratio of the peak-to-peak value of multiple sets of data to the peak-to-peak value of the initial data, sort the data in ascending order, take out the first 3 sets and calculate the average value, calculate the average difference coefficient of the three sets of data and determine whether it is less than the calibration pass threshold. The average difference coefficient is a quantitative indicator of the average deviation between multiple sets of data, used to judge the consistency of multiple sets of sampled data. If it exceeds the calibration pass threshold, it indicates that the sampled data is unreliable and triggers an anomaly. If the difference is not less than the calibrated threshold, the average difference coefficient between the two sets of data is calculated using the first two sets and it is determined whether the difference is less than the calibrated threshold. If neither is less than the threshold, the abnormal situation is transmitted to the abnormal handling unit 40. If the value is less than the calibration threshold, the corresponding average value is used to scale the initial data to complete the data calibration. The system outputs a nonlinear error curve and transmits the calculation results to the operator through the information output unit 50, while simultaneously storing the data information through the storage unit 60.
[0031] Specifically, when the abnormal situation is received, the abnormality handling unit 40 controls the motor to stop safely and transmits the abnormal information to the operator through the information output unit 50.
[0032] Specifically, to visually demonstrate the calibration effect of the present invention, Figure 4 The mechanical angle error curve before calibration is shown, which is a feature of existing technology. Figure 3 The error curve after calibration using the system of this invention is shown. Figure 3 and Figure 4 It can be concluded that: like Figure 4 As shown, the horizontal axis of the diagram of mechanical angle error before calibration represents the mechanical angle, which is used to represent the actual mechanical rotation angle of the motor rotor or joint module (range 0°~360°), covering a complete single-turn motion trajectory. The vertical axis represents the error, which is used to represent the deviation between the magnetic encoder measurement value and the actual mechanical angle (unit: °). The error value of this diagram fluctuates greatly, with a maximum value of about 0.8°, a minimum value of about -0.6°, and a peak-to-peak value of 1.4°. Moreover, the error changes with the mechanical angle without a fixed pattern, showing an obvious non-linear distribution. This diagram intuitively reflects the original measurement defects of the magnetic encoder caused by problems such as magnet misalignment and poor magnetization. like Figure 3 As shown, the horizontal axis of the mechanical angle error diagram after calibration using the calibration system of this invention represents the mechanical angle, which is consistent with the original calibration and covers the complete single-turn motion trajectory (range 0°~360°). The vertical axis represents the error, which is consistent with the original calibration (unit: °). The error value fluctuation range of this diagram is significantly narrowed, with a maximum value ≤ 0.1°, a minimum value ≥ -0.08°, and a peak-to-peak value ≤ 0.18°. The error curve tends to be stable, and the nonlinear characteristics are basically eliminated. This proves that the module calibration algorithm of this invention can effectively compensate for the nonlinear error of the magnetic encoder. Therefore, according to Figure 3 and Figure 4 The technical effect of achieving a nonlinear error of ≤0.1° after calibration can be clearly demonstrated. By comparing the distribution range and fluctuation amplitude of mechanical angle errors before and after calibration, the effectiveness of the calibration system and calibration method of this invention can be directly verified, indicating that this invention has significant substantial progress. This invention can effectively compensate for the nonlinear error of the magnetic encoder and improve the positioning accuracy and control stability of the joint module.
[0033] Example 2 The difference from Example 1 is that, as in Example 1, Figure 2 As shown, the present invention also provides a magnetic encoder calibration method, applied to a magnetic encoder calibration system, specifically including the following steps: Step S1: The control unit 10 receives parameter input and adjusts the parameters, controls the joint module motor to move according to the preset control process, and detects and reports any abnormal control conditions. Step S2: The acquisition unit 20 acquires encoder position data, control unit open-loop position data and multi-turn data according to the preset data acquisition process, and at the same time detects and reports any abnormal data acquisition situations. Step S3: The analysis unit 30 performs filtering, peak-to-peak value calculation, ratio analysis and average difference coefficient judgment on the collected data, completes data calibration and outputs correction parameters, calculates the nonlinear error of the magnetic encoder based on the position data, and generates correction parameters for compensating for the nonlinear error. Step S4: The exception handling unit 40 determines whether to terminate the calibration based on the feedback exception situation. If it terminates, it controls the safe shutdown and feeds back the exception information. Step S5: Information output unit 50 outputs abnormal information, calculation results and analysis results, and performs data information storage operation through storage unit 60; Specifically, the present invention also provides an electronic device including a memory and a processor, wherein the memory is used to store executable instructions, and the processor is used to read the executable instructions stored in the memory to execute the magnetic encoder calibration system in Embodiment 1 or the magnetic encoder calibration method in Embodiment 2. The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by the processor, implements the magnetic encoder calibration system in Embodiment 1 or the magnetic encoder calibration method in Embodiment 2.
[0034] In summary, this invention provides a magnetic encoder calibration system and method. Through multi-speed segment sampling, abnormal situation judgment, and mean filtering, it achieves efficient, accurate, and safe calibration of magnetic encoder nonlinear error. This system requires no external equipment, is suitable for various joint modules, and can be widely used in fields such as robotics and servo systems, showing promising application prospects.
[0035] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A magnetic encoder calibration system, placed in the controller program of a joint module, calibrates the encoder output value through a module calibration algorithm, characterized in that, The calibration system includes: The control unit is used to control the movement of the joint module motor and detect whether there is any abnormality during the control process. If an abnormality is found, the abnormality is transmitted to the abnormality handling unit. The acquisition unit is used to acquire position data fed back by the encoder and open-loop position data of the control unit, and transmit them to the analysis unit. At the same time, it detects whether the acquired data is updated normally and transmits abnormal situations to the anomaly handling unit. The analysis unit performs calculations based on encoder position data and control unit open-loop position data to output correction parameters and transmit the calculation results to the information output unit and storage unit. The exception handling unit is used to analyze and make decisions on abnormal situations, and to determine whether the calibration needs to be terminated based on the analysis results. The information output unit is used to output abnormal information, calculation results, and analysis results to the operator. The storage unit is used to store the data information involved in the calibration process.
2. The magnetic encoder calibration system according to claim 1, characterized in that, The control process of the control unit includes: The system receives joint module parameters input by the operator, including rated speed, rated current, rated pass threshold, number of rotor pole pairs, phase resistance, phase inductance, and reduction ratio. Adjust the controller's inner current loop parameters based on the phase resistance and phase inductance parameters, set the electrical angle to 0°, and enable FOC control; The direct-axis current is increased at a rate of 1 A / s until it reaches the motor's rated current value, causing the motor rotor to be dragged to a position with an electrical angle of 0°. After waiting 100 ms, the encoder feedback position is recorded. ; Move to a position with an electrical angle of 360° at a speed of 18° / s, wait 100ms, and then record the encoder's feedback position. ; The electrical angle is obtained by multiplying the mechanical angle by the number of pole pairs of the motor rotor. The electrical angle value undergoes cyclic normalization. When the electrical angle value is greater than... If the count is zero, then start counting again from 0. denoted as the number of rotor pole pairs.
3. The magnetic encoder calibration system according to claim 2, characterized in that, The specific operations of the control unit to detect whether there is an abnormality in the control process include: calculating the number of rotor pole pairs of the motor using the rotor pole pair number formula, comparing the obtained number of rotor pole pairs of the motor with the number of rotor pole pairs in the input joint module parameters, and if the comparison is inconsistent, transmitting the abnormality to the abnormality handling unit. The expression for the rotor pole pair number formula is as follows: ,in, The number of rotor pole pairs, This is a rounding algorithm. For absolute value algorithms, This represents the total count per revolution of the encoder.
4. The magnetic encoder calibration system according to claim 2, characterized in that, The data acquisition process of the acquisition unit includes: A command is sent to the control unit to move at an electrical angular velocity of 54° / s to the encoder feedback position less than... Location, This represents the number of sampling points; After waiting 100ms, record the current encoder feedback position. and electric angle , Then it rotates at an electrical angular velocity of 18° / s, continuously acquiring the current electrical angle value. Whenever the electric angle and When the difference is greater than the step value, maintain the current position for 10ms and then record the encoder feedback position. and electrical angle Until the mechanical angle has rotated one full revolution, a total of [number] records are recorded. Encoder feedback location and electric angle ; After waiting 100ms, record the current encoder feedback position. and electric angle , Then rotate at an electrical angular velocity of -18° / s to continuously acquire the current electrical angle value. Whenever the electric angle and When the difference is greater than the step value, maintain the current position for 10ms and then record the encoder feedback position. and electric angle Until the mechanical angle has rotated one full revolution, a total of [number] records are recorded. Encoder feedback location and electric angle ; Calculate the two sets of corresponding position values to obtain a preliminary error curve; Continue sending commands to the control unit at (18° / s). electric angular velocity motion, Represents the velocity coefficient and satisfies ; After continuous motion for 1 second, when the encoder feedback position is less than When the position is reached, record the current encoder feedback position as... and electric angle , Continue rotating and continuously acquire the current electrical angle value. Whenever the electric angle and When the difference is greater than the step value, record the encoder feedback position. and electric angle A total of records Encoder feedback location and electric angle ; Based on encoder feedback position and electric angle Error curves were obtained under different electric angular velocities. The acquired data is then transmitted to the analysis unit.
5. A magnetic encoder calibration system according to claim 4, characterized in that, The formula for calculating the step value is: ,in, The step value, The number of rotor pole pairs, This represents the number of sampling points; The formula for calculating any element on the preliminary error curve is: ; in, This is represented as the preliminary error curve. The first on the initial error curve One element; The formula for calculating any element on the error curve under different electric angular velocities is: ; in, The error curves are shown for different electric angular velocities. Error curve The first Each element.
6. A magnetic encoder calibration system according to claim 5, characterized in that, The data acquisition process of the acquisition unit also includes: After acquiring and transmitting data to the analysis unit, control commands are sent to the control unit. The unit continues to rotate and returns to the position with an electrical angle of 0°. It then resumes rotation at the rated speed, maintaining a constant speed for 1 second before acquiring the current electrical angle. Whenever the electrical angle value exceeds... At that time, the current encoder feedback position value is recorded, the full cycle point acquisition is completed according to the number of reduction ratios, and the multi-cycle data is output to the analysis unit.
7. A magnetic encoder calibration system according to claim 5, characterized in that, The specific operation of the acquisition unit to detect whether the acquired data is updated normally includes: using the out-of-tolerance formula to calculate the out-of-tolerance value, and comparing the out-of-tolerance value calculated in real time during the data acquisition process with the preset threshold range. If the out-of-tolerance does not meet the preset threshold, i.e. the position deviation exceeds ±20%, the abnormal situation is transmitted to the abnormality processing unit. The expression for the out-of-tolerance formula is: ,in, This is indicated as out of tolerance. For the first The electrical angle of this time, This is an absolute value algorithm.
8. A magnetic encoder calibration system according to claim 6, characterized in that, The analysis unit performs calculations based on encoder position data and control unit open-loop position data, analyzes multi-loop data, and calculates the average difference coefficient for all data. If the average difference coefficient exceeds the calibration threshold, the abnormal situation is transmitted to the anomaly handling unit. Specific operations include: The data from different sets of electric angular velocity were subjected to mean filtering to obtain the error curves under different electric angular velocities after filtering, and the peak-to-peak value of each set of data was calculated. The two sets of corresponding position values collected are used as preliminary data. The preliminary data are then filtered by mean to obtain the preliminary error curve after filtering. The peak-to-peak value of the preliminary data is then calculated. Calculate the ratio of the peak-to-peak value of multiple sets of data to the peak-to-peak value of the initial data, sort the data in ascending order, take out the first 3 sets and calculate the average value, calculate the average difference coefficient of the three sets of data and determine whether it is less than the calibration threshold. If the average difference coefficient between the two sets of data is not less than the calibrated threshold, the first two sets are used to calculate the average difference coefficient between the two sets of data and determine whether it is less than the calibrated threshold. If neither is less than the threshold, the abnormal situation is transmitted to the abnormal handling unit. If the value is less than the calibration threshold, the corresponding average value is used to scale the initial data to complete the data calibration. It outputs a nonlinear error curve and transmits the calculation results to the operator through the information output unit, while storing the data information through the storage unit.
9. A magnetic encoder calibration system according to claim 1, characterized in that, When the abnormal situation is received, the abnormal handling unit controls the motor to stop safely and transmits the abnormal information to the operator through the information output unit.
10. A magnetic encoder calibration method, applied to the magnetic encoder calibration system according to any one of claims 1-9, characterized in that, Specifically, the following steps are included: Step S1: The control unit receives parameter input and adjusts the parameters, controls the joint module motor to move according to the preset control process, and detects and reports any abnormal control conditions. Step S2: The acquisition unit acquires encoder position data, control unit open-loop position data and multi-turn data according to the preset data acquisition process, and at the same time detects and reports any abnormal data acquisition situations. Step S3: The analysis unit filters the collected data, calculates peak-to-peak values, performs ratio analysis and determines the average difference coefficient, completes data calibration, and outputs correction parameters. Step S4: The exception handling unit determines whether to terminate the calibration based on the feedback exception situation. If it terminates, it controls the safe shutdown and feeds back the exception information. Step S5: The information output unit outputs abnormal information, calculation results, and analysis results, and performs data information storage operations through the storage unit.
Citation Information
Patent Citations
Motor state detection method and device
CN107544022A
Nonlinear error calibration method and system of magnetic encoder, magnetic encoder and motor
CN120576809A
Off-axis magnetic encoder data calibration compensation method
CN120760774A