This guide shows you how to connect SkyDash to real drone hardware instead of the simulator.
pip install pymavlink pyserialReplace the simulation code:
from mavlink_adapter import MAVLinkDrone
# Choose your connection:
# - Serial: drone = MAVLinkDrone("/dev/ttyUSB0") # Linux
# - Serial: drone = MAVLinkDrone("COM3") # Windows
# - UDP: drone = MAVLinkDrone("udp:127.0.0.1:14550") # SITL simulator
# - TCP: drone = MAVLinkDrone("tcp:192.168.1.100:5760") # WiFi telemetry
drone = MAVLinkDrone("udp:127.0.0.1:14550") # Change this!
drone.connect()
@app.get("/telemetry")
async def get_telemetry():
return drone.get_telemetry()Physical Serial Connection:
# Linux with USB telemetry radio
drone = MAVLinkDrone("/dev/ttyUSB0")
# Windows with USB telemetry radio
drone = MAVLinkDrone("COM3")WiFi/Network Connection:
# Connect to drone over WiFi
drone = MAVLinkDrone("tcp:192.168.1.100:5760")SITL Simulator (for testing):
# Connect to ArduPilot SITL
drone = MAVLinkDrone("udp:127.0.0.1:14550")DJI requires a bridge application because they don't use MAVLink.
- Create an Android/iOS app using DJI Mobile SDK
- Implement HTTP endpoints in your app to expose telemetry
- Use
dji_adapter.pyto fetch data from your mobile app
- Install DJI Onboard SDK on companion computer (Raspberry Pi, etc.)
- Create a bridge service that exposes telemetry via HTTP
- Configure
DJIDroneclass with your bridge URL
For custom drones with proprietary protocols:
import serial
import json
class CustomDrone:
def __init__(self, port="/dev/ttyUSB0", baudrate=115200):
self.serial = serial.Serial(port, baudrate)
def get_telemetry(self):
# Read from your drone's serial protocol
line = self.serial.readline().decode('utf-8')
data = json.loads(line) # Adjust based on your format
# Map to SkyDash format
return {
"altitude": data['alt'],
"battery_voltage": data['bat'],
"attitude": {
"roll": data['roll'],
"pitch": data['pitch'],
"yaw": data['yaw']
},
# ... map other fields
}For drones using ROS:
import rclpy
from sensor_msgs.msg import NavSatFix, BatteryState
from geometry_msgs.msg import PoseStamped
class ROSDrone:
def __init__(self):
rclpy.init()
self.node = rclpy.create_node('skydash_bridge')
self.latest_data = {}
# Subscribe to ROS topics
self.node.create_subscription(
NavSatFix,
'/mavros/global_position/global',
self.gps_callback,
10
)
# Add more subscriptions...
def get_telemetry(self):
return self.latest_dataBest way to test without real hardware:
# Linux/Mac
git clone https://github.com/ArduPilot/ardupilot.git
cd ardupilot
Tools/environment_install/install-prereqs-ubuntu.sh -y
. ~/.profile
cd ArduCopter
sim_vehicle.py -w# In main.py
from mavlink_adapter import MAVLinkDrone
drone = MAVLinkDrone("udp:127.0.0.1:14550")
drone.connect()python backend/main.py| Type | Example | Use Case |
|---|---|---|
| Serial | COM3 or /dev/ttyUSB0 |
Direct USB/Radio connection |
| UDP | udp:127.0.0.1:14550 |
SITL simulator |
| TCP | tcp:192.168.1.100:5760 |
WiFi telemetry |
| UDP Broadcast | udpout:127.0.0.1:14550 |
Send MAVLink commands |
- 57600: Common for 3DR radios
- 115200: Most modern telemetry radios
- 921600: High-speed serial (short cables)
- Check connection string
- Verify drone is powered on
- Check firewall/port settings
- Try different baud rate (serial)
sudo usermod -a -G dialout $USER
# Logout and loginAlready configured for localhost:5173-5175. If using different port:
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:YOUR_PORT"],
# ...
)- Never expose control commands without authentication
- Use HTTPS in production (not HTTP)
- Implement rate limiting on API endpoints
- Validate all inputs before sending to drone
- Add authentication (JWT tokens, API keys)
- Choose your drone type from options above
- Install required dependencies
- Update
main.pywith appropriate adapter - Test connection
- Start SkyDash dashboard
For questions, refer to:
- MAVLink: https://mavlink.io/
- ArduPilot: https://ardupilot.org/
- PX4: https://px4.io/
- DJI SDK: https://developer.dji.com/