Servo control method and related equipment based on EtherCAT bus

Through the state machine isolation mechanism and position locking algorithm, the safety hazards and position jitter accumulation problems of the EtherCAT bus in servo drive control are solved, the high accuracy and safe operation of the servo motor are achieved, and the system state management and resource utilization are optimized.

CN120233802BActive Publication Date: 2025-08-26临海市新睿电子科技股份有限公司
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510729757.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-03
Publication Date
2025-08-26
Estimated Expiration
2045-06-03

AI Technical Summary

Technical Problem

In the servo drive control, there are safety hazards in the start stage and the accumulation of position jitter under high-frequency control, resulting in unstable operation of the servo motor and insufficient safety.

Method used

The state machine isolation mechanism and position locking algorithm are adopted to enter the power-on state by receiving the start command, activate the communication between the master and slave devices, ensure that the EtherCAT bus is operated in a safe state, and migrate to the idle state after meeting the time threshold, perform safe preprocessing and position locking, and combine deviation threshold detection and position update filtering algorithm to prevent erroneous operation and position deviation accumulation.

Benefits of technology

It improves the operating accuracy and safety of the servo motor, avoids safety hazards caused by misjudgment of zero position and position jitter, optimizes system status management, and improves the system response speed and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120233802B_ABST
    Figure CN120233802B_ABST
Patent Text Reader

Abstract

The present application relates to the field of industrial automation control, and in particular to a servo control method and related equipment based on the EtherCAT bus, comprising: receiving a startup instruction, executing a state machine isolation mechanism to enter a power-on state; in the power-on state, activating the communication thread between the master device and the slave device, and migrating from the power-on state to a safe state; in the safe state, the EtherCAT bus enters a running state, and when the time the EtherCAT bus enters the running state is greater than a time threshold, it migrates from the safe state to the idle state; in the idle state, executing a safety preprocessing operation to turn off the enable and initialize the target position register to an invalid value, and when an enable signal is detected, migrating from the idle state to the operating state; in the operating state, executing a position locking algorithm to lock the current position, and detecting whether the enable signal disappears. If so, and receiving an exit instruction, executing an end operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of industrial automation control, and in particular to a servo control method and related equipment based on an EtherCAT bus. Background Art

[0002] With the rapid development of intelligent industrial manufacturing, EtherCAT has become one of the mainstream communication protocols in industrial automation due to its high real-time performance, high synchronization, and low communication latency. As the core execution unit of industrial automation, the safety and reliability of servo drive systems directly affect the performance of the entire system. Currently, the application of EtherCAT in servo drive control is relatively mature, but many challenges still exist in terms of safety control, such as the following two major technical deficiencies:

[0003] 1. During the power-on initialization phase, when the EtherCAT bus has not yet entered the operational state (OP), the controller periodically sends and receives PDO (Process Data Object) data packets. Since the bus has not yet completed initialization, the position data fed back by the encoder is in an invalid state (default value 0). However, the control system will still upload this position information to the upper-level control program, posing a safety hazard due to misjudgment of the zero position.

[0004] 2. During the servo-enabling phase after the bus enters the OP state, traditional control methods employ closed-loop control logic that reads the current position in real time and immediately writes the target position. When the control cycle is less than 1ms (frequency > 1000Hz), micron-level position jitter (on the order of ±0.001mm) caused by mechanical load vibration, phase delay caused by driver PID control, and sensor noise interference can lead to unidirectional deviation accumulation within consecutive control cycles. Ultimately, this can cause the servo motor to overspeed (typically exceeding 300% of the rated speed), potentially causing a robot arm collision in multi-axis robot scenarios.

[0005] Therefore, the present application urgently needs to provide a servo control method and related equipment based on the EtherCAT bus with higher safety performance to solve the above technical problems. Summary of the Invention

[0006] The purpose of this application is to overcome the above technical problems and provide a servo control method and related equipment based on EtherCAT bus, which can improve the accuracy and safety of servo motor operation.

[0007] In a first aspect, an embodiment of the present application discloses a servo control method based on an EtherCAT bus, which adopts the following scheme:

