← Latest papers
🤖 AI

Retrieval-grounded robot program generation and simulation-based correction via Model Context Protocol

This paper presents a language-model-based workflow that utilizes dual-stream retrieval-augmented generation and a custom Model Context Protocol server to automatically generate, simulate, and iteratively correct ABB RAPID robot programs from natural language descriptions, thereby reducing domain-specific errors through executable feedback from industrial simulation software.

Original authors: Zhichao Zhou, Siyuan Chen, Omkar Salunkhe, Ebru Turanoglu Bekar, Johan Stahre, Anders Skoogh

Published 2026-08-25
📖 6 min read🧠 Deep dive

Original authors: Zhichao Zhou, Siyuan Chen, Omkar Salunkhe, Ebru Turanoglu Bekar, Johan Stahre, Anders Skoogh

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

In the world of modern manufacturing, flexibility is the ultimate goal. Factories no longer just churn out millions of identical items; they must adapt quickly to produce different versions of products, from a car with a sunroof to one without, or a package of a slightly different size. To keep up with these changes, industrial robots need to be reprogrammed constantly. Traditionally, this has been a slow, difficult job reserved for specialists who speak a complex, machine-specific language. They must manually write code, check it against the physical layout of the factory floor, and test it to ensure the robot won't crash or drop a part. While artificial intelligence has recently shown promise in translating human ideas into computer code, these smart systems often struggle with the specific, rigid rules of industrial machinery. They might write code that looks correct on a screen but fails the moment a real robot tries to move, simply because the AI cannot "see" the physical constraints of the factory cell or the specific behavior of the robot's tools.

A team of researchers at Chalmers University of Technology in Sweden has developed a new way to bridge this gap, creating a system that allows robots to be reprogrammed using plain English while automatically checking if the instructions will actually work. Their approach combines a powerful language model with a specialized simulation environment, creating a loop where the computer writes the code, tests it in a virtual factory, and then fixes its own mistakes based on the results. The researchers focused on ABB robots, which are common in factories worldwide, and used a digital twin—a perfect virtual copy of the robot and its workspace—to act as a safety net. Instead of just generating text, the system connects directly to the simulation software, uploading the code, watching the robot move, and analyzing exactly why a task failed if it does.

The core of their method involves two distinct steps working together. First, the system uses a technique called retrieval-augmented generation. Imagine a student taking an exam who is allowed to look at a textbook and a set of solved examples before answering. The computer does something similar: when a human asks it to "pick up a box and place it on a pallet," the system first searches a database of official technical manuals and real-world code examples from a major vehicle manufacturer. This ensures the computer uses the correct, specific commands for the robot, rather than guessing or inventing rules that don't exist. This step significantly reduces the number of basic errors, such as using the wrong type of data or misspelling a command, which are common when AI tries to write code from scratch.

However, the researchers realized that even code that is grammatically perfect and follows all the rules can still fail in the real world. A robot might successfully pick up a box, but if the box is taller than expected, the robot's gripper might not release it properly, or the robot might get stuck in a position it cannot physically reach. To solve this, the team built a custom connection between the language model and the simulation software. This connection acts like a remote control, allowing the computer to upload the generated code to the virtual robot, run the simulation, and then read back a detailed report of what happened. The system checks not just the code itself, but the robot's behavior: Did the part drop? Did the robot arm hit a wall? Did the sensors detect the object?

In their tests, the researchers put this system through a series of challenges. They asked it to handle tasks like moving boxes of different sizes and building pyramids of blocks. In one specific case, the system was asked to move a tall green box and a shorter orange box. The initial code, generated by the AI, worked perfectly for the short orange box. However, when the same code was applied to the tall green box, the robot failed to release the part because the release point was too low, causing the gripper to remain stuck inside the box. A standard computer check of the code would have missed this entirely, as the instructions were syntactically correct. But because the system ran the simulation, it saw the gripper fail to let go. It then used this feedback to automatically adjust the height of the release point and tried again, successfully solving the problem.

The results showed that this feedback loop was essential. While the initial step of looking up technical manuals reduced many basic mistakes, it was the ability to run the code in the virtual factory that caught the subtle, physical errors that would have caused real-world failures. The system successfully identified issues like unreachable targets and awkward robot movements that only appear when the robot actually tries to perform the task. In one instance, the robot's arm got stuck in a difficult position after a few moves, a problem that only became visible after the simulation ran for a while. The system detected this, reset the robot's position to a safer starting point, and completed the task.

The researchers emphasize that this system does not replace human engineers entirely. The virtual factory, the tools, and the specific tasks still need to be set up by people beforehand. The system also does not design the factory layout or the robot's physical hardware. Instead, it acts as a highly skilled assistant that takes a human's idea and rapidly turns it into a working program, catching errors that would otherwise require hours of manual debugging. The study suggests that by connecting the generation of code directly to the execution of tasks in a simulated environment, factories can reprogram their robots much faster and with fewer mistakes. This approach offers a practical path toward making flexible manufacturing more accessible, allowing production lines to adapt to new products without the long delays and high costs of traditional programming. The work demonstrates that the future of robot programming lies not just in smarter AI, but in AI that can see, test, and learn from its own actions in a virtual world before touching a real one.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →