Automating Flexible Manufacturing: A Generative AI Approach for Code Generation and Validation for Robotics - Zhichao, Zhou (My University, 2026)
Flexible manufacturing demands that industrial robots be reprogrammed whenever product variants change. Writing executable code in specific robot languages is unreliable, and verifying such code against physical constraints still depends on slow manual simulation by domain experts. Automating both steps is therefore a prerequisite for wider robotic deployment. This thesis presents an agentic system that generates, validates, and iteratively corrects ABB RAPID code from natural language task descriptions. A dual stream Retrieval Augmented Generation (RAG) pipeline, combined with Hypothetical Document Embeddings (HyDE), grounds generation in verified technical documentation and production code templates. This grounding removes most of the domain specific hallucinations observed in ungrounded large language models. Four cooperating roles run the workflow and catch semantic defects that rule based static analysis often misses. At the heart of the system sits a custom Model Context Protocol (MCP) server that plugs the AI agent directly into ABB RobotStudio. Code uploads, simulation runs, and diagnostic feedback all flow through this channel, with no manual step in between. Inside the loop the agent catches physical constraint violations—wrist singularities, joint limit exceedances, arc geometry errors, suction release failures—that would pass through both static checks and semantic review. Over seven experiments of rising complexity, the simulation feedback loop cut correction rounds from six on the first task to first-attempt success by the fifth, since fixes learned earlier carried over to new tasks. Across three compared configurations, retrieval grounding alone lifts the content pass rate from 20% to near-complete; adding the MCP simulation loop on top catches a further family of physically grounded errors that would otherwise go unnoticed before deployment. Such a pipeline suits industrial settings that call for quick reconfiguration and little expert time in the loop.
Keywords: Retrieval Augmented Generation; Agentic AI; RAPID; Robotics; Model Context Protocol; Code Generation; Flexible Manufacturing