[0008] A servo control method based on an EtherCAT bus comprises: receiving a startup instruction, executing a state machine isolation mechanism to enter a startup state; in the startup state, activating a communication thread between a master device and a slave device, and migrating from the startup state to a safe state of the state machine isolation mechanism; in the safe state, the EtherCAT bus enters a running state, and when the time the EtherCAT bus enters the running state is greater than a time threshold, migrating from the safe state to an idle state of the state machine isolation mechanism; in the idle state, executing a safety preprocessing operation to disable an enable and initialize a target position register to an invalid value, and when an enable signal is detected, migrating from the idle state to an operating state of the state machine isolation mechanism; in the operating state, executing a position locking algorithm to lock a current position, and detecting whether the enable signal disappears; if so, and an exit instruction is received, executing an end operation; wherein the position locking algorithm is as follows: obtaining the current position as an initial position, and when no target position instruction is received, using the initial position as a target position for position locking, and when the target position instruction is received, moving to a target position corresponding to the target position instruction based on the initial position.

[0009] By adopting the above technical solution, the accuracy and safety of servo motor operation can be effectively improved. Specific effects include: By receiving a startup command and executing a state machine isolation mechanism to enter the power-on state, the servo control system ensures good isolation during the startup phase, avoiding potential interference and anomalies. In the power-on state, the communication threads between the master and slave devices are activated and then migrated to the safe state, achieving efficient communication initialization between the master and slaves and improving the system's responsiveness and reliability. In the safe state, the system transitions to the idle state by determining the EtherCAT bus operating status and time thresholds, optimizing the system's state management process, improving resource utilization, and reducing energy consumption. In the idle state, safety preprocessing is performed, disabling the enable and initializing the target position register to an invalid value, enhancing system safety and preventing misoperation. In the operating state, a position lock algorithm locks the current position, ensuring target position accuracy and improving the precision and stability of servo control. Furthermore, termination operations are executed based on the enable signal and exit command, further ensuring system controllability and safety.

[0010] Optionally, the operating state further includes: performing deviation detection on the target position based on a deviation threshold detection algorithm to determine whether to perform an emergency stop operation; wherein the deviation threshold detection algorithm is:

[0011] ;

[0012] Among them, in positioning mode is the maximum position deviation; is the rated position parameter;

[0013] In speed mode is the dynamic position tolerance, which is used to reflect the tolerance of instantaneous position deviation caused by speed fluctuation; is the maximum angular velocity; is the sampling period;

[0014] When the preset period is met , an emergency stop operation is performed.

[0015] By adopting the above technical solution, it is possible to detect deviations in the target position during operation, thereby effectively determining whether an emergency stop operation is required. Specifically, the deviation threshold detection algorithm can accurately evaluate the deviation between the current position and the target position by defining the maximum position deviation in positioning mode and the dynamic position tolerance in speed mode. In positioning mode, the algorithm uses the relationship between the maximum position deviation and the rated position parameter to ensure that the equipment operates within the permitted range; in speed mode, the dynamic position tolerance takes into account the tolerance for instantaneous position offsets caused by speed fluctuations, and combines the maximum angular velocity and sampling period to further improve the accuracy of detection. When the deviation condition is met for consecutive preset cycles, the system will perform an emergency stop operation, thereby effectively preventing safety hazards or equipment damage caused by excessive position deviations.

[0016] Optionally, the operating state further includes: updating the target position based on a position update filtering algorithm; the position update filtering algorithm is:

[0017] ;

[0018] in, is the position feedback of the i-th cycle, N is the window length, is the position after filtering of the k-th period position.

[0019] By adopting the above technical solution, the target position can be updated during operation based on a position update filtering algorithm. This algorithm calculates the average of the position feedback from the i-th cycle and the historical data within the window length to obtain the filtered position, effectively reducing noise interference in the position signal and improving the accuracy and stability of position control. Specifically, the position update filtering algorithm can smooth the position change curve, reduce instantaneous position fluctuations caused by measurement errors or external disturbances, and ensure that the servo control system achieves more accurate target position tracking during dynamic operation.

[0020] Optionally, in the operating state, before the execution end operation, it also includes: when it is detected that the enable signal disappears and the exit instruction is not received, migrating from the operating state to the idle state to wait for the enable signal to appear.

[0021] By adopting this technical solution, when the enable signal is detected to have disappeared and no exit command has been received, the system can transition from the operating state to the idle state, awaiting the reappearance of the enable signal. This approach ensures that in abnormal situations (such as the unexpected loss of the enable signal without a clear exit), the system does not directly enter the end of operation, but instead returns to the idle state to wait, thereby improving system stability and security and avoiding unnecessary downtime or erroneous operations.

[0022] Optionally, the EtherCAT bus enters a running state, and when the time for the EtherCAT bus to enter the running state is greater than a time threshold, it migrates from the safe state to the idle state of the state machine isolation mechanism, including: detecting the status word of the EtherCAT bus to determine whether the master station device and each of the slave station devices have entered the running state; if so, determining whether the maintenance time of the running state is greater than the time threshold; if so, migrating from the safe state to the idle state.

[0023] By adopting the above technical solution, the operating state transition conditions of the EtherCAT bus can be accurately determined. Specific effects include: by detecting the status word of the EtherCAT bus, ensuring that the master device and each slave device are in the operating state, thereby improving the accuracy of system status judgment and avoiding misjudgment of the overall state due to a single device not being ready. Determining whether the operating state is maintained for longer than a time threshold further ensures that the system maintains the operating state for a sufficiently stable period of time, preventing unnecessary state transitions caused by brief state fluctuations. When the above conditions are met, the system migrates to the idle state, achieving an orderly transition of the state machine isolation mechanism, optimizing system resource allocation, and improving the reliability and safety of servo control.

[0024] Optionally, before the EtherCAT bus enters the running state, the method further includes: initializing the slave device parameters and starting the periodic frame message sending and receiving task.

[0025] By employing this technical solution, initializing slave device parameters and initiating periodic frame transmission and reception tasks ensures that the EtherCAT bus completes necessary preparations before entering the operational state. This measure improves system stability and reliability, avoiding anomalies caused by uninitialized parameters or inactive communication tasks, and thus provides a solid foundation for the subsequent transition from the safe state to the operational state.

[0026] In a second aspect, an embodiment of the present application discloses a servo control system based on an EtherCAT bus, which adopts the following scheme:

[0027] A servo control system based on an EtherCAT bus comprises: a startup module for receiving a startup instruction and executing a state machine isolation mechanism to enter a startup state; a startup state execution module for activating a communication thread between a master station device and a slave station device in the startup state, and migrating from the startup state to a safe state of the state machine isolation mechanism; a safe state execution module for enabling an EtherCAT bus to enter a running state in the safe state, and migrating from the safe state to an idle state of the state machine isolation mechanism when the time for the EtherCAT bus to enter the running state is greater than a time threshold; an idle state execution module for executing a safety pre-processing in the idle state. The processing operation is to turn off the enable and initialize the target position register to an invalid value, and when an enable signal is detected, it migrates from the idle state to the operating state of the state machine isolation mechanism; the operating state execution module is used to execute the position locking algorithm to lock the current position in the operating state, and detect whether the enable signal disappears. If so, and an exit instruction is received, the end operation is executed; wherein, the position locking algorithm is: obtain the current position as the initial position, when the target position instruction is not received, the initial position is used as the target position for position locking, and when the target position instruction is received, it runs to the target position corresponding to the target position instruction based on the initial position.

[0028] By adopting the above technical solution, the system receives startup commands through the startup module and executes the state machine isolation mechanism to enter the power-on state, ensuring a safe and reliable system initialization process. In the power-on state, the communication threads between the master and slave devices are activated and migrated to the safe state, thereby ensuring stable and secure communication. In the safe state, the EtherCAT bus enters the operating state and migrates to the idle state after the operating time exceeds the time threshold, effectively avoiding unnecessary resource usage. In the idle state, safety preprocessing operations are performed to disable the enable and initialize the target position register. The enable signal is also monitored to switch to the operational state, improving the system's responsiveness and safety. In the operational state, the current position is locked by executing the position lock algorithm, ensuring accurate position control. When no target position command is received, the current position is locked as the target position. When a target position command is received, the bus moves to the target position based on the current position, achieving flexible and precise position control.

[0029] Optionally, the operating state further includes: performing deviation detection on the target position based on a deviation threshold detection algorithm to determine whether to perform an emergency stop operation; wherein the deviation threshold detection algorithm is:

[0030] ;

[0031] Among them, in positioning mode is the maximum position deviation; is the rated position parameter;

[0032] In speed mode is the dynamic position tolerance, which is used to reflect the tolerance of instantaneous position deviation caused by speed fluctuation; is the maximum angular velocity; is the sampling period;

[0033] When the preset period is met , an emergency stop operation is performed.

[0034] By adopting the above technical solution, it is possible to detect deviations in the target position during operation, thereby effectively determining whether an emergency stop operation is required. Specifically, the deviation threshold detection algorithm can accurately evaluate the deviation between the current position and the target position by defining the maximum position deviation in positioning mode and the dynamic position tolerance in speed mode. In positioning mode, the algorithm uses the relationship between the maximum position deviation and the rated position parameters to ensure that the equipment operates within the permitted range; in speed mode, the dynamic position tolerance takes into account the tolerance for instantaneous position offsets caused by speed fluctuations, and combines the maximum angular velocity and sampling period to further improve the accuracy of detection. When the deviation condition is met for consecutive preset cycles, the system will perform an emergency stop operation, thereby effectively preventing safety hazards or equipment damage caused by excessive position deviations.

[0035] In a third aspect, an embodiment of the present application discloses an electronic device, which adopts the following solution:

[0036] An electronic device comprises: a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to implement the steps of any one of the methods described above when executing the computer program.

[0037] In a fourth aspect, an embodiment of the present application discloses a computer-readable storage medium, which adopts the following solution:

[0038] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of any one of the methods described above.

[0039] In summary, this application includes at least one of the following beneficial technical effects:

[0040] 1. The state machine isolation mechanism strictly manages each state in the servo control process, ensuring that invalid encoder feedback data will not be uploaded to the upper-level control program before the EtherCAT bus fully enters the operating state, effectively avoiding safety hazards caused by zero-position misjudgment;

[0041] 2. A position locking algorithm is introduced in the operating state, which can lock the current position as the target position when no target position command is received. This avoids the accumulation of unidirectional deviations caused by micron-level position jitter, PID adjustment delay, and sensor noise interference, thereby improving the stability and safety of the servo system.

[0042] 3. By detecting the EtherCAT bus status word and judging the time threshold, precise control of the bus status is achieved, ensuring that the system migrates from the safe state to the idle state at the appropriate time, further improving the system's reliability and response speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 This is a flow chart of a servo control method based on EtherCAT bus disclosed in one embodiment of the present application;

[0044] Figure 2 This is a flow chart of a servo control system based on the EtherCAT bus disclosed in another embodiment of the present application;

[0045] Figure 3 This is a schematic structural diagram of an electronic device disclosed in yet another embodiment of the present application. DETAILED DESCRIPTION

[0046] The present application is further described in detail below with reference to the accompanying drawings.

[0047] The following describes embodiments of the present application in more detail with reference to the accompanying drawings. Although the accompanying drawings illustrate embodiments of the present application, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. Rather, these embodiments are provided to make the present application more thorough and complete, and to fully convey the scope of the present application to those skilled in the art.

[0048] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0049] It should be understood that although the terms "first", "second", etc. may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of this application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0050] The technical solutions of the embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0051] [First embodiment]

[0052] See Figure 1 , is a servo control method based on EtherCAT bus disclosed in an embodiment of the present application, which specifically includes the following steps:

[0053] S10, receiving a startup instruction and executing a state machine isolation mechanism to enter a startup state;

[0054] Among them, the state machine isolation mechanism is used to isolate the four state stages of device operation - BOOT (boot state) → SAFE (safe state) → IDLE (idle state) → OPER (operation / working state) to improve the security and stability of system operation.

[0055] S20, in the power-on state, activating the communication thread between the master device and the slave device, and migrating from the power-on state to the safe state of the state machine isolation mechanism;

[0056] After entering the power-on state, an EtherCAT master object is created, slave PDO mapping is configured, and slave device parameters are initialized to activate the communication thread between the master and slave devices, achieving efficient communication initialization between the master and slaves. Afterwards, the system migrates to the safe state of the state machine isolation mechanism.

