Power-on initial positioning and fault-tolerant control method of double-code-channel encoder

By using synchronous signal analysis and dynamic compensation methods for dual-track encoders, the problems of rapid start-up and high-precision operation of encoders in industrial scenarios are solved, achieving rapid positioning and fault-tolerant control, which is suitable for servo systems and precision machine tools.

CN121829614APending Publication Date: 2026-04-10ZHEJIANG SHUNHUI SEAL CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-25
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing encoder technologies are insufficient to meet the demands of industrial scenarios for rapid start-up and uninterrupted operation. Single-track encoders are time-consuming and costly in positioning, while dual-track encoders have low positioning efficiency and insufficient fault tolerance.

Method used

It adopts a dual-track encoder, with the coarse track being an absolute Gray code and the fine track being an incremental AB phase pulse code. By synchronously acquiring and analyzing signals, combined with a pre-stored mapping table, it achieves rapid initial positioning, and in the fault-tolerant control stage, it achieves high-precision operation through dynamic compensation.

Benefits of technology

It achieves rapid positioning without zeroing upon power-on, with a positioning time of ≤10ms and a fault switching response of ≤0.1ms, improving production continuity while balancing low cost and high precision. It is suitable for servo systems and precision machine tools.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

The invention relates to the technical field of encoder control, and particularly discloses a power-on initial positioning and fault-tolerant control method for a double-code-channel encoder, which comprises a power-on initial positioning stage: S1, after a controller is powered on, completing initial configuration of an encoder interface and a storage module, synchronously acquiring and analyzing an initial absolute position signal of the coarse code channel and an initial relative position signal of the fine code channel through a high-speed encoder interface; s2, the controller decodes the Gray code signal of the coarse code channel, converts the Gray code signal into a decimal interval number, and determines a coarse positioning interval where the encoder is located currently; s3, the controller calls a pre-stored fine code channel relative position and absolute position mapping table uniquely corresponding to the coarse positioning interval from an external storage module; and S4, the controller reads the initial relative pulse count of the fine code channel, inquires the absolute position offset corresponding to the pulse count in the mapping table, and calculates the current absolute position of the encoder through the coarse interval reference absolute position and the offset corresponding to the fine code channel.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to the technical field of encoder control, in particular to a power-on initial positioning and fault-tolerant control method of a double-channel encoder. BACKGROUND

[0002] In the fields of industrial automation, servo drive, precision machine tool and robot control, as a core component for position detection, the initial positioning efficiency and fault tolerance of an encoder directly affect the starting speed and running continuity of equipment.

[0003] The current existing encoder technology cannot meet the needs of fast starting and non-stop running in industrial scenarios, and the specific limitations are as follows: Single-channel encoders are still the mainstream solution, but there are obvious defects: incremental single-channel encoders need to drive the equipment to rotate to the mechanical zero position to complete zero searching, and the positioning time is 1-3 seconds, and the space-limited scene cannot be implemented, and although absolute single-channel encoders do not need to search zero, high-precision models are extremely high in cost and difficult to apply on a large scale, and at the same time, single-channel encoders have no redundancy design, once the channel wears out or the signal is disturbed to cause amplitude attenuation or data interruption, the equipment will stop, which seriously affects the production continuity.

[0004] To solve the defects of single-channel encoders, the existing double-channel encoder solution only stays in simple hardware redundancy and does not fully exploit the collaborative value, some solutions do not distinguish the functions of coarse and fine channels, or although they distinguish, they do not establish the mapping relationship between the coarse positioning interval and the fine channel position, and the power-on still needs to be rotated for calibration, and the positioning time is more than 500ms, and a few solutions that prestore the corresponding relationship use full table continuous storage, and need to search and retrieve when calling, which takes more than 200us, and the overall positioning efficiency cannot meet the demand of fast starting, in addition, the existing double-channel fault tolerance is only static switching, and after the coarse channel fails, the fine channel lacks absolute reference and needs to be searched again, and after the fine channel fails, the coarse channel cannot meet the precision requirement due to low resolution, and all of them cannot realize non-stop high-precision running. SUMMARY

