A full-stack MAVLink ground control system for ArduPilot/PX4-based drones
โจ Features โข ๐๏ธ Architecture โข ๐ Getting Started โข ๐ก API Reference โข ๐ฅ๏ธ Web Interface โข ๐ ๏ธ Configuration โข ๐ Project Structure
|
|
|
|
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Raspberry Pi (onboard) โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ controll_api.py โโโโโบโ mav_bridge.py โ โ
โ โ (Flask + Socket)โ โ (pymavlink MAVLink bridge) โ โ
โ โโโโโโโโฌโโโโโโโโโโโโ โโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โ HTTP/WS โ UART (921600 baud) โ
โ โผ โผ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ Web Browser โ โ Pixhawk โ โ
โ โ (Admin UI) โ โ (ArduPilot) โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| Component | Technology | Purpose |
|---|---|---|
controll_api.py |
Flask + Flask-SocketIO | REST API server & WebSocket video streaming |
mav_bridge.py |
pymavlink | MAVLink protocol bridge to Pixhawk over UART |
admin_panel/ |
HTML/CSS/JS + Leaflet | Web-based ground control interface |
config.js |
JavaScript | Dynamic API URL resolution via window.location.origin |
- Hardware: Raspberry Pi (any model with UART), Pixhawk (or any ArduPilot/PX4 autopilot)
- Connection: Pixhawk connected to Raspberry Pi UART (
/dev/ttyAMA0) - Software: Python 3.10+, pip
# 1. Clone the repository
git clone https://github.com/jonaw2005/UARV.git
cd UARV
# 2. Install Python dependencies
pip install -r requirements.txt
# 3. (Optional) Create a virtual environment
python -m venv venv
source venv/bin/activate # Linux/Mac
# or: venv\Scripts\activate # Windows# Start the API server (default: port 8000)
python controll_api.pyThe web interface will be available at: http://<raspberry-pi-ip>:8000
Note: The web interface automatically detects the server's IP address using
window.location.originโ no hardcoded IPs needed!
| Endpoint | Method | Description |
|---|---|---|
/api/status |
GET | API health check |
/api/get_health |
GET | System health status |
/api/get_telemetry |
GET | Full telemetry data |
/api/get_location |
GET | GPS location only |
| Endpoint | Method | Description |
|---|---|---|
/api/arm |
GET | Arm the vehicle |
/api/disarm |
GET | Disarm the vehicle |
/api/arm_disarm |
GET | Toggle arm/disarm |
/api/is_armed |
GET | Check armed status |
/api/takeoff |
GET | Takeoff (switches to GUIDED) |
/api/change_flightmode |
POST | Change flight mode |
/api/get_flightmode |
GET | Get current flight mode |
/api/set_velocity |
POST | Set velocity (vx, vy, vz) |
/api/goto |
POST | Go to GPS coordinate |
| Endpoint | Method | Description |
|---|---|---|
/api/mission_upload |
POST | Upload mission to Pixhawk |
/api/mission_download |
GET | Download mission from Pixhawk |
/api/mission_start |
GET | Start mission (switch to AUTO) |
/api/abort_mission |
GET | Abort mission (disarm + MANUAL) |
| Endpoint | Method | Description |
|---|---|---|
/api/get_param |
POST | Read a single parameter |
/api/get_param_test |
GET | Test: read STAT_RUNTIME |
/api/get_all_params |
GET | Read all parameters |
/api/get_gps |
GET | GPS position (GLOBAL_POSITION_INT) |
/api/get_gps_raw |
GET | GPS position (GPS_RAW_INT) |
/api/gps_status |
GET | GPS fix type & satellites |
/api/battery_level |
GET | Battery voltage, current, remaining |
| Endpoint | Method | Description |
|---|---|---|
/video |
GET | MJPEG video stream |
Socket.IO video_frame |
WS | Base64-encoded JPEG frames |
The main dashboard provides three panels:
| Panel | Features |
|---|---|
| ๐ท Live Camera | Real-time video stream from the onboard camera via Socket.IO. Displays connection status and stream URL. |
| ๐บ๏ธ Interactive Map |
โข Leaflet map with OpenStreetMap tiles โข Aircraft position with heading-indicating triangle marker โข GPS coordinate display (lat/lon) โข Telemetry floating window (attitude, velocity, battery, GPS) โข Mission Order floating window (downloaded mission display) |
| ๐ฎ Controls |
โข Arm/Disarm toggle with automatic status polling (every 3s) โข Flight mode dropdown (MANUAL, FBWA, AUTO, GUIDED, RTL, LOITER, STABILIZE, LAND) โข Takeoff button โข Abort button โข Mission Planner link โข Mission Order download button |
A full-featured mission planning interface:
- Click-to-place waypoints on the map
- Action insertion with parameter configuration
- Drag-and-drop reordering of mission items
- Coordinate form for precise waypoint entry
- Mission upload to Pixhawk (converts to MAVLink format)
- Mission download from Pixhawk
- Numbered markers and route polyline visualization
The connection is configured in controll_api.py:
bridge = MAVBridge("/dev/ttyAMA0", baud=921600)| Parameter | Default | Description |
|---|---|---|
connection_string |
/dev/ttyAMA0 |
UART device path |
baud |
921600 |
Baud rate (must match Pixhawk) |
source_system |
255 |
MAVLink system ID |
All API URLs are dynamically resolved using window.location.origin (defined in admin_panel/config.js). No configuration needed โ just access the web interface from any device on the same network.
UARV/
โโโ controll_api.py # Flask REST API + Socket.IO server
โโโ mav_bridge.py # MAVLink protocol bridge
โโโ mav_bridge_backup.py # Backup of original bridge
โโโ mav_test.py # MAVLink test script
โโโ requirements.txt # Python dependencies
โโโ servo_test.py # Servo test script
โโโ test_mission_download.py # Mission download test
โโโ test_mission_upload.py # Mission upload test
โโโ update_uarv.sh # Update script
โโโ README.md # This file
โ
โโโ admin_panel/ # Web frontend
โโโ config.js # Shared configuration (API_BASE)
โโโ index.html # Main dashboard
โโโ mission_planner.html # Mission planner interface
โโโ stylesheet.css # Main stylesheet
โโโ mission_planner.css # Mission planner styles
โโโ buttons.js # Control buttons & arm status polling
โโโ camera.js # Socket.IO video stream client
โโโ map.js # Leaflet map, telemetry, mission display
โโโ mission_planner.js # Mission planning logic
โโโ logo.png # UARV logo
โโโ ...
| Package | Version | Purpose |
|---|---|---|
flask |
โฅ2.0 | Web framework |
flask-socketio |
โฅ5.0 | WebSocket support for video streaming |
pymavlink |
โฅ2.4 | MAVLink protocol implementation |
opencv-python |
โฅ4.5 | Camera capture & JPEG encoding |
eventlet |
โ | (Removed โ conflicts with pymavlink) |
- Check UART connection (
/dev/ttyAMA0) - Verify baud rate matches Pixhawk configuration (921600)
- Ensure Pixhawk is powered and running ArduPilot
- Check pre-arm status in telemetry
- Ensure the vehicle is in GUIDED or STABILIZE mode
- Verify GPS has a 3D fix
- Check camera connection (
/dev/video0) - Verify the API server is running on port 8000
- Check browser console for Socket.IO connection errors