MCCoder: Streamlining Motion Control with LLM-Assisted Code Generation and Rigorous Verification

📅 2024-10-19
🏛️ arXiv.org
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
To address low programming efficiency and safety concerns in motion control debugging for factory automation, this paper introduces the first large language model (LLM)-driven code generation system specifically designed for motion control. Methodologically, it innovatively integrates multi-task decomposition, hybrid retrieval-augmented generation (RAG), and an iterative self-correction paradigm. We construct MCEVAL, a domain-specific benchmark for motion control code evaluation, and incorporate 3D physics-based simulation validation alongside full-trajectory logging and replay mechanisms to ensure functional safety and correctness. The system is compatible with both soft motion controllers and industrial-grade motion function libraries—overcoming the limitation of existing AI-assisted programming tools, which predominantly target PLCs while neglecting high-level languages and vendor-agnostic motion APIs. On our proprietary MCEVAL dataset, the system achieves a 33.09% overall performance gain and a 131.77% improvement on complex tasks, significantly outperforming state-of-the-art RAG baselines.

Technology Category

Application Category

📝 Abstract
Large Language Models (LLMs) have demonstrated significant potential in code generation. However, in the factory automation sector, particularly motion control, manual programming, alongside inefficient and unsafe debugging practices, remains prevalent. This stems from the complex interplay of mechanical and electrical systems and stringent safety requirements. Moreover, most current AI-assisted motion control programming efforts focus on PLCs, with little attention given to high-level languages and function libraries. To address these challenges, we introduce MCCoder, an LLM-powered system tailored for generating motion control code, integrated with a soft-motion controller. MCCoder improves code generation through a structured workflow that combines multitask decomposition, hybrid retrieval-augmented generation (RAG), and iterative self-correction, utilizing a well-established motion library. Additionally, it integrates a 3D simulator for intuitive motion validation and logs of full motion trajectories for data verification, significantly enhancing accuracy and safety. In the absence of benchmark datasets and metrics tailored for evaluating motion control code generation, we propose MCEVAL, a dataset spanning motion tasks of varying complexity. Experiments show that MCCoder outperforms baseline models using Advanced RAG, achieving an overall performance gain of 33.09% and a 131.77% improvement on complex tasks in the MCEVAL dataset.
Problem

Research questions and friction points this paper is trying to address.

Automates motion control code generation using LLMs
Enhances safety and accuracy with 3D simulation and verification
Introduces MCEVAL dataset for evaluating motion control code
Innovation

Methods, ideas, or system contributions that make the work stand out.

LLM-powered motion control code generation
Hybrid retrieval-augmented generation workflow
3D simulator for motion validation
Y
Yin Li
The Hong Kong University of Science and Technology (Guangzhou), Guangzhou, China
Liangwei Wang
Liangwei Wang
HKUST(GZ)
Information VisualizationHuman-Computer Interaction
S
Shiyuan Piao
The Hong Kong University of Science and Technology (Guangzhou), Guangzhou, China
B
Boo-Ho Yang
Ziyue Li
Ziyue Li
CS PhD, University of Maryland
Machine learning
W
Wei Zeng
The Hong Kong University of Science and Technology (Guangzhou), Guangzhou, China
F
Fugee Tsung
The Hong Kong University of Science and Technology (Guangzhou), Guangzhou, China; Department of Industrial Engineering and Decision Analytics, The Hong Kong University of Science and Technology