[0057] S30, in the safe state, the EtherCAT bus enters the running state, and when the time the EtherCAT bus enters the running state is greater than a time threshold, it migrates from the safe state to the idle state of the state machine isolation mechanism;

[0058] When the EtherCAT bus enters the OP state, or operational state, both the master and each slave device enter the operational state. If one of the slave devices does not enter the operational state, the corresponding EtherCAT bus does not enter the operational state. This prevents misjudgment of the overall state due to a single device not being ready. It is worth mentioning that when the EtherCAT bus does not enter the operational state, the PDO communication cycle is forcibly locked to avoid misjudgment caused by reading the default zero position.

[0059] In addition, when it is determined that the time for the EtherCAT bus to enter the running state is greater than the time threshold, it will migrate from the safe state to the idle state of the state machine isolation mechanism. This can ensure that the system maintains the running state within a sufficiently stable time and prevent unnecessary state migration due to short-term state fluctuations.

[0060] Specifically, step S30 includes:

[0061] S31, detecting the status word of the EtherCAT bus to determine whether the master device and each slave device have entered the running state;

[0062] Among them, in this step S31, the status word of the EtherCAT bus is continuously detected, which can ensure that when the EtherCAT bus is judged to be in the running state, the master station device and each slave station device enter the running state, thereby improving the accuracy of the system status judgment.

[0063] It is worth mentioning here that before detecting the status word of the EtherCAT bus in step S31, the system has initialized the slave device parameters and started the periodic frame message sending and receiving tasks to ensure that the EtherCAT bus completes the necessary preparations before entering the running state, thereby avoiding abnormal situations caused by uninitialized parameters or unstarted communication tasks, thereby providing a solid foundation for the subsequent migration from the safe state to the running state.

[0064] S32: If yes, determine whether the maintenance time of the running state is greater than the time threshold;

[0065] Among them, judging whether the maintenance time of the running state is greater than the time threshold can further ensure that the system maintains the running state within a sufficiently stable time and prevent unnecessary state migration caused by short-term state fluctuations.

[0066] S33. If yes, then migrate from the safe state to the idle state.

[0067] Among them, migrating to the idle state after the above conditions are met can achieve an orderly transition of the state machine isolation mechanism and improve the reliability and safety of servo control.

[0068] S40: In the idle state, perform a security pre-processing operation to turn off the enable and initialize the target location register to an invalid value, and when an enable signal is detected, migrate from the idle state to the operating state of the state machine isolation mechanism.

[0069] The safety pre-processing operation is implemented by disabling the enable and initializing the target position register to an invalid value, corresponding to an initialization parameter protection mechanism to prevent accidental position updates in the disabled state, enhance system security, and prevent malfunctions. It can be understood that when the enable signal is detected, that is, when the enable signal is first generated, the position lock algorithm will be executed in step S50.

[0070] S50, in the operating state, executing the position locking algorithm to lock the current position, and detecting whether the enable signal disappears, if so, and receiving the exit instruction, executing the end operation;

[0071] The enable signal is periodically detected. If the periodic detection E_enable=0? If it is 0, it will migrate to the idle state. In step S50, the execution of the position locking algorithm is involved, which can solve the problem of deviation accumulation in high-frequency control to avoid the deviation accumulation effect in high-frequency control.

[0072] Specifically, the position locking algorithm is: obtain the current position as the initial position, when the target position instruction is not received, the initial position is used as the target position for position locking, when the target position instruction is received, it runs to the target position corresponding to the target position instruction based on the initial position.

[0073] Before receiving the target position command, the motor is locked to its initial position, maintaining it. Upon receiving the command, the motor moves to the target position, maintaining the most current position at all times. This corresponds to normal operation, where the initial position is updated based on the command. In step S50, the position locking algorithm ensures the accuracy of the target position, improving the precision and stability of servo control. Furthermore, the termination operation is executed based on the enable signal and exit command, further ensuring the controllability and safety of the system.

[0074] Furthermore, in this operating state, before executing the end operation, the following steps are further included:

[0075] When it is detected that the enable signal disappears and no exit instruction is received, the operating state is transferred to the idle state to wait for the enable signal to appear.

[0076] Among them, based on the above method, it can be ensured that in abnormal circumstances (such as the enable signal is accidentally lost but not explicitly exited), the system will not directly enter the end operation, but return to the idle state to wait, thereby improving the stability and security of the system and avoiding unnecessary shutdown or erroneous operation.