[0005] In order to overcome the defects of the prior art, the purpose of the present application is to provide a.

[0006] The technical scheme adopted by the present application is as follows: a power-on initial positioning and fault-tolerant control method of a double-channel encoder, which comprises a power-on initial positioning stage and a fault-tolerant control stage, the double channel comprises a coarse channel and a fine channel, the coarse channel is an absolute channel and adopts a Gray code encoding mode, and the fine channel is an incremental channel and adopts a quadrature AB phase pulse encoding mode; The power-on initial positioning stage comprises the following steps: S1: after the controller is powered on, the initialization configuration of the encoder interface and the storage module is completed, the initial absolute position signal of the coarse channel and the initial relative position signal of the fine channel are synchronously collected and analyzed through the high-speed encoder interface; S2: The controller decodes the Gray code signal of the coarse code track, converts it into a decimal interval number, and determines the coarse positioning interval where the encoder is currently located. S3: The controller retrieves the pre-stored mapping table of relative and absolute positions of the fine code track that uniquely corresponds to the coarse positioning interval from the external storage module. S4: The controller reads the initial relative pulse count of the fine code track, looks up the absolute position offset corresponding to the pulse count in the mapping table, and calculates the current absolute position of the encoder by adding the absolute position of the coarse interval reference to the offset of the fine code track, thus completing the initial positioning. The fault-tolerant control phase includes the following steps: T1: The controller synchronously samples the Gray code signal of the coarse code channel and the AB phase pulse signal of the fine code channel. The sampling content includes signal amplitude, pulse interval and data continuity. T2: If any sampling indicator of a single code channel triggers a threshold, or if two code channels simultaneously trigger any fault threshold, or if any code channel triggers at least two sampling indicator thresholds, then a fault is determined, and an alarm signal is output to the device host via the CAN bus. T3: If the coarse code track is determined to be faulty, the controller uses the initial absolute position obtained in step S4 as a fixed reference, collects the AB phase pulse change of the fine code track in real time, and obtains the absolute position data by the formula initial absolute position + (fine code track pulse change × fine code track resolution). T4: If the fault is determined to be in the fine code track, the controller reads the absolute position signal output by the coarse code track in real time, uses a linear interpolation algorithm to generate a compensation point in the current coarse positioning interval that matches the resolution of the fine code track, and outputs position data with a resolution close to that of the fine code track by using the coarse interval reference position + (interpolation coefficient × interval step size).

[0007] During the initial positioning phase after power-on, the controller first initializes the hardware interface after power-on, determines the current coarse positioning interval by decoding the Gray code signal of the coarse code track, then retrieves the pre-stored relative and absolute position mapping table of the fine code track in that interval, and finally calculates the precise absolute position by combining the initial pulse count of the fine code track with the offset in the mapping table. The entire process does not require driving the equipment to rotate. During the fault-tolerant control phase, the controller synchronously samples the signal amplitude, pulse interval, and data continuity of the dual code channels, and judges the fault type according to the preset threshold. If the coarse code channel is faulty, the real-time position is calculated based on the initial absolute position and the pulse change of the fine code channel. If the fine code channel is faulty, the coarse code channel's low-resolution defect is compensated by linear interpolation, and high-precision data is output.

[0008] In some implementations, the coarse code channel is a 12-bit absolute Gray code channel with an encoding range of 0~4095, corresponding to 4096 unique coarse positioning intervals. The position step size of each interval is 360° / 4096≈0.087°. Gray code encoding ensures that only one bit of data changes when switching between adjacent intervals. The fine code channel is a 17-bit incremental AB phase code channel, outputting 2^17=131072 pulses per revolution, with a resolution of 360° / 131072≈0.005° and a 90° phase difference between the AB phase pulses. The coarse code channel is a 12-bit absolute Gray code, with an encoding range of 0~4095 corresponding to 4096 unique intervals. The step size of each interval is approximately 0.087°. Only one bit of data changes between adjacent Gray code intervals to avoid decoding misjudgments. The fine code channel is a 17-bit incremental AB phase code channel, outputting 131072 pulses per revolution with a resolution of approximately 0.005°. The AB phase pulses have a 90° phase difference, and the rotation direction can be determined through the phase relationship. The coarse code channel is installed on the same axis to ensure the synchronization of position signals. The coarse code channel quickly locks the interval, while the fine code channel supplements the interval with high-precision data.

[0009] In some implementations, the generation of the mapping table for the relative and absolute positions of the precision code track in step S2 is as follows: A calibration device with an accuracy level ≤ ±0.001° drives the encoder to rotate uniformly 360° at a speed controlled at 100 rpm. The calibration device synchronously acquires the interval number of the coarse code track, the relative pulse count of the precision code track, and the standard absolute position at a sampling frequency of 10 kHz. The acquired data is processed. For each coarse positioning interval, all relative pulse values ​​of the precision code track from 0 to the maximum pulse count within that interval are recorded, and the absolute position offset corresponding to each pulse value is calculated. The processed data is then sorted according to the interval number, precision code track pulse count, and absolute position... The offset is formatted as a binary mapping table and stored in an external storage module, with each storage address corresponding to a specific interval number. The calibration process uses a calibration device with an accuracy of ≤ ±0.001°, driving the encoder to rotate 360° at a constant speed of 100 rpm. The coarse code track interval number, fine code track pulse count, and standard absolute position are collected synchronously at a sampling frequency of 10 kHz. Data processing is categorized according to coarse positioning intervals, recording the correspondence between the fine code track from 0 to the maximum pulse count within each interval, and calculating the absolute position offset for each pulse count. The offset is stored in a binary mapping table of interval number, pulse count, and offset in an external module, with each address corresponding to a specific interval number.

[0010] In some implementations, the fault threshold in step T2 is specifically set as follows: Signal amplitude threshold: The rated amplitude of the code channel output signal is 5V±0.5V. When the peak voltage of the monitored signal is below 3.5V for 100μs, an amplitude fault is triggered. Pulse interval threshold: The standard pulse interval of the precision code track is determined by the rotation speed. When the absolute value of the deviation between the actual interval and the standard interval of three consecutive pulses exceeds 5% and lasts for two sampling cycles, a pulse interval fault is triggered. Data continuity threshold: If the coarse code channel outputs the same Gray code for two consecutive sampling periods, or if the fine code channel has no pulse change for two consecutive sampling periods, a data continuity fault is triggered. The signal amplitude threshold is 5V ± 0.5V of the rated amplitude of the code channel. When the peak voltage lasts for 100μs < 3.5V, which is 70% of the rated value, it is judged as an amplitude fault, such as line loss or electromagnetic interference. The pulse interval threshold is calculated based on the encoder rotation speed to determine the standard pulse interval of the code track. If the actual interval of three consecutive pulses deviates from the standard interval by more than 5% and lasts for two sampling cycles, it is determined to be a pulse interval fault, such as code track wear or pulse loss. The data continuity threshold is defined as follows: if the coarse code channel outputs the same Gray code for two consecutive sampling cycles, it is excluded if the signal is stationary; if the fine code channel has no pulse for two consecutive cycles, it is excluded if the signal is stationary. These are considered continuity faults, such as signal interruption.

[0011] In some implementations, the controller uses an ARM Cortex-M4 core microcontroller, specifically the STM32F407VET6, with a sampling rate ≥1MHz. The controller also integrates one CAN2.0A / B bus interface, supporting three baud rates: 250kbps, 500kbps, and 1Mbps, for transmitting real-time location data and fault alarm signals to the device host, with a data transmission delay ≤1ms.

[0012] In some implementations, the positioning time of the initial positioning phase upon power-on is ≤10ms, which includes controller initialization, dual-channel signal acquisition and decoding, mapping table retrieval, absolute position calculation, and data output. The fault switching response time of the fault-tolerant control phase is ≤0.1ms, which starts counting from the time the controller detects the fault indicator trigger threshold and includes fault judgment, working mode switching, compensation algorithm initialization, and data output after the first compensation, ensuring that the equipment has no obvious operational interruption.

