Abstract
Autonomous Unmanned Aerial Vehicles (UAVs) require high precision and reliable logic to execute complex missions. While Large Language Models (LLMs) excel at code generation, they often lack the spatial reasoning necessary for error-free robotic control. This paper presents a "duo-LLM" closed-loop framework that bridges this gap. By converting raw numerical sensor data into human-readable "semantic observations," an LLM-based evaluator can identify logic errors in simulation and guide a generator to refine the flight code. The proposed system achieves an 85% success rate on complex aerial maneuvers, significantly outperforming traditional open-loop approaches.
Introduction
The deployment of LLMs in robotics faces a critical challenge: the "spatial common sense" gap. While models can generate syntactically correct Python code for drone operations, they frequently produce logic errors—such as reversing directions or miscalculating coordinates—that lead to mission failure or hardware damage in real-world settings. Existing solutions often rely on open-loop generation or provide feedback using raw numerical coordinates, which LLMs struggle to interpret effectively.
To address these issues, we propose a safe, reliable pipeline that verifies LLM-generated code in a high-fidelity physics simulator before deployment. The key innovation lies in translating numerical simulation states into semantic descriptions, allowing the LLM to reason within its native linguistic domain.
Methodology: The Closed-Loop Framework
The core of the proposed system is a Generation-Simulation-Evaluation (GSE) pipeline. This architecture utilizes two distinct LLM modules to ensure objectivity and minimize self-bias.
- Code Generator: This module receives a natural language task and generates control code using specialized UAV APIs.
- Simulation: The generated code is executed within AirSim, a high-fidelity physics simulator. This provides a safe "sandbox" to identify potential failures without risking physical hardware.
- State Transformation: A specialized algorithm converts raw numerical data (GPS, IMU) into Semantic Observations. For instance, a coordinate change is interpreted as: "Action 12: Fly 5 meters East... the drone moves to [0, 5, -11.5]."
- Evaluator: The Evaluator compares the semantic trajectory against the original task requirements. If deviations are found, it provides natural language feedback to the Generator for code refinement.
Experimental Evaluation
The framework was tested using OpenAI’s o3-mini model across a variety of tasks, ranging from simple geometric patterns to multi-stage inspections.
- Success Rate: The system achieved a 100% success rate on basic tasks and an 85% success rate on advanced missions (e.g., figure-8s and reverse-order square patterns). This is a substantial improvement over the 66.7% success rate observed in open-loop baselines.
- Completeness: Across all advanced tasks, the framework reached 98.5% completeness, ensuring that nearly all sub-actions were executed as intended.
- Efficiency: Solutions typically converged within 3 to 6 iterations, demonstrating an efficient balance between computational overhead and mission reliability.
Key Insights and Discussion
- Semantic vs. Numerical Feedback: LLMs perform significantly better when feedback is presented linguistically. Describing flight paths in words allows the model to leverage its pre-trained understanding of logic and spatial relationships.
- The Duo-LLM Advantage: Separating the Generator and Evaluator roles prevents "self-bias," where a single model might overlook its own logical inconsistencies.
- Sycophancy Constraints: The study noted that performance can decline after approximately six iterations. This is attributed to "sycophancy," where the model begins making unnecessary changes to satisfy the evaluator's negative feedback, even if the code is largely correct.
Limitations and Future Work
While effective, the current framework relies on cloud-based APIs, introducing latency that is unsuitable for real-time, reactive control (e.g., obstacle avoidance). Future research will focus on deploying smaller, more efficient models directly on-board the UAV and exploring interactive control mechanisms for dynamic environments.
Conclusion
By integrating semantic feedback into a closed-loop simulation pipeline, this research demonstrates a robust method for deploying LLMs in safety-critical robotic applications. The transition from numerical data to linguistic reasoning proves essential for bridging the gap between high-level intent and low-level execution in autonomous systems.
Summary updated