EtherCAT master station control method for robot operating system

By adding real-time patches and optimizing IOMMU in the Linux kernel, isolating the CPU core and locking the frequency, the real-time and stability problems of the EtherCAT master in the robot operating system are solved, and efficient EtherCAT master control is achieved, reducing hardware costs .

CN119071101APending Publication Date: 2024-12-03JUMANG INTELLIGENT TECHNOLOGY (SHANDONG) CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411228568.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-03
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

In the prior art, the real-time and stability of the EtherCAT master station are insufficient, resulting in time jitter and CPU load unevenness in the robot operating system, affecting the stability of control, and the hardware design of the existing solution is complex and costly.

Method used

By configuring the Linux kernel to provide a real-time running environment for the EtherCAT master, including adding real-time patches, optimizing IOMMU, adding hard real-time interrupts, isolating the CPU core, locking CPU frequency and priority, and isolating from the upper control program through shared memory and signals, avoiding Memory page switching and other program interference.

Benefits of technology

It improves the real-time response and cycle stability of the EtherCAT master program, reduces jitter during program operation, ensures the stability of control, and only uses Linux industrial control machines, without adding new hardware devices, reducing costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119071101A_ABST
    Figure CN119071101A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of Ethernet control. The invention provides an EtherCAT master station control method for a robot operating system. The method comprises the following steps: configuring a Linux kernel to provide a real-time operating environment of an EtherCAT master station; the configuration of the Linux industrial personal computer is optimized before a control program of the EtherCAT master station runs; and the EtherCAT master station executes interaction control with the MCCORE when the EtherCAT master station control program runs. According to the EtherCAT master station program, interface and data interaction operation is externally provided through a shared memory and signals, and the EtherCAT master station program is isolated from an upper-layer control program, so that the program runs more stably.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Ethernet control, and in particular to an EtherCAT master station control method for a robot operating system. Background Art

[0002] The statements in this section merely provide background art related to the present invention and do not necessarily constitute prior art.

[0003] EtherCAT (Ethernet Control Automation Technology) is an open architecture, Ethernet-based fieldbus system, commonly used in industrial control systems, machine tools, robotic arms, etc., and has high requirements on the real-time and stability of the EtherCAT master station.

[0004] In the existing technology, many use the socket raw socket provided by Linux for data transmission and reception. The data needs to go through a layer of conversion in the Linux kernel state and then control the network card to transmit and receive the raw data, which is relatively inefficient. In addition, due to the clock interrupt limit set by the Linux kernel, uneven CPU (Central Processing Unit) load, frequent switching between processes, switching of memory pages required by the program and other factors, it is impossible to guarantee the stable triggering of EtherCAT in each cycle, and there will be a certain time jitter, which will affect the stability of control. Some other solutions may use chips such as FPGA to implement the EtherCAT master station function, and then connect to the computer motherboard through the PCIE bus. This solution is relatively better in real time, but the hardware design is relatively more complicated and relatively more costly. Summary of the invention

[0005] In order to solve the deficiencies of the prior art, the present invention provides an EtherCAT master station control method for a robot operating system. The EtherCAT master station program provides interface and data interaction operations to the outside through shared memory and signals, and is isolated from the upper-level control program, so that the program runs more stably.

[0006] In order to achieve the above object, the present invention adopts the following technical solution:

[0007] In a first aspect, the present invention provides an EtherCAT master station control method for a robot operating system.

[0008] An EtherCAT master station control method for a robot operating system includes the following processes:

[0009] Configure the Linux kernel to provide the real-time operating environment of the EtherCAT master station;

[0010] Optimize the Linux industrial computer configuration before running the EtherCAT master control program;

[0011] When the EtherCAT master control program is running, it will interact with MC_CORE to perform control;