[0013] In some implementations, the mapping table in step S3 is stored and retrieved in a partitioned manner. The external storage module partitions the 4096 coarse positioning intervals of the coarse code channel. Each block stores only the relative pulse count and absolute position offset data of the fine code channel for that interval. When the controller retrieves the data, it locates the corresponding storage block according to the decimal interval number obtained in step S2, and the retrieval time is ≤50μs. Alternatively, the storage design is that the external storage module partitions the 4096 intervals of the coarse code channel. Each block stores only the pulse count and offset data of the fine code channel for the corresponding interval, without redundantly storing other interval information. The retrieval logic is that the controller directly locates the corresponding storage block using the decimal interval number obtained in step S2, without traversing the entire table, and the retrieval time is ≤50μs.

[0014] In some implementations, the calculation of the change in the AB phase pulse of the precision code track in step T3 includes rotation direction identification logic. The controller determines the rotation direction by judging the phase lead or lag relationship between the A phase pulse and the B phase pulse of the precision code track. When the A phase pulse leads the B phase pulse by 90°, it is determined to be a forward rotation and the pulse change is positive. When the B phase pulse leads the A phase pulse by 90°, it is determined to be a reverse rotation and the pulse change is negative.

[0015] The beneficial effects of this invention are as follows: it achieves rapid positioning without zeroing upon power-on, with a positioning time of ≤10ms, breaking through the time and space limitations of traditional zeroing operations, significantly shortening the equipment startup cycle; in the event of a single code track failure, it continuously outputs high-precision position data through dynamic compensation, with a fault switching response of ≤0.1ms, avoiding equipment downtime and significantly improving production continuity; the 12-bit coarse code track and the 17-bit fine code track work together to balance low cost and 0.005° industrial-grade accuracy; the Gray code anti-interference design reduces decoding errors; the high-precision calibration-generated mapping table combined with a partitioned storage strategy has a retrieval time of ≤50μs, ensuring both positioning accuracy and efficiency; multi-dimensional quantification of fault thresholds reduces false alarms and missed alarms; the STM32 controller and CAN bus are adapted to industrial scenarios, with a transmission latency of ≤1ms; it supports flexible compatibility with multiple baud rates; it requires no on-site calibration, lowering the barrier to entry; the overall cost increment is low; and it is suitable for the needs of multiple fields such as servo systems and precision machine tools. Attached Figure Description

[0016] Fig. 1 This is a schematic diagram of the power-on initial positioning stage of the present invention; Fig. 2 This is a schematic diagram of the fault-tolerant control stage of the present invention; Fig. 3 This is an example diagram illustrating the relative and absolute position mapping of the precision code path in this invention. Detailed Implementation

[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0018] Please see Figs. 1 to 3 This invention provides a technical solution: a power-on initial positioning and fault-tolerant control method for a dual-track encoder, comprising a coarse track and a fine track, which are coaxially mounted to ensure synchronous output of position signals. Coarse code track: It adopts an absolute code track design and uses Gray code for encoding. It is used to quickly lock the current position range of the encoder and output a low-resolution but globally unique absolute position signal. Precision Code Track: Adopts incremental code track design, with orthogonal AB phase pulse encoding method, used to supplement high-precision position information within the position range, outputting high-resolution pulse signals that only represent relative position changes.

[0019] During the initial positioning phase after power-on, there is no need to drive the encoder or rotate the equipment. Positioning is completed entirely through signal analysis and data calculation. The specific steps are as follows: S1: Power-on initialization After the controller is powered on, it completes the initialization configuration of the encoder interface and external storage module within 1ms. It synchronously acquires the initial absolute position signal (Gray code form) of the coarse code track and the initial relative position signal (AB phase pulse counting form) of the fine code track through the high-speed encoder interface, and completes the preliminary analysis of the signal to ensure that there is no phase deviation of the dual code track signal. S2: Coarse positioning interval determination The controller decodes the Gray code signal of the coarse code track, converts the binary Gray code into a decimal interval number, and locks the current coarse positioning interval of the encoder based on the number. Each interval corresponds to a fixed reference absolute position. S3: Mapping table retrieval According to the decimal interval number obtained in step S2, the controller retrieves the pre-stored "relative position-absolute position mapping table of fine code track" that uniquely corresponds to the coarse positioning interval from the external storage module. This mapping table is generated by high-precision calibration before the encoder leaves the factory. The storage address corresponds one-to-one with the interval number, and the retrieval time is ≤50μs. S4: Precise Absolute Position Calculation The controller reads the initial relative pulse count of the precision code track, looks up the absolute position offset corresponding to that pulse count in the retrieved mapping table, and calculates the encoder's current precise absolute position using the formula "Current Absolute Position = Coarse Interval Reference Absolute Position + Precision Code Track Corresponding Offset," thus completing the initial positioning. The total time for the entire power-on initial positioning phase is ≤10ms, including controller initialization, dual-code track signal acquisition and decoding, mapping table retrieval, absolute position calculation, and data output.

[0020] The fault-tolerant control phase achieves continuous operation under single-track faults through real-time monitoring, fault diagnosis, and dynamic compensation. The specific steps are as follows: T1: Synchronous signal sampling The controller synchronously samples the Gray code signal of the coarse code channel and the AB phase pulse signal of the fine code channel at a frequency of ≥1kHz, with a synchronization error of ≤1μs. The sampling content includes three core indicators: signal amplitude, pulse interval, and data continuity, providing data support for fault diagnosis.

[0021] T2: Fault Type Determination Three types of fault thresholds are preset, and the controller identifies faults by first judging a single code channel and then verifying a dual code channel: Signal amplitude threshold: The rated amplitude of the code channel output signal is 5V±0.5V. When the peak voltage of the monitored signal is lower than 3.5V for 100μs, which is 70% of the rated value, an amplitude fault is triggered. Pulse interval threshold: The standard pulse interval of the precision code track is calculated according to the formula "standard pulse interval = 1 / (encoder rotation speed × number of pulses per revolution of precision code track / 60)". The rotation speed is in rpm. When the absolute value of the deviation between the actual interval of 3 consecutive pulses and the standard interval exceeds 5% and lasts for 2 sampling cycles, a pulse interval fault is triggered. Data continuity threshold: If the coarse code channel outputs the same Gray code for two consecutive sampling cycles, excluding the equipment being stationary, or if the fine code channel shows no pulse change for two consecutive sampling cycles, excluding the equipment being stationary, then a data continuity fault is triggered. If any sampling index of a single code channel triggers a threshold, it is determined to be a partial fault of that code channel. If both code channels trigger any fault threshold simultaneously, or if any code channel triggers at least two sampling index thresholds, it is determined to be a serious fault. The controller will immediately output an alarm signal to the device host via the CAN bus to prompt manual intervention. T3: Coarse Code Track Fault Compensation If a coarse code track fault is detected, the controller immediately switches to a working mode with the fine code track as the main track and an initial absolute position reference. Using the initial absolute position obtained in step S4 as a fixed reference, the controller collects the AB phase pulse changes of the fine code track in real time. At the same time, the rotation direction is determined by judging the phase lead or lag relationship between the A phase pulse and the B phase pulse of the fine code track. When the A phase pulse leads the B phase pulse by 90°, it is determined to be a forward rotation, and the pulse change is taken as a positive value. When the B phase pulse leads the A phase pulse by 90°, it is determined to be a reverse rotation, and the pulse change is taken as a negative value. Finally, the absolute position data is continuously calculated and output using the formula "Real-time absolute position = Initial absolute position + (Fine code track pulse change × Fine code track resolution)".

[0022] T4: Precision Code Track Fault Compensation If a fault is detected in the precision code track, the controller immediately switches to a coarse code track-based mode with linear interpolation compensation. It reads the absolute position signal output from the coarse code track in real time, which is the reference position of the current coarse positioning interval. A linear interpolation algorithm is then used to generate compensation points within the current coarse positioning interval that match the resolution of the precision code track. The interpolation coefficients are dynamically adjusted according to the equipment's operating speed. The output position data, with a resolution close to that of the precision code track, is calculated using the formula: "Compensated absolute position = Coarse interval reference position + (Interpolation coefficient × Interval step size)". The fault switching response time for the entire fault-tolerant control phase is ≤0.1ms. Timing begins from when the controller detects the fault indicator trigger threshold, encompassing the entire process including fault diagnosis, mode switching, compensation algorithm initialization, and data output after the first compensation, ensuring no significant operational interruption.

