Session: 02-05-01: Artificial Intelligence and Data-Driven Design 2
Paper Number: 198777
An AI-in-the-Loop Design Methodology for Legged Robot Controllers: Simulation Verification Before Hardware Deployment
Designing the software that controls a robot has long required deep expertise in kinematics, programming, and hardware integration. Large language models can now write working code from plain-language requests, which raises a practical question for engineering design: can a person use an AI assistant to build a controller for a physical machine, and how should the AI's output be checked before it runs on real hardware, where errors can damage equipment?
Legged robots make a demanding test case. A six-legged (hexapod) robot must coordinate eighteen joints so that its feet lift, swing, and land in a stable sequence. The wave gait, in which one leg swings while the other five remain planted, offers the largest static stability margin among the common gaits and is preferred for a robot that must eventually climb inclined surfaces. Commercial hexapod kits, however, typically ship with only a tripod gait, which lifts three legs at once and is unsuited to climbing. A controller error in a legged robot is not abstract: it appears as feet dragging on the ground, limbs moving through the body, or the robot falling over.
This study addresses the general problem of how to structure a design methodology in which an AI assistant generates control code and a human engineer verifies it, using a concrete task: building a wave gait controller from scratch for a low-cost, 18-servo hexapod whose purchased firmware lacked this motion. The workflow has three stages. First, the engineer describes the desired behavior in conversation with the AI assistant, which produces Python simulation code including forward and inverse kinematics for legs with a two-segment tibia joined at a fixed −30° angle. Second, the engineer runs the 3D simulation and visually inspects the motion and logged foot trajectories, checking that stance feet maintain ground contact, swing feet lift cleanly, and that no limb detaches from the body or moves in physically impossible ways. The code is revised through additional AI iterations until the simulated motion passes inspection. Third, the verified code is deployed to the physical robot, a cyber-physical system in which a Raspberry Pi commands the servos, with a per-servo calibration step that maps simulated joint angles to measured pulse widths, including automatic detection of reversed servos.
Here, we show that this workflow produced a working wave gait whose hardware motion synchronizes with the simulation, and that simulation inspection identified errors introduced by the AI assistant. The clearest example: the AI initially modeled the effective tibia length using a wrong interior angle in the law-of-cosines calculation, a mistake invisible in the code itself but obvious in simulation, where four of six feet dragged along the ground. Human inspection of simulated motion, rather than code inspection, was the step that caught it.
This adds to the current understanding of AI-assisted engineering in a specific way: most reported uses of AI code generation stop at software, where a failed test is the worst outcome. Our results show that inserting a simulation checkpoint between generation and deployment enables the same approach to extend safely to physical systems, and the geometric fidelity of the simulation, not dynamic modeling, determines whether the gait transfers to hardware.
More broadly, the workflow offers a template for engineers and students who need custom robot behaviors but lack the resources of a robotics lab: state the requirement in plain language, verify the AI's output in simulation against physical common sense, calibrate the model-to-actuator mapping, and only then let the code move a machine. The human verification step makes AI-generated code safe for systems operating in the physical world, keeping the designer in control of the machine's behavior.
Presenting Author: Meng-Lun Lee Oregon Institute of Technology
Presenting Author Biography: Dr. Meng-Lun Lee is an Assistant Professor in the Manufacturing and Mechanical Engineering Technology Department at Oregon Institute of Technology. His teaching and research focus on robotics, control systems, automation, and hands-on engineering education.
Authors:
Meng-Lun Lee Oregon Institute of TechnologyAn AI-in-the-Loop Design Methodology for Legged Robot Controllers: Simulation Verification Before Hardware Deployment
Paper Type
Technical Presentation