[0012] The configuration of the Linux industrial computer is optimized before the EtherCAT master station control program is run, including: isolating a CPU core for the EtherCAT master station control program to run, setting a memory page of a fixed size, and making the memory page resident in the memory, prohibiting switching, the EtherCAT master station control program runs on the memory page, locking the CPU frequency to the maximum frequency, modifying the EtherCAT master station control program scheduling strategy to FIFO, and adjusting the priority to the highest, and prohibiting other programs from calling the network card used by the EtherCAT master station control program.

[0013] As a further limitation of the first aspect of the present invention, configuring the Linux kernel to provide a real-time operating environment for the EtherCAT master station includes:

[0014] Apply the corresponding real-time patch according to the Linux kernel version;

[0015] Modify the Linux kernel and add real-time hardware interrupt IPI_RT_TICK;

[0016] Modify the relevant code of the IOMMU module in the Linux kernel to optimize device mounting;

[0017] Added a network card direct driver module to avoid Linux socket raw socket;

[0018] Compile the modified Linux kernel and output a new kernel Image image and modules module package.

[0019] As a further limitation of the first aspect of the present invention, the Linux kernel is modified to add a real-time hardware interrupt IPI_RT_TICK, including: IPI_RT_TICK is configured to be an evenly spaced timing beat, and RT_CORE performs related processing according to the beat.

[0020] As a further limitation of the first aspect of the present invention, when the EtherCAT master control program is running, it performs interactive control with MC_CORE, including:

[0021] The EtherCAT master control program starts;

[0022] The MC_CORE program registers the SIGIO callback function;

[0023] The MC_CORE program obtains the space where the shared memory is located;

[0024] The MC_CORE program controls the initialization of the EtherCAT master station through instructions, obtains the number of slave stations and corresponding information, and puts all slave stations into the pre-op state;

[0025] The MC_CORE program controls the EtherCAT master station to configure the slave station through instructions, reads and parses the XML configuration file, configures the slave station's cycle and PDO mapping, and puts all slave stations into safe-op state;

[0026] The MC_CORE program controls the EtherCAT master station to enter the running state through instructions and performs data exchange operations with the slave station devices.

[0027] As a further limitation of the first aspect of the present invention, the set memory page size is 1 GB.

[0028] As a further limitation of the first aspect of the present invention, the maximum operating frequency of the CPU of Nvidia Xavier NX is 1.9 GHz, and the locked CPU frequency is 1.9 GHz.

[0029] As a further limitation of the first aspect of the present invention, MC_CORE is a servo control program, the controlled slave station is the Buke motor, and after configuring the PDO, the test is performed through the speed control mode and the position control mode.

[0030] As a further limitation of the first aspect of the present invention, Nvidia Xavier NX has 6 CPU cores, and one of the CPU cores is isolated for use by the EtherCAT master station.

[0031] In a second aspect, the present invention provides an EtherCAT master station control system for a robot operating system.

[0032] An EtherCAT master station control system for a robot operating system, comprising:

[0033] Linux kernel configuration unit, used to configure the Linux kernel to provide a real-time operating environment for the EtherCAT master station;

[0034] Configuration optimization unit, used to optimize the Linux industrial computer configuration before the EtherCAT master control program runs;

[0035] Interactive control unit, used to perform interactive control with MC_CORE when the EtherCAT master control program is running;

[0036] The configuration of the Linux industrial computer is optimized before the EtherCAT master station control program is run, including: isolating a CPU core for the EtherCAT master station control program to run, setting a memory page of a fixed size, and making the memory page resident in the memory, prohibiting switching, the EtherCAT master station control program runs on the memory page, locking the CPU frequency to the maximum frequency, modifying the EtherCAT master station control program scheduling strategy to FIFO, and adjusting the priority to the highest, and prohibiting other programs from calling the network card used by the EtherCAT master station control program.

[0037] In a third aspect, the present invention provides a computer device, comprising: using the EtherCAT master station control method for a robot operating system described in the first aspect of the present invention to control an EtherCAT master station.