[0023] In practical implementation, the coarse code channel is preferably a 12-bit absolute Gray code channel with an encoding range of 0~4095, corresponding to 4096 unique coarse positioning intervals. The position step size of each interval is 360° / 4096≈0.087°. Gray code encoding can ensure that only one bit of data changes when switching between adjacent intervals, effectively avoiding decoding misjudgments. The fine code channel is preferably a 17-bit incremental AB phase code channel, outputting 2 bits per revolution. 17 =131072 pulses, with a resolution of 360° / 131072≈0.005°, and a 90° phase difference between the A and B phase pulses, providing a hardware foundation for rotation direction recognition.

[0024] The mapping table is generated by a high-precision calibration device with an accuracy level of ≤ ±0.001°. The calibration device drives the encoder to rotate 360° at a constant speed of 100 rpm and synchronously collects the interval number of the coarse code track, the relative pulse number of the fine code track, and the standard absolute position at a sampling frequency of 10 kHz. The laser interferometer built into the calibration device provides the data. The collected data is classified and processed. For each coarse positioning interval, all relative pulse values ​​of the fine code track from 0 to the maximum pulse number within the interval are recorded, and the absolute position offset corresponding to each pulse value is calculated. The processed data is organized into a binary mapping table in the format of "interval number - fine code track pulse number - absolute position offset" and stored in an external Flash storage module.

[0025] The controller uses an ARM Cortex-M4 core microcontroller, model STM32F407VET6. Its encoder interface has a sampling rate of ≥1MHz and can simultaneously parse coarse code Gray code and fine code AB phase pulse signals. The controller also integrates a CAN2.0A / B bus interface, supporting three baud rates: 250kbps, 500kbps, and 1Mbps. It can be flexibly configured according to equipment requirements to transmit real-time position data, with an update frequency of ≥1kHz, and fault alarm signals to the device host, with a data transmission delay of ≤1ms.

[0026] The external storage module is partitioned according to the 4096 coarse positioning intervals of the coarse code channel. Each block only stores the relative pulse count and absolute position offset data of the fine code channel corresponding to that interval, without redundantly storing information of other intervals. When the controller retrieves the data, it can directly locate the corresponding storage block by the interval number without traversing the entire table, which greatly improves the retrieval efficiency.

[0027] The working principle and usage process of this invention are as follows: The coarse code track (12-bit absolute Gray code) and the fine code track (17-bit incremental AB phase) are coaxially installed to ensure synchronous output of position signals. The coarse code track is responsible for quickly locking the global position range. The 4096 ranges correspond to a step size of ≈0.087°. Only one bit of data changes between adjacent Gray code ranges, making it resistant to interference and less prone to misjudgment during decoding. The fine code track is responsible for supplementing the high-precision data within the range. Each 131072 pulses per revolution corresponds to a resolution of ≈0.005°. A 90° phase difference between the AB phase pulses can determine the rotation direction. The encoder interface sampling rate is ≥1MHz, which can synchronously parse the dual code track signals. The external Flash storage module pre-stores the relative and absolute position mapping table of the fine code track. This table is generated by the ±0.001° calibration device before leaving the factory and is stored in partitions according to the 4096 coarse positioning ranges. The retrieval time is ≤50μs, providing data support for rapid positioning. The initial positioning phase after power-on involves initializing the encoder interface and storage module within 1ms after the controller is powered on. It synchronously acquires and parses the coarse Gray code signal (absolute position) and the AB phase pulse signal (relative position count) of the fine code through the high-speed interface. Then, it decodes the coarse Gray code, converts it into a decimal interval number, locks the current coarse positioning interval and the corresponding reference absolute position, and directly locates the corresponding partition of the storage module according to the interval number. It retrieves the mapping table dedicated to the interval, which records the absolute position offset corresponding to each relative pulse count of the fine code within the interval. Finally, it reads the initial relative pulse count of the fine code, looks up the corresponding offset in the mapping table, and calculates the precise absolute position by "current absolute position = coarse interval reference absolute position + fine code offset", thus completing the entire process from power-on to outputting the precise position. The fault-tolerant control phase is achieved through real-time monitoring, precise judgment, and dynamic compensation. The controller synchronously samples the dual-channel signal at a frequency of ≥1kHz, monitoring three indicators: signal amplitude, pulse interval, and data continuity. The synchronization error is ≤1μs. Based on quantization thresholds, the fault type is determined: a signal amplitude <3.5V for 100μs, a pulse interval deviation >5% for 2 cycles, or no change for 2 consecutive cycles all trigger the corresponding fault. A single channel triggering any threshold indicates a partial fault, while simultaneous triggering of both channels or triggering both thresholds in a single channel indicates a severe fault. In the event of a severe fault, an alarm is output via the CAN bus. Dynamic compensation is performed for partial faults: if the coarse channel is faulty, the system switches to the fine channel as the primary channel and initializes the signal. In the initial absolute position reference mode, the rotation direction is determined by the A / B phase, with A phase leading as positive and pulse change amount as negative. The output data is calculated as "Real-time absolute position = Initial reference + (Pulse change amount × Fine code channel resolution)". The error is ≤0.1°. If the fine code channel fails, the mode switches to coarse code channel as the main mode with linear interpolation compensation. The reference position of the coarse code channel interval is read, and compensation points matching the fine code channel resolution are generated within the interval. The output data is calculated as "Compensated position = Interval reference + (Interpolation coefficient × Interval step size)". The error is ≤0.01°. The entire fault switching response time is ≤0.1ms, ensuring no significant interruption in equipment operation.

