Back to Serial Studio

Dual drone telemetry

examples/Dual Drone Telemetry/README.md

4.0.17.9 KB
Original Source

Dual drone telemetry

A multi-source drone telemetry simulator that shows Serial Studio receiving and visualizing data from two independent devices at the same time, each with its own camera feed, GPS coordinates, flight dynamics, and battery monitoring.

Overview

Two simulated drones fly different flight profiles over the Swiss Alps near Zermatt, each transmitting telemetry and synthetic camera imagery over separate TCP connections.

DronePortFlight patternAltitudeCamera style
Alpha9001Circular patrol (~330 m radius)120 m AGLSatellite imagery + green HUD
Bravo9002Figure-8 survey (~550 m radius)200 m AGLThermal/IR remap (iron-bow palette)

Camera feeds

Camera images are fetched from ArcGIS World Imagery satellite tiles (free, no API key required) and cached locally. Each drone's view is centered on its GPS position and rotated to match heading.

Alpha satellite. Photorealistic satellite camera view:

  • Real satellite imagery centered on the drone position, rotated to heading.
  • Green military-style HUD overlay with altitude, heading, and GPS coordinates.

Bravo thermal. Thermal/IR remap of satellite imagery:

  • Same satellite data remapped to an iron-bow thermal palette.
  • Iron-bow palette via OpenCV COLORMAP_INFERNO.
  • Amber FLIR-style HUD overlay with altitude, heading, and GPS coordinates.

Output controls

Each drone has an output control panel on the dashboard with six interactive widgets that send commands back to the simulator.

ControlWidget typeRangeCommand sent
ThrottleSlider0-100%THR <value>\r\n
HeadingKnob-180° to +180°HDG <value>\r\n
CameraToggleON/OFFCAM ON\r\n / CAM OFF\r\n
TakeoffButtonTKO\r\n
Return to HomeButtonRTH\r\n
CrashButtonCRASH\r\n

Throttle scales the drone's airspeed. 50% is normal cruise, 0% is idle, 100% is full speed. Heading applies a rotational offset to the flight path. Camera turns the synthetic JPEG feed on or off (telemetry keeps streaming). Takeoff launches from the helipad (only when grounded). RTH triggers return-to-home, landing, and automatic battery recharge. Crash drops the TCP link to simulate a catastrophic failure.

Telemetry per drone (11 fields)

FieldUnitsDescription
LatitudedegGPS latitude
LongitudedegGPS longitude
HeadingdegCompass heading (0 to 360)
AltitudemAltitude above ground
Airspeedm/sForward speed
Vertical Speedm/sClimb/descent rate
RolldegBank angle
PitchdegNose up/down angle
Battery VoltageV6S LiPo (18 to 25.2 V)
Current DrawAMotor + avionics current
Battery %%Remaining charge (drains over time)

Quick start

  1. Open Dual Drone Telemetry.ssproj in Serial Studio.
  2. Connect both TCP sources. Each one connects to the simulator's TCP server on ports 9001 and 9002.

The project includes a control loop that launches dual_drone_telemetry.py (which starts the two TCP servers) automatically just before connecting, so there is nothing to start by hand. For camera imagery, install its optional dependencies first:

bash
pip install opencv-python numpy   # for camera imagery

The simulator also works without opencv. You just won't get camera images. To run it yourself instead of letting the control loop start it, launch python3 dual_drone_telemetry.py before connecting.

Command-line options

FlagDefaultDescription
--fps10Update rate in Hz (telemetry + camera)
--host127.0.0.1TCP listen address

Protocol details

Both drones use hexadecimal frame delimiters with JPEG images interleaved in the same byte stream:

  • Alpha: A1 01 A1 01 (start) / A1 02 A1 02 (end).
  • Bravo: B2 03 B2 03 (start) / B2 04 B2 04 (end).

Each cycle sends a delimited JPEG camera frame, then a delimited CSV telemetry frame. Image delimiters are separate from the CSV delimiters:

  • Alpha images: A1 CA FE 01 (start) / A1 FE ED 01 (end).
  • Bravo images: B2 CA FE 02 (start) / B2 FE ED 02 (end).

Command protocol

Serial Studio sends commands back to the simulator over the same TCP connection. Each command is a text line terminated by \r\n.

CommandArgumentsEffect
THR0 to 100Set throttle (scales airspeed; 50 = normal cruise)
HDG-180 to 180Apply heading offset in degrees
CAMON or OFFEnable or disable camera image transmission
TKOLaunch from helipad (only when grounded)
RTHReturn to helipad, land, and recharge battery
CRASHSimulate catastrophic failure — drops the TCP link with a RST. Useful for testing how Serial Studio behaves when one source goes dark in multi-device mode while the other keeps streaming.

Commands are parsed on each simulation tick. Multiple commands can arrive per tick and are applied in order.

Dashboard widgets

Each drone has eight widget groups on the dashboard.

WidgetTypeDescription
CameraImage ViewLive satellite (Alpha) or thermal/IR (Bravo) camera feed
NavigationMapGPS track on an interactive map
HeadingCompassCompass heading indicator
AttitudeGyroscopeRoll, pitch, and yaw visualization
FlightGauges + BarsAirspeed, altitude, and vertical speed
PowerGauges + BarsBattery voltage, current draw, and charge level
ControlsOutput PanelThrottle, heading, camera toggle, takeoff, RTH, and crash per drone
StatePainterScripted live state visualizer driven by the telemetry datasets

Flight models

Both drones start grounded at their helipads near Zermatt. Send TKO to launch. Takeoff reaches cruise altitude in about 2 seconds so dashboard changes show up immediately during demos.

Drone Alpha, Zermatt village helipad (46.0207°N, 7.7491°E):

  • Circular patrol at 120 m AGL.
  • Constant mild bank angle (~12°).
  • Slow altitude oscillation (±8 m).
  • Battery drain: about 0.15%/sec in cruise.

Drone Bravo, Trockener Steg plateau (46.0035°N, 7.7465°E):

  • Figure-8 survey at 200 m AGL.
  • Dynamic banking (up to ±40°).
  • Higher altitude variation (±15 m).
  • Faster speed, higher current draw.
  • Battery drain: about 0.18%/sec in cruise.

Both drones have low-battery alarms set at 20% charge and 21 V. Send RTH to return, land, and recharge automatically for another flight.

Requirements

  • Python 3.6+.
  • opencv-python and numpy (optional, for camera imagery).
  • Serial Studio Pro (multi-source, Image View, and output controls).
<!-- SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-SerialStudio-Commercial -->