[0038] Compared with the prior art, the present invention has the following beneficial effects:

[0039] 1. The present invention innovatively proposes an EtherCAT master station control strategy for a robot operating system, adds a real-time patch to the kernel, optimizes the IOMMU, improves the real-time performance of the kernel, and thus improves the real-time performance of the EtherCAT master station program.

[0040] 2. The present invention innovatively proposes an EtherCAT master station control strategy for a robot operating system, adds hard real-time interrupts to the kernel, and performs periodic processing on the EtherCAT master station program, thereby ensuring the real-time response and periodic stability of the EtherCAT master station.

[0041] 3. The present invention innovatively proposes an EtherCAT master station control strategy for a robot operating system, which locks the CPU core operation so that it is not affected by other programs, locks the memory page so that the EtherCAT master station resident memory will not be affected by the jitter caused by memory page switching, locks the CPU to the highest frequency, modifies it to FIFO, and adjusts the priority to the highest, thereby ensuring the real-time response of the EtherCAT master station and reducing the jitter during program operation.

[0042] 4. The present invention innovatively proposes an EtherCAT master station control strategy for a robot operating system. The EtherCAT master station program provides interfaces and data interaction operations to the outside through shared memory and signals, and is isolated from the upper-level control program, making the program run more stably.

[0043] 5. The present invention innovatively proposes an EtherCAT master station control strategy for a robot operating system, which only uses a Linux industrial computer and does not add new hardware equipment, and has relatively good economic benefits.

[0044] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0046] Figure 1 An overall schematic diagram of the EtherCAT master station control method for a robot operating system provided by the present invention;

[0047] Figure 2 This is a flow chart of the interaction between MC_CORE and RT_CORE provided by the present invention. DETAILED DESCRIPTION

[0048] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0049] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.

[0050] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.

[0051] Embodiment 1:

[0052] This implementation proposes an EtherCAT master station control method for a robot operating system. The following is a brief introduction to the technical terms and related concepts involved in this processing solution, including:

[0053] IOMMU: (Input-Output Memory Management Unit) is a component in computer hardware that manages input and output (I / O) device access to main memory (memory);

[0054] RT_CORE: EtherCAT master control program;

[0055] MC_CORE: User-defined servo control and other programs;

[0056] NIC Driver: Network card driver.

[0057] The EtherCAT master station control method for a robot operating system is as follows: Figure 1 As shown, including the following:

[0058] S1: Modify the Linux kernel to provide the EtherCAT master real-time operating environment:

[0059] S11: Apply the corresponding real-time patch according to the Linux kernel version, such as Xenomai, preempt_rt, etc.

[0060] S12: Modify the Linux kernel and add real-time hardware interrupt IPI_RT_TICK;

[0061] S13: Modify the relevant codes of the IOMMU module in the Linux kernel and optimize the device mounting and other related operations;

[0062] S14: Add a network card direct driver module, without using Linux socket raw socket;

[0063] S15: Compile the modified Linux kernel and output a new kernel Image image and modules module package.

[0064] In a more specific technical solution, the test and verification are carried out on the industrial computer Nvidia Xavier NX. In the step S1, the linux4.9 kernel, the preempt_rt real-time patch patches-4.9.327-rt197.tar.gz and the Linux real-time operating system are used for real-time expansion.

[0065] More specifically, in step S12, IPI_RT_TICK may be configured as a 1 ms evenly spaced timing beat, and RT_CORE performs related processing according to the beat.

[0066] S2: EtherCAT master station control program related design:

[0067] S21: HW management, manages the hardware resources used by RT_CORE, initializes the shared memory resources used by RT_CORE, initializes the inter-core communication used by RT_CORE, initializes the network devices used by RT_CORE, provides inter-core communication API, and encapsulates and provides network packet sending and receiving API;

[0068] S22: SYNC synchronization, manage the synchronization between RT_CORE and other modules, synchronize MC_CORE, manage the cycle control process of RT_CORE, and do a good job of RT_CORE master-slave synchronization, etc.;

[0069] S23: ECAT_CORE status control, network configuration, master-slave synchronization, COE and other functions;

[0070] S24: ECAT_PACK provides EtherCAT data frame encapsulation and analysis interface, EtherCAT data frame packaging interface, EtherCAT all read and write service command interface, and message distribution under multi-cycle coexistence;

[0071] S24: ECAT_APPLECAT protocol control core, realizing EtherCAT network configuration, EtherCAT master status control, EtherCAT slave status control and switching, EtherCAT master-slave synchronization compensation, EtherCAT slave synchronization control, COE protocol and other functions.

[0072] S3: Optimize the Linux industrial computer configuration before running the EtherCAT master control program:

[0073] S31: Isolate a CPU core for the EtherCAT master station control program to run;

[0074] S32: Set a memory page of fixed size and make the memory page resident in the memory, prohibit switching, and the EtherCAT master station control program runs on the memory page;

[0075] S33: Lock the CPU frequency to the maximum frequency to prevent CPU frequency reduction from affecting program operation;

[0076] S34: The EtherCAT master control program scheduling strategy is changed to FIFO, and the priority is adjusted to the highest;

[0077] S35: The network card used by the EtherCAT master control program is prohibited from being called by other programs.

[0078] In this implementation, in step S31, specifically, Nvidia Xavier NX has 6 CPU cores, and the third CPU core is isolated for use by the EtherCAT master station.

[0079] In this implementation, in step S32, specifically, the memory page size is set to 1 GB.

[0080] In this implementation, in step S33, specifically, the maximum operating frequency of the CPU of Nvidia Xavier NX is 1.9 GHz, and the locked CPU frequency is 1.9 GHz.

[0081] In this implementation, MC_CORE is the servo control program, the controlled slave is the Buke motor, and after configuring PDO (PHPData Objects, an interface for connecting to a database in PHP), the test is performed in speed control mode and position control mode.

[0082] S4: The EtherCAT master control program interacts with MC_CORE during runtime, such as Figure 2 shown.

[0083] S41: EtherCAT master station control program starts;

[0084] S42: MC_CORE program registers SIGIO callback function;

[0085] S43: MC_CORE program obtains the shared memory space;

[0086] S44: MC_CORE program controls the initialization of the EtherCAT master through instructions, obtains the number of slaves and corresponding information, and makes all slaves enter the pre-op state;

[0087] S45: MC_CORE program controls the EtherCAT master station to configure the slave station through instructions, reads and parses the XML configuration file, configures the slave station cycle, PDO mapping, etc., so that all slave stations enter the safe-op state;

[0088] S46: The MC_CORE program controls the EtherCAT master station to enter the running state through instructions and performs data exchange operations with the slave station devices.

[0089] The present invention adds a real-time patch to the kernel and optimizes the IOMMU, thereby improving the real-time performance of the kernel and thus improving the real-time performance of the EtherCAT master station program; adds a hard real-time interrupt to the kernel, and the EtherCAT master station program performs periodic processing, thereby ensuring the real-time response and periodic stability of the EtherCAT master station; locks the CPU core operation so that it is not affected by other programs, locks the memory page so that the EtherCAT master station resident memory is not affected by the jitter generated by the memory page switching, locks the CPU to the highest frequency, modifies it to FIFO, and adjusts the priority to the highest, thereby ensuring the real-time response of the EtherCAT master station and reducing the jitter when the program is running; the EtherCAT master station program provides an interface and data interaction operation to the outside through a shared memory and a signal, and is isolated from an upper-layer control program, thereby making the program run more stably; only a Linux industrial computer is used, and no new hardware equipment is added, so the economic benefit is relatively good.

[0090] Embodiment 2:

[0091] This implementation provides an EtherCAT master station control system for a robot operating system, including:

[0092] Linux kernel configuration unit, used to configure the Linux kernel to provide a real-time operating environment for the EtherCAT master station;

[0093] Configuration optimization unit, used to optimize the Linux industrial computer configuration before the EtherCAT master control program runs;

[0094] Interactive control unit, used to perform interactive control with MC_CORE when the EtherCAT master control program is running;

[0095] The method for configuring the Linux kernel to provide a real-time operating environment for the EtherCAT master station includes:

[0096] Apply the corresponding version of real-time patch according to the Linux kernel version, such as Xenomai, preempt_rt, etc.; modify the Linux kernel and add the real-time hardware interrupt IPI_RT_TICK; modify the relevant code of the IOMMU module in the Linux kernel and optimize the device mounting and other related operations; add the network card direct driver module without using the Linux socket raw socket; compile the modified Linux kernel and output the new kernel Image image and modules module package.

[0097] The configuration of the Linux industrial computer is optimized before the EtherCAT master station control program is run, including: isolating a CPU core for the EtherCAT master station control program to run, setting a memory page of a fixed size, and making the memory page resident in the memory, prohibiting switching, the EtherCAT master station control program runs on the memory page, locking the CPU frequency to the maximum frequency, modifying the EtherCAT master station control program scheduling strategy to FIFO, and adjusting the priority to the highest, and prohibiting other programs from calling the network card used by the EtherCAT master station control program.

[0098] When the EtherCAT master control program is running, it performs interactive control with MC_CORE, including:

[0099] The EtherCAT master control program starts; the MC_CORE program registers the SIGIO callback function; the MC_CORE program obtains the space where the shared memory is located; the MC_CORE program controls the initialization of the EtherCAT master through instructions, obtains the number of slaves and the corresponding information, and makes all slaves enter the pre-op state; the MC_CORE program controls the EtherCAT master through instructions to configure the slaves, reads and parses the XML configuration file, configures the slave cycle, PDO mapping, etc., so that all slaves enter the safe-op state. The MC_CORE program controls the EtherCAT master through instructions to enter the running state and perform data interaction operations with the slave devices.

[0100] In this implementation, the EtherCAT master station control program related design includes:

[0101] HW management, manage the hardware resources used by RT_CORE, initialize the shared memory resources used by RT_CORE, initialize the inter-core communication used by RT_CORE, initialize the network devices used by RT_CORE, provide inter-core communication API, and encapsulate and provide network packet sending and receiving API;

[0102] SYNC synchronization, manage the synchronization between RT_CORE and other modules. Synchronize MC_CORE, manage the cycle control process of RT_CORE, and do a good job of master-slave synchronization of RT_CORE, etc.

[0103] ECAT_CORE status control, network configuration, master-slave synchronization, COE and other functions are realized;

[0104] ECAT_PACK provides EtherCAT data frame encapsulation and analysis interface, EtherCAT data frame packaging interface, EtherCAT all read and write service command interface, and message distribution under multi-cycle coexistence;

[0105] ECAT_APPLECAT protocol control core realizes EtherCAT network configuration, EtherCAT master status control, EtherCAT slave status control and switching, EtherCAT master-slave synchronization compensation, EtherCAT slave synchronization control, COE protocol and other functions.

[0106] Embodiment 3:

[0107] This implementation provides a computer device, including: using the EtherCAT master station control method for a robot operating system described in Example 1 of the present invention to control an EtherCAT master station.

[0108] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. An EtherCAT master station control method for a robot operating system, characterized in that: The process includes: Configure the Linux kernel to provide the real-time operating environment of the EtherCAT master station; Optimize the Linux industrial computer configuration before running the EtherCAT master control program; When the EtherCAT master control program is running, it will interact with MC_CORE to perform control; The configuration of the Linux industrial computer is optimized before the EtherCAT master station control program is run, including: isolating a CPU core for the EtherCAT master station control program to run, setting a memory page of a fixed size, and making the memory page resident in the memory, prohibiting switching, the EtherCAT master station control program runs on the memory page, locking the CPU frequency to the maximum frequency, modifying the EtherCAT master station control program scheduling strategy to FIFO, and adjusting the priority to the highest, and prohibiting other programs from calling the network card used by the EtherCAT master station control program.

2. The EtherCAT master station control method for a robot operating system according to claim 1, characterized in that: The configuration of the Linux kernel to provide a real-time operating environment for the EtherCAT master station includes: Apply the corresponding real-time patch according to the Linux kernel version; Modify the Linux kernel and add real-time hardware interrupt IPI_RT_TICK; Modify the relevant code of the IOMMU module in the Linux kernel to optimize device mounting; Added a network card direct driver module to avoid Linux socket raw socket; Compile the modified Linux kernel and output a new kernel Image image and modules module package.

3. The EtherCAT master station control method for a robot operating system according to claim 2, characterized in that: Modify the Linux kernel and add the real-time hardware interrupt IPI_RT_TICK, including: IPI_RT_TICK is configured as an evenly spaced timing beat, and RT_CORE performs related processing according to the beat.

4. The EtherCAT master station control method for a robot operating system according to claim 1, characterized in that: When the EtherCAT master control program is running, it performs interactive control with MC_CORE, including: The EtherCAT master control program starts; The MC_CORE program registers the SIGIO callback function; The MC_CORE program obtains the space where the shared memory is located; The MC_CORE program controls the initialization of the EtherCAT master station through instructions, obtains the number of slave stations and corresponding information, and puts all slave stations into the pre-op state; The MC_CORE program controls the EtherCAT master station to configure the slave station through instructions, reads and parses the XML configuration file, configures the slave station's cycle and PDO mapping, and puts all slave stations into safe-op state; The MC_CORE program controls the EtherCAT master station to enter the running state through instructions and performs data exchange operations with the slave station devices.

5. The EtherCAT master station control method for a robot operating system according to claim 1, characterized in that: The memory page size is set to 1GB.

6. The EtherCAT master station control method for a robot operating system according to claim 1, characterized in that: The Nvidia Xavier NX's CPU has a maximum operating frequency of 1.9GHz and a locked CPU frequency of 1.9GHz.

7. The EtherCAT master station control method for a robot operating system according to claim 1, characterized in that: MC_CORE is a servo control program. The controlled slave is the Buke motor. After configuring PDO, it is tested in speed control mode and position control mode.

8. The EtherCAT master station control method for a robot operating system according to claim 1, characterized in that: Nvidia Xavier NX has 6 CPU cores, one of which is isolated for use by the EtherCAT master.

9. An EtherCAT master station control system for a robot operating system, characterized in that: include: Linux kernel configuration unit, used to configure the Linux kernel to provide a real-time operating environment for the EtherCAT master station; Configuration optimization unit, used to optimize the Linux industrial computer configuration before the EtherCAT master control program runs; Interactive control unit, used to perform interactive control with MC_CORE when the EtherCAT master control program is running; The configuration of the Linux industrial computer is optimized before the EtherCAT master station control program is run, including: isolating a CPU core for the EtherCAT master station control program to run, setting a memory page of a fixed size, and making the memory page resident in the memory, prohibiting switching, the EtherCAT master station control program runs on the memory page, locking the CPU frequency to the maximum frequency, modifying the EtherCAT master station control program scheduling strategy to FIFO, and adjusting the priority to the highest, and prohibiting other programs from calling the network card used by the EtherCAT master station control program.

10. A computer device, characterized in that: include: The EtherCAT master station control method for a robot operating system according to any one of claims 1 to 8 is adopted to perform EtherCAT master station control.

Citation Information

Cited By

  • Kernel space data transceiving method and device, storage medium and program product

    CN120104368A