[0028] Finally, it should be noted that the above descriptions are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A power-on initial positioning and fault-tolerant control method for a dual-track encoder, characterized in that, It includes a power-on initial positioning stage and a fault-tolerant control stage. The dual code channel includes a coarse code channel and a fine code channel. The coarse code channel is an absolute code channel and adopts Gray code encoding. The fine code channel is an incremental code channel and adopts orthogonal AB phase pulse encoding. The initial power-on positioning phase includes the following steps: S1: After the controller is powered on, it completes the initialization configuration of the encoder interface and storage module, and synchronously acquires and parses the initial absolute position signal of the coarse code track and the initial relative position signal of the fine code track through the high-speed encoder interface. S2: The controller decodes the Gray code signal of the coarse code track, converts it into a decimal interval number, and determines the coarse positioning interval where the encoder is currently located. S3: The controller retrieves the pre-stored mapping table of relative and absolute positions of the fine code track that uniquely corresponds to the coarse positioning interval from the external storage module. S4: The controller reads the initial relative pulse count of the fine code track, looks up the absolute position offset corresponding to the pulse count in the mapping table, and calculates the current absolute position of the encoder by adding the absolute position of the coarse interval reference to the offset of the fine code track, thus completing the initial positioning. The fault-tolerant control phase includes the following steps: T1: The controller synchronously samples the Gray code signal of the coarse code channel and the AB phase pulse signal of the fine code channel. The sampling content includes signal amplitude, pulse interval and data continuity. T2: If any sampling indicator of a single code channel triggers a threshold, or if two code channels simultaneously trigger any fault threshold, or if any code channel triggers at least two sampling indicator thresholds, then a fault is determined, and an alarm signal is output to the device host via the CAN bus. T3: If the coarse code track is determined to be faulty, the controller uses the initial absolute position obtained in step S4 as a fixed reference, collects the AB phase pulse change of the fine code track in real time, and obtains the absolute position data by the formula initial absolute position + (fine code track pulse change × fine code track resolution). T4: If the fault is determined to be in the fine code track, the controller reads the absolute position signal output by the coarse code track in real time, uses a linear interpolation algorithm to generate a compensation point in the current coarse positioning interval that matches the resolution of the fine code track, and outputs position data with a resolution close to that of the fine code track by using the coarse interval reference position + (interpolation coefficient × interval step size).