[0077] Furthermore, in this operating state, it also includes:

[0078] S51, performing deviation detection on the target position based on a deviation threshold detection algorithm to determine whether to perform an emergency stop operation;

[0079] Here, step S51 can perform deviation detection on the target position based on a deviation threshold detection algorithm to accurately determine whether the position deviation of the servo system exceeds an allowable range.

[0080] Specifically, the deviation threshold detection algorithm is:

[0081] ;

[0082] Among them, in positioning mode is the maximum position deviation; The maximum position deviation is the rated position parameter. In this way, by using the relationship between the maximum position deviation and the rated position parameter, it is ensured that the device operates within the allowable range.

[0083] In speed mode is the dynamic position tolerance, which is used to reflect the tolerance of instantaneous position deviation caused by speed fluctuation; is the maximum angular velocity; The sampling period is the maximum angular velocity, and the detection accuracy is further improved by combining the tolerance of the instantaneous position offset caused by speed fluctuations with the sampling period.

[0084] Among them, when the continuous preset period meets When the position deviation exceeds the limit, an emergency stop is executed. The preset cycle is, for example, 3. If the limit is exceeded for three consecutive cycles, the system will execute an emergency stop, effectively preventing safety hazards or equipment damage caused by excessive position deviation. In this way, the deviation threshold detection algorithm can further improve the safety of servo control.

[0085] Furthermore, the operating state also includes:

[0086] S52, updating the target position based on the position update filtering algorithm;

[0087] Among them, step S52 can smooth the position change curve through the position update filtering algorithm, reduce the instantaneous position fluctuation caused by measurement error or external disturbance, and ensure that the servo control system can achieve more accurate target position tracking during dynamic operation.

[0088] Specifically, the position update filtering algorithm is:

[0089] ;

[0090] in, is the position feedback of the i-th cycle, N is the window length, is the position after filtering of the k-th period position.

[0091] Based on the above, the target position can be updated during operation using a position update filtering algorithm. This algorithm calculates the position feedback and window length of the i-th cycle to obtain the filtered position, effectively reducing noise interference in the position signal (eliminating high-frequency noise of the order of ±0.002mm), thereby improving the accuracy and stability of position control.

[0092] In summary, the first embodiment of the present invention discloses a servo control method based on the EtherCAT bus, which receives a startup instruction and executes a state machine isolation mechanism to enter the power-on state, ensuring that the system has good isolation during the startup phase and avoiding potential interference and anomalies. In the power-on state, the communication thread between the master station device and the slave station device is activated and migrated to the safe state, thereby achieving efficient communication initialization between the master station and the slave station, and improving the response speed and reliability of the system. In the safe state, by judging the operating state and time threshold of the EtherCAT bus, it migrates to the idle state, optimizes the state management process of the system, improves resource utilization and reduces energy consumption. In the idle state, a safety preprocessing operation is performed, the enable is turned off and the target position register is initialized to an invalid value, thereby enhancing the safety of the system and preventing the occurrence of misoperation. In the operating state, the current position is locked by the position locking algorithm, ensuring the accuracy of the target position and improving the precision and stability of the servo control. At the same time, the end operation is executed according to the enable signal and the exit instruction, further ensuring the controllability and safety of the system. In addition, by combining the deviation threshold detection algorithm and the position update filtering algorithm, a dual closed-loop protection mechanism for servo operation can be implemented, thereby improving the dynamic deviation suppression capability.

[0093] [Second embodiment]

[0094] See Figure 2 In the second embodiment of the present application, a servo control system based on the EtherCAT bus is disclosed, which includes: a startup module 210, a power-on state execution module 220, a safety state execution module 230, an idle state execution module 240 and an operating state execution module 250.

[0095] Among them, the startup module 210 is used to receive the startup instruction and execute the state machine isolation mechanism to enter the startup state; the startup state execution module 220 is used to activate the communication thread between the master station device and the slave station device in the startup state, and migrate from the startup state to the safe state of the state machine isolation mechanism; the safe state execution module 230 is used to, in the safe state, enable the EtherCAT bus to enter the running state, and when the time for the EtherCAT bus to enter the running state is greater than the time threshold, migrate from the safe state to the idle state of the state machine isolation mechanism; the idle state execution module 240 is used to execute a safety pre-processing operation in the idle state to turn off the enable And initialize the target position register to an invalid value, and when an enable signal is detected, migrate from the idle state to the operating state of the state machine isolation mechanism; the operating state execution module 250 is used to execute the position locking algorithm to lock the current position in the operating state, and detect whether the enable signal disappears. If so, and an exit instruction is received, the end operation is executed; wherein, the position locking algorithm is: obtain the current position as the initial position, when the target position instruction is not received, the initial position is used as the target position for position locking, and when the target position instruction is received, it runs to the target position corresponding to the target position instruction based on the initial position.

[0096] Furthermore, the operating state also includes:

[0097] Performing deviation detection on the target position based on a deviation threshold detection algorithm to determine whether to perform an emergency stop operation;

[0098] The deviation threshold detection algorithm is:

[0099] ;

[0100] Among them, in positioning mode is the maximum position deviation; is the rated position parameter;

[0101] In speed mode is the dynamic position tolerance, which is used to reflect the tolerance of instantaneous position deviation caused by speed fluctuation; is the maximum angular velocity; is the sampling period; when the continuous preset period meets , an emergency stop operation is performed.

[0102] It should be noted that the servo control method based on the EtherCAT bus implemented by the servo control system based on the EtherCAT bus disclosed in the second embodiment of this application is similar to the first embodiment, so it will not be described in detail here. Optionally, the various modules and the above-mentioned other operations or functions in this embodiment are respectively for implementing the methods in the aforementioned embodiments.

[0103] [Third embodiment]

[0104] See Figure 3 In the third embodiment of the present application, an electronic device is disclosed, which includes: a memory 310 and a processor 320, the memory 310 is used to store computer programs; the processor 320 is used to implement the steps of a servo control method based on EtherCAT bus described in the first embodiment when executing the computer program. For details, please refer to the above, so it will not be described in detail here.

[0105] The technical effect of the electronic device provided by this embodiment in actual application is the same as the technical effect of the servo control method based on the EtherCAT bus in the first embodiment.

[0106] [Fourth embodiment]

[0107] In the fourth embodiment of the present application, a computer-readable storage medium is disclosed. The computer-readable storage medium is, for example, a non-volatile memory, such as: magnetic media (such as hard disks, floppy disks, and magnetic tapes), optical media (such as CDROMs and DVDs), magneto-optical media (such as optical disks), and hardware devices specially constructed to store and execute computer-executable instructions (such as read-only memory (ROM), random access memory (RAM), flash memory, etc.). A computer program is stored on the computer-readable storage medium. The computer-readable storage medium can be used by one or more processors or processing devices to execute the computer program to implement a servo control method based on the EtherCAT bus in the aforementioned embodiment.

[0108] In addition, it can be understood that the aforementioned embodiments are merely exemplary descriptions of the present invention. Under the premise that the technical features do not conflict, the structures do not contradict, and the purpose of the present invention is not violated, the technical solutions of the various embodiments can be arbitrarily combined and used in combination.

[0109] In the several embodiments provided by the present invention, it should be understood that the disclosed methods, systems, and devices can be implemented in other ways. For example, the modules included in the system described above are merely schematic, and the division of modules is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0110] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0111] In addition, the functional units / modules in various embodiments of the present invention may be integrated into a single processing unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated into a single unit / module. The aforementioned integrated units / modules may be implemented in the form of hardware or hardware plus software functional units / modules.

[0112] The above-mentioned integrated unit / module implemented in the form of a software functional unit / module can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium and includes a number of instructions for causing one or more processors of a computer device (which can be a personal computer, server, or network device, etc.) to execute some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc., various media that can store program code.

