01Personal projectSept 2026 – now
Precision landing
A flight stack and simulator that land a multirotor on an AprilTag pad
10.1 cm from pad centre in the demo run
Camera poses 40 ms late, wind 0.7 m/s with gusts. It starts 4.0 m up and 2.2 m off the pad, and lands 10.1 cm from the pad centre.
- Altitude
- 4.00 m
- Est. offset
- —
- Estimate error
- —
- SEARCH
- TRACK
- DESCEND
- FINAL
Fig. 00The logged landing. Scrub the run. Amber is where the drone was, blue is where the Kalman filter thought it was, and the dots are the raw tag detections it was fed.
A Raspberry Pi finds an AprilTag pad with its camera and lands a multirotor on it. It flies like a pilot, sending stick commands to the flight controller over the MSP serial protocol (v1 and v2) at 50 Hz.
This is a simulation project. My simulator answers the same protocol with a mock flight controller that has wind, ground effect, battery sag and sensor noise. A test fails the build if the flight code ever imports the sim. I wrote the flight stack and the simulator; a partner wrote the detector.
What the camera sees
The simulator renders every camera frame, so vision runs on real images. Three tags of different sizes share one origin, and the stack hands over from one to the next on the way down.

- 4.00 mTRACK11.7 stags 0 + 1
- 2.09 mDESCEND17.7 stags 0 + 1
- 0.50 mDESCEND23.7 stags 1 + 2
How it works
The tag pose goes into a Kalman filter whose noise grows with range squared. PID loops turn position error into stick commands, with the D term taken from the filtered velocity. A mission state machine moves through search, track, descend and final, and can abort or hand control back to the flight controller.
The demo run
The drone starts 4 m up and about 2.2 m off the pad. It centres, descends and touches down 10.1 cm from the pad centre.
The estimate sits that close to the truth because the simulated camera is clean. At 4 m a raw tag detection is typically 2 cm off, and the filtered estimate about the same. Real flight will be noisier than this: attitude error, motion blur and timing all add to it.
The replay at the top can also fly the suite's 150 ms latency run. With the poses arriving that late, the estimate is typically 9 cm off at 3 m, and the drone still lands 5.1 cm from the pad centre.
The best bug
Running the flight code as its own process on a Linux pseudo-terminal, with real MSP bytes, showed the 50 Hz stick stream stuck behind the telemetry serial lock.
Other things the sim caught
The Kalman filter's measurement variance was set to a 10 cm sigma, against a real pose noise of about 1 cm. The estimate lagged by hundreds of milliseconds, and no pair of gains settled. Hovering in ground effect looked like a landing until touchdown detection also checked throttle. 16 wrong assumptions in all, each written up.
The suite has 18 scenarios (gusts, tag loss, latency, dropout), each with numeric pass limits. 16 of 18 pass on one seed. There are 131 unit tests.
What still fails
- A strong gust can push the pad out of view, and search has nothing to steer by, so it never finds it again.
- An inverted stick sign isn't caught in flight.
- The 30-seed Monte Carlo hasn't run yet, so results are one seed each.