2. The power-on initial positioning and fault-tolerant control method for a dual-track encoder according to claim 1, characterized in that, The coarse code channel is a 12-bit absolute Gray code channel with an encoding range of 0~4095, corresponding to 4096 unique coarse positioning intervals. The position step size of each interval is 360° / 4096≈0.087°. Gray code encoding can ensure that only 1 bit of data changes when switching between adjacent intervals. The fine code channel is a 17-bit incremental AB phase code channel, which outputs 2^17=131072 pulses per revolution, with a resolution of 360° / 131072≈0.005° and a 90° phase difference between the AB phase pulses.

3. The power-on initial positioning and fault-tolerant control method for a dual-track encoder according to claim 1, characterized in that, In step S2, the mapping table for the relative and absolute positions of the precision code track is generated as follows: the encoder is driven to rotate 360° at a constant speed of 100 rpm by a calibration device with an accuracy level of ≤ ±0.001°. The calibration device synchronously collects the interval number of the coarse code track, the relative pulse number of the precision code track, and the standard absolute position at a sampling frequency of 10 kHz. The collected data is processed, and for each coarse positioning interval, all relative pulse values ​​of the precision code track from 0 to the maximum pulse number within that interval are recorded, and the absolute position offset corresponding to each pulse value is calculated. The processed data is organized into a binary mapping table in the format of interval number, precision code track pulse number, and absolute position offset, and stored in an external storage module, with the storage address corresponding one-to-one with the interval number.

4. The power-on initial positioning and fault-tolerant control method for a dual-track encoder according to claim 1, characterized in that, The fault threshold in step T2 is specifically set as follows: Signal amplitude threshold: The rated amplitude of the code channel output signal is 5V±0.5V. When the peak voltage of the monitored signal is below 3.5V for 100μs, an amplitude fault is triggered. Pulse interval threshold: The standard pulse interval of the precision code track is determined by the rotation speed. When the absolute value of the deviation between the actual interval and the standard interval of three consecutive pulses exceeds 5% and lasts for two sampling cycles, a pulse interval fault is triggered. Data continuity threshold: If the coarse code channel outputs the same Gray code for two consecutive sampling periods, or if the fine code channel has no pulse change for two consecutive sampling periods, a data continuity fault is triggered.

5. The power-on initial positioning and fault-tolerant control method for a dual-track encoder according to claim 1, characterized in that, The controller uses an ARM Cortex-M4 core microcontroller, specifically the STM32F407VET6, with a sampling rate ≥1MHz. The controller also integrates a CAN2.0A / B bus interface, supporting three baud rates: 250kbps, 500kbps, and 1Mbps, for transmitting real-time location data and fault alarm signals to the device host, with a data transmission delay ≤1ms.

6. The power-on initial positioning and fault-tolerant control method for a dual-track encoder according to claim 1, characterized in that, The positioning time during the initial positioning phase after power-on is ≤10ms. This time includes controller initialization, dual-channel signal acquisition and decoding, mapping table retrieval, absolute position calculation, and data output. The fault switching response time during the fault-tolerant control phase is ≤0.1ms. This time starts counting from when the controller detects the fault indicator trigger threshold. It includes fault judgment, working mode switching, compensation algorithm initialization, and data output after the first compensation, ensuring that the equipment has no obvious operational interruption.

7. The power-on initial positioning and fault-tolerant control method for a dual-track encoder according to claim 3, characterized in that, In step S3, the mapping table is stored and retrieved in a partitioned manner. The external storage module partitions the 4096 coarse positioning intervals of the coarse code channel. The block only stores the relative pulse count and absolute position offset data of the fine code channel of that interval. When the controller retrieves the data, it locates the corresponding storage block according to the decimal interval number obtained in step S2. The retrieval time is ≤50μs.

8. The power-on initial positioning and fault-tolerant control method for a dual-track encoder according to claim 1, characterized in that, The calculation of the change in the AB phase pulse of the precision code track in step T3 includes the logic for identifying the rotation direction. The controller determines the rotation direction by judging the phase lead or lag relationship between the A phase pulse and the B phase pulse of the precision code track. When the A phase pulse leads the B phase pulse by 90°, it is determined to be a forward rotation and the pulse change is taken as a positive value. When the B phase pulse leads the A phase pulse by 90°, it is determined to be a reverse rotation and the pulse change is taken as a negative value.