Projects / AI Drone
I Gave an LLM Control of a Real Drone
Spoken orders, planned by a language model, checked by a safety layer in code, and flown on a real PX4 quadcopter. The transmitter always wins.
Status: flown PX4 · MAVSDK · Claude · Whisper 14 Oct 2026
What I built
A quadcopter you talk to. “Hawk, take off.” “Go forward three metres.” “What do you see?” “Land.” Speech goes into a local Whisper model, a language model turns the sentence into a plan, and a validator written in plain Python decides whether each step is allowed before anything reaches the flight controller. The aircraft is a Holybro X500 V2 on a Pixhawk 6C, flying PX4, with a DJI Osmo Action 4 as its eyes.
I built it to find out what it actually takes to let a model act on the physical world without trusting it. The answer so far: the model is the easy part. Everything that matters is in the layer between the model and the motors.
How it works
- Speech in. The microphone feeds Whisper running on the Mac’s GPU, about a tenth of a second per phrase. A small grammar catches the common orders (take off, move, land, stop, status) and flies them at once. Anything the grammar cannot parse goes to Claude with a strict set of tools: status, takeoff, move, yaw, creep, look, hold, land, return home. The model never produces MAVLink. It can only ask for one of those.
- The validator. Every tool call passes through an executor that enforces hard limits in code: 5 m per move, 10 m ceiling, 20 m radius from home, a floor for horizontal moves, a minimum interval between motion commands. Motion is refused unless the aircraft is airborne with a valid position and fresh telemetry. Takeoff runs only if the pilot’s own words contained “take off”, “launch” or “lift off”. None of this lives in the prompt.
- Flight. Approved steps become MAVSDK calls over the telemetry radio: a takeoff command, a reposition in Hold mode, a Land. Nothing streams. If the laptop process dies the aircraft simply holds, and every PX4 failsafe stays in force.
- The pilot always wins. The executor watches the flight mode continuously. Any mode it did not command, Land, Return, Position, means a human has taken the sticks: every routine stops, nothing further is sent, and even a spoken “stop” is refused until the mode switch gives control back.
- Eyes. A separate process owns the camera, runs a small YOLO detector on every frame, and serves frames over localhost. “What do you see” sends one frame with the question. With a flag, two consecutive sightings of a person put an airborne aircraft into Hold with no model involved. Vision never starts a manoeuvre.
- Voice out. Hawk, a dry British flight engineer, reads back every manoeuvre from code and adds one line of its own. The read-back comes from the tool arguments, so you always hear direction and distance exactly once.
Lessons
- The first explanation that fits is not the explanation. On the first real session the aircraft climbed hard a metre from the ground and I hit kill. I blamed the battery failsafe. The flight log showed my own altitude top-up loop re-sending a Hold and a reposition after I had already selected Land. The fix was the override latch above, verified in the simulator by selecting Land mid-takeoff and mid-move.
- GPS near buildings lies with a straight face. Thirty satellites, a claimed vertical accuracy of 0.3 m, and an altitude that slid four metres in ten seconds. The barometer was honest throughout. Height reference is now the barometer.
- The radio is part of the control loop. A 915 MHz telemetry link in a city whose cellular network sits at 900 MHz drops acknowledgements. Commands are now judged by what the aircraft does, not by whether the ACK came back, and the link runs with error correction on.
- Latency is a design problem, not a model problem. Grammar-matched orders fly immediately; the model is asked in parallel only for a remark that plays while the aircraft is already moving.
Next flight
Fly it again with the barometer height reference and the battery failsafe set to Land, on open ground, with the kill switch in hand. Then the camera goes on the airframe, and the next question is whether vision can be allowed to steer anything at all.
Hardware
| Part | Role | Link |
|---|---|---|
| Holybro X500 V2 | Frame | [link] |
| Pixhawk 6C | Flight controller | [link] |
| M10 GPS | Positioning | [link] |
| SiK telemetry | Ground link | [link] |
| 4S LiPo battery | Power | [link] |
| RadioLink AT9S Pro | Transmitter | [link] |
| DJI Osmo Action 4 | Camera | [link] |
- 0.1s Takeoff command Hawk
- 6.4s Takeoff → Hold, levelled at ~1.8 m PX4
- 13.2s Mode switch → LAND RC
- 21.3s Set mode → HOLD Hawk
- 21.6s Reposition to the 2 m target Hawk
- 22.7s KILL RC
From the flight controller’s ulog. Source 245 is Hawk, the AI pilot. RC is the transmitter.
Build it yourself
Guide
Setup guide
From unboxing to first autonomous flight.
Code
GitHub repo
Planner, validator and MAVSDK bridge.
Download
Camera mount STL
Print-ready file for the X500.
List
Parts list
Every component, with where to buy it.
What I'm building next
Next build
Giving the drone vision
Get it in your inbox the day it drops.