All projects

10 / BuildsProjects

Autonomous AI Drone Racing

Vision, AI and flight control on a team project · ENAE788Y, University of Maryland · Spring 2026

Onboard view: three gates detected at once, each with corners, pose axes and distance
The challenge

Project scope and constraints

ENAE788Y, AI Autonomous Drone Racing, is a graduate course at the University of Maryland built around one goal: by the end of the semester, a 7-inch quadcopter has to fly a course of gates autonomously. The drone carries a camera, a Raspberry Pi 5, and an AI accelerator. All perception, decision-making, and flight control has to run on board.

This was a team project. My part was the chain from camera image to flight command: the vision system, the AI gate recognition and its integration on the AI HAT, reinforcement learning in simulation, flight testing, and the final flight control code that completed the course.

The live stream we monitored in flight: annotated video plus the telemetry row for each gate
My role

Team responsibilities

  • Perception

    Vision system

    Camera capture, fisheye calibration, and the pipeline that turns a video frame into a gate position the flight code can use.

  • Machine learning

    AI gate recognition

    Built and labelled the gate dataset, trained and compared the detection models, and validated them on recorded and live footage.

  • Edge compute

    AI HAT integration

    Got the trained network running on the Hailo-10H accelerator on the Raspberry Pi, including decoding its raw outputs in real time.

  • Simulation

    Reinforcement learning

    Designed a MuJoCo training environment and reward functions for a policy that learns to fly through a gate.

  • Autonomy

    Final flight control code

    Wrote the mission logic that flew the successful course pass: staged visual approach, then an open-loop commit through each gate.

  • Field work

    Flight testing

    Ran the indoor and outdoor test campaign, from bench checks without propellers to full autonomous runs under the net.

Interactive · the system

Onboard processing pipeline

Seven stages run on the drone between the camera and the motors. Select a stage for its description.

Neural network

YOLO on the AI HAT

Each frame is resized to 640 × 640 and sent to a YOLO network compiled for the Hailo-10H accelerator on the Raspberry Pi AI HAT+ 2. The raw network outputs are decoded in NumPy: filter by confidence first, decode boxes only for confident anchors, then non-maximum suppression. Up to three gates are kept per frame.

  • Hailo-10H accelerator
  • 8,400 candidate boxes per frame
  • Confidence threshold 0.5
AI gate recognition

Gate detection dataset and training

I recorded the drone’s own camera view of the gates and labelled each gate with a box and its four corners as keypoints, since corners are what the pose math needs. The dataset came to 771 images after augmentation with brightness shifts, blur, and pixel noise.

Training added mosaic, scale, rotation, and exposure augmentation on the fly. Horizontal flipping had to be switched off, because a mirrored image swaps the left and right corners and trains the network on the wrong corner order.

The first working version tracked gates in 3D indoors, shown here: detected corners, pose axes at the gate center, and position in metres.

April: first 3D gate tracking indoors, from recorded flight footage
Grid of sixteen validation images, each with gates outlined by a box and four corner keypoints
Model predictions on held-out images: a box and four ordered corners per gate
Four model sizes trained on the same data. The smallest matched the largest, which suits a network that has to run on a drone.
ModelEpochsTraining timeBox mAP50-95Corner mAP50-95
YOLOv8n-pose804.5 min0.8290.995
YOLOv8s-pose594.7 min0.8120.995
YOLOv8m-pose8611.3 min0.8170.995
YOLOv8l-pose8117.4 min0.8030.995

Trained on a desktop GPU with early stopping. The validation set is small (21 images) and the corner score saturates, so I treated all four as adequate and selected on speed. For the flight version I trained a compact detector for the Hailo-10H and moved corner finding into classical vision behind it, which was more robust outdoors.

Camera calibration

Fisheye lens calibration

A wide lens covers more of the course, but it distorts straight lines, and distorted lines give wrong distances. I calibrated both cameras by filming a ChArUco board from hundreds of angles and solving for the lens model, then verified it by undistorting the footage.

Raw fisheye camera frame of a checkerboard calibration target, with visibly curved edges
Raw frame: the board’s straight edges curve
The same frame after undistortion, with the checkerboard edges straight
After correction with the solved lens model
  • 446Video frames used to calibrate the forward camera
  • 0.40 pxReprojection error (0.53 px for the second camera)
  • 105° × 72°Measured field of view at 1280 × 720
Interactive · pose estimation

Gate pose estimation from four corners

The demo models the drone’s camera with its real calibration. Moving the gate updates the corners, the bounding box, and the telemetry row. Increasing the distance shows the range error that results from one pixel of corner error.

Dist: 0.00mCAMERA VIEW · 1280 × 720

Telemetry row sent to the flight code

Dist
–
Fwd
–
Right
–
Down
–
Yaw
–
Gate width in the image
–
Range error from a 1 pixel corner error
–

The gate is a known size, so its apparent size and shape in the image fix its position. At long range it covers only a few pixels, so each pixel of corner error produces a much larger range error.

The projection uses the measured focal length, optical center and fisheye coefficients of the forward camera and the real 0.97 m gate. The range error is the first-order estimate z² ÷ (focal length × gate width). For this reason the flight code closes in and re-measures instead of relying on a single long-range fix.

Reinforcement learning

Gate-flight policy training in simulation

In parallel with the vision work, I explored a learned controller. I built a Gymnasium environment around a MuJoCo quadcopter model and trained policies with PPO across eight parallel simulations. The policy observes its position, velocity, attitude, last action, and the gate’s four corners, and outputs thrust and body moments.

Most of the work was reward design. The final shaping rewards progress toward the gate center, penalizes aggressive or jittery commands and excessive tilt, adds a bonus for a clean pass, and ends the episode on a crash or a gate strike. I iterated through stricter gate geometry, a "bullseye" variant that rewards passing near the center, and a two-stage curriculum, and ported the environment to GPU physics to train faster.

The policies learned to take off and fly through the simulated gate. For the real course we flew the classical approach below: it was easier to verify and to make safe in the time available.

A trained policy flying the gate in MuJoCo
Interactive · flight control

Mission logic for the final course pass

Vision is most accurate at close range, but at close range the gate no longer fits in the frame. The final flight code is built around that trade-off: approach under visual feedback in stages, stop and let the drone settle one metre out, then fly straight through open-loop.

Gate 1 of 8Scanning
  1. 01Scan for the next gate
  2. 02Closed-loop approach to 2 m
  3. 03Closed-loop approach to 1 m
  4. 04Wait for velocity to settle
  5. 05Open-loop fly-through, 1.0 m/s for 3 s
Mission time
0.0 s
Speed
0.00 m/s

The stages, standoff distances, controller gain and speeds are the ones flown. The course layout in this animation is illustrative, and the log lines mirror the real program’s output.

May 17, the successful pass, at 4× speed: onboard video on the left, the mission log on the right, ending in "Mission complete (8 gates). Initiating landing!"
Ten weeks

Development timeline

  1. Mar 6

    First gate footage

    Recorded the drone’s camera view of the gates indoors to start building a dataset.

  2. Apr 3

    Corner-keypoint model

    Labelled dataset exported (771 images) and the first YOLO pose models trained to find each gate’s four corners.

  3. Apr 8 – 10

    Reinforcement learning

    PPO policies trained in MuJoCo to fly a simulated quadcopter through a gate.

  4. Apr 10 – 23

    3D gate tracking

    Corner detections combined with solvePnP to track gate position and orientation live, indoors.

  5. May 6

    Fisheye calibration

    Both cameras calibrated with a ChArUco board, to 0.40 and 0.53 pixels of reprojection error.

  6. May 12

    Model on the AI HAT

    A compact detector trained and compiled for the Hailo-10H, with classical corner refinement added behind it.

  7. May 13 – 15

    Outdoor pipeline tests

    Full vision pipeline running on the drone outdoors at about 32 frames per second, tracking multiple gates.

  8. May 17

    Autonomous eight-gate run

    The final flight code navigated all eight gates and landed autonomously.