This project implements a real-time EtherCAT-based motor control system with position control capabilities. The system consists of a main control program written in C++ and a Python-based angle simulation tool. The implementation has undergone 12 hours of long-term stability testing
, ensuring reliable and consistent performance.
The system is composed of three main components:
- EtherCAT Master Controller (C++)
- TCP/IP Server for Position Updates
- Angle Simulator (Python)
- Real-time EtherCAT communication
- Position-based motor control
- Multi-threaded architecture for improved performance
- TCP/IP-based position updates
- Configurable motion parameters
- Position stability monitoring
- Error recovery mechanisms
- Linux operating system (tested on Ubuntu 20.04)
- SOEM (Simple Open EtherCAT Master) library
- Python 3.6+
- Root privileges for EtherCAT communication
- RT-Linux
- CPU isolation
- install eRob-SOEM-Linux
git clone https://github.com/ZeroErrControl/eRob_SOEM_linux.git
cd eRob_SOEM_linux
rm -r build
mkdir build
cd build
cmake ..
make
sudo make install
- Clone the repository:
git clone https://github.com/ZeroErrControl/eRob_eCoder.git
cd eRob_eCoder
gedit src/erob_ros/CMakeLists.txt
2.1 modify path
include_directories(/home/***/eRob_SOEM_linux/install/include/soem)
link_directories(/home/***/eRob_SOEM_linux/install/SOEM/lib)
- Build the C++ program:
- The program's network interface name must be modified according to your system configuration.
- The 'SOEM library path' in the CMakeLists.txt file needs to be updated to match your local installation path.
colcon build
- Run the main control program with root privileges:
sudo ./install/erob_position_subscriber/lib/erob_ros/erob_position_subscriber
- Start the angle simulator:
python3 src/erob_ros/src/eCoder_fake.py
- Launch the position subscriber:
sudo ./install/erob_position_subscriber/lib/erob_ros/erob_subscriber_CSP
- Start the angle simulator:
python3 src/erob_ros/src/eCoder_fake.py
Please note:
- The motion planning in CSP mode is implemented in a basic way
- Users are encouraged to implement their own motion planning algorithms
- This example code is not specifically optimized
- If you successfully optimize the code, you're welcome to submit your improvements
- Contributors may be eligible for reward coupons
- We welcome more participants to help optimize this project