Autonomous PX4 Drone
A quadrotor that flies missions, navigates without GPS using visual SLAM, and lands itself on a marker. Built on ROS 2, PX4, and a Raspberry Pi mounted on a Holybro X500.
GPS works fine until you go indoors or under a bridge. This project is a full autonomy stack that keeps a quadrotor flying when GPS isn’t available: visual-inertial odometry, 3D mapping, and precision landing, all running on a Raspberry Pi 4 mounted on the airframe.
The stack
Five layers, from motors to mission:
- PX4 (Pixhawk) — low-level stabilization and flight control, in SITL or on the real airframe.
- ROS 2 Jazzy — orchestrates the perception and navigation nodes.
- MAVROS — the bridge between MAVLink and ROS 2 topics and services.
- VIO + RTAB-Map — local pose estimation with loop-closure drift correction, fed by an Intel RealSense D455 depth camera and fused into PX4’s EKF2.
- Precision landing — ArUco marker detection in OpenCV, velocity servoing toward the target, then an automatic
AUTO.LANDtrigger.
I wrote the mission layer twice on purpose: once in C directly against MAVLink, to understand what’s actually on the wire, and once in Python with MAVSDK for everyday use. Waypoint missions, return-to-launch, and takeoff were all tested in Gazebo SITL before I ran them on real hardware.
The hardware
Holybro X500 V2 frame, Pixhawk flight controller, Raspberry Pi 4 as the companion
computer, and an Intel RealSense D455 for depth and tracking. The software stack is
containerized, so a single docker compose up brings up PX4 SITL, Gazebo, MAVROS,
RTAB-Map, and the camera bridges in one tmux session, on Ubuntu or WSL2.
What was hard
Getting EKF2 to trust the RTAB-Map odometry took a lot of tuning and even more time in the PX4 documentation. CPU budget on a Pi 4 is tight, so I had to profile and trim the perception pipeline until SLAM, marker detection, and MAVROS could share four cores without starving each other. Watching the drone land itself on a 20 cm marker made it worth the effort.