Design of a Vision Sorting System Based on AM5728 EtherCAT Technology
As Industry 4.0 advances, the concepts of intelligent manufacturing and smart factories are emerging, and industrial manufacturing is moving towards automation and intelligence. In this development process, the internet, robotics, image processing, and machine learning are being widely applied in industrial production and manufacturing. On the other hand, cameras are like the eyes of robots, and image processing algorithms are the visual perception areas in the brain. The integration of image processing with motion controllers is an inevitable trend in current industrial intelligent development. Therefore, this project uses an open motion controller as the master for image processing, interacting with actuators via real-time Ethernet EtherCAT, thereby improving the accuracy of actuator gripping. Regarding controllers, traditional dedicated robot controllers are highly specialized with closed interfaces, making it difficult for users to directly perform secondary development. They require specialized technical support, leading to high development costs and difficult debugging. Open motion controllers offer advantages such as modularity and strong scalability, providing rich and user-friendly interfaces.
This paper, by participating in real-time system construction, the R&D and application of controller communication masters, and vision sorting projects for automated production lines, applies machine vision processing to robot controllers without affecting motion control tasks, thereby saving hardware costs and improving system integration. This paper utilizes an RTOS that supports ARM chips from various manufacturers and is compatible with application programming interfaces of other real-time operating systems, though optimization and customization are required based on the specific chip. This paper implements a Linux real-time operating system solution on TI's AM5728 chip. Tests show that the average task scheduling jitter time of this solution can reach 5μs in user space and 4μs in kernel space, with a kernel timer task response delay of only 2μs, demonstrating performance comparable to commercial real-time operating systems. This paper adopts the open-source IgH EtherCAT Master solution, successfully building an EtherCAT master, which includes porting the master to AM5728 and customizing the network card driver. Tests show that this EtherCAT master can achieve a minimum communication task cycle of 120μs, and the slave's synchronized clock can reach a synchronization accuracy of 1μs. The results are excellent and can meet the requirements of most motion control applications. This paper implements pipeline workpiece sorting functionality on an EtherCAT-based master. To segment workpieces from the background, captured images are subjected to mean filtering and then converted to the HSL color space, which is closer to human perception. Workpieces are then segmented from the background using color and brightness information. Furthermore, this paper proposes an improved recursive connected component labeling method. This algorithm completes clustering by scanning the image only once, avoiding system overhead and time waste caused by recursive function calls. The clustering process removes interference and simultaneously determines the workpiece's centroid and bounding rectangle. Based on the workpiece's shape and color information, the segmented workpieces are automatically classified, achieving good results. The principal axis direction of the workpiece is determined using the second-order central moment of the image, which is used for adjusting the posture during gripping. The actual position of the workpiece in the robot coordinate system is obtained and sent to the actuators via the EtherCAT bus to complete the gripping task. Finally, this paper built an experimental platform and developed a simple human-machine interaction interface using Qt to verify the real-time performance.