[0113] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A servo control method based on EtherCAT bus, characterized in that: include: Receive the startup command and execute the state machine isolation mechanism to enter the startup state; In the power-on state, activating the communication thread between the master device and the slave device, and migrating from the power-on state to the safe state of the state machine isolation mechanism; In the safe state, the EtherCAT bus enters a running state, and when the time for the EtherCAT bus to enter the running state is greater than a time threshold, the EtherCAT bus migrates from the safe state to an idle state of the state machine isolation mechanism; In the idle state, performing a security pre-processing operation to disable the enable and initialize the target location register to an invalid value, and when an enable signal is detected, migrating from the idle state to the operating state of the state machine isolation mechanism; In the operating state, executing the position locking algorithm to lock the current position, and detecting whether the enable signal disappears, and if so, and receiving an exit instruction, executing the end operation; The position locking algorithm is as follows: obtaining the current position as the initial position, and when no target position instruction is received, taking the initial position as the target position for position locking, and when the target position instruction is received, moving to the target position corresponding to the target position instruction based on the initial position; The operating state also includes: Performing deviation detection on the target position based on a deviation threshold detection algorithm to determine whether to perform an emergency stop operation; The deviation threshold detection algorithm is: ; Among them, in positioning mode is the maximum position deviation; is the rated position parameter; In speed mode is the dynamic position tolerance, which is used to reflect the tolerance of instantaneous position deviation caused by speed fluctuation; is the maximum angular velocity; is the sampling period; When the preset period is met , an emergency stop operation is performed.

2. The method according to claim 1, characterized in that The operating state also includes: Updating the target position based on a position update filtering algorithm; The position update filtering algorithm is: ; in, is the position feedback of the i-th cycle, N is the window length, is the position after filtering of the k-th period position.

3. The method according to claim 1, characterized in that In the operating state, before the execution of the end operation, the method further includes: When it is detected that the enable signal disappears and the exit instruction is not received, the operating state is transferred to the idle state to wait for the enable signal to appear.

4. The method according to claim 1, wherein The EtherCAT bus enters a running state, and when the time for the EtherCAT bus to enter the running state is greater than a time threshold, the EtherCAT bus migrates from the safe state to the idle state of the state machine isolation mechanism, including: Detecting the status word of the EtherCAT bus to determine whether the master station device and each of the slave station devices have entered the running state; If so, determining whether the maintenance time of the running state is greater than the time threshold; If so, the system transitions from the secure state to the idle state.

5. The method according to claim 1, characterized in that In the safe state, before the EtherCAT bus enters the running state, the method further includes: Initialize the slave device parameters and start the periodic frame message sending and receiving task.

6. A servo control system based on EtherCAT bus, characterized in that: include: A startup module, configured to receive a startup instruction and execute a state machine isolation mechanism to enter a startup state; A power-on state execution module, configured to activate, in the power-on state, the communication thread between the master device and the slave device, and migrate from the power-on state to the safe state of the state machine isolation mechanism; a safe state execution module, configured to enable the EtherCAT bus to enter a running state in the safe state, and to migrate from the safe state to an idle state of the state machine isolation mechanism when the time for the EtherCAT bus to enter the running state is greater than a time threshold; an idle state execution module, configured to execute a security pre-processing operation in the idle state to disable the enable and initialize the target location register to an invalid value, and to migrate from the idle state to the operating state of the state machine isolation mechanism when an enable signal is detected; an operating state execution module, configured to execute a position locking algorithm to lock the current position in the operating state, and detect whether the enable signal disappears; if so, and an exit instruction is received, execute an end operation; The position locking algorithm is as follows: obtaining the current position as the initial position, and when no target position instruction is received, taking the initial position as the target position for position locking, and when the target position instruction is received, moving to the target position corresponding to the target position instruction based on the initial position; The operating state also includes: Performing deviation detection on the target position based on a deviation threshold detection algorithm to determine whether to perform an emergency stop operation; Wherein, the deviation threshold detection algorithm is: Wherein, the deviation threshold detection algorithm is: ; Among them, in positioning mode is the maximum position deviation; is the rated position parameter; In speed mode is the dynamic position tolerance, which is used to reflect the tolerance of instantaneous position deviation caused by speed fluctuation; is the maximum angular velocity; is the sampling period; When the preset period is met , an emergency stop operation is performed.

7. An electronic device, characterized in that: include: A memory and a processor, wherein the memory is used to store a computer program; The processor is configured to implement the steps of the method according to any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which implements the steps of the method according to any one of claims 1 to 5 when executed by a processor.

Citation Information

Patent Citations

  • Fast knife servo control system and control method based on EtherCAT bus technology

    CN117311272A