‹ all projects
IDSIA · BSc thesis · 2017

Real-time drone trajectory tracker (ROS)

A ROS and Qt tool that replays a drone's real flight against its planned path, live, so you can see and measure how far it strays. Built for a 2017 study putting an ultra-wideband positioning system through real flight trials, where GPS is hopeless between buildings. Rebuilt here as an in-browser demo.

roboticsROSUWBvisualisation
Real-time drone trajectory tracker (ROS)

Prove which one is better

Can a drone fly safely through a city? The Drone-Fly-Way feasibility study (IDSIA with Paradox Engineering) rested on one prerequisite: positioning far more precise than GPS, which errs by metres and goes hopeless between buildings. The candidate was POZYX, an ultra-wideband system promising centimetre-level accuracy from a tag on the drone talking to fixed anchors.

That sets up a deceptively simple question. Given two positioning systems, how do you prove which one is better? You compare the trajectories they report, and comparing trajectories turns out to be a whole research field. My thesis had both halves: validate the UWB system in real flight trials, and build the tool that shows, live and in numbers, how far a flight strays from its plan.

At the trials

The aircraft was an Erle-Copter, a quadcopter whose Erle-Brain runs Ubuntu with ROS preinstalled, carrying the POZYX tag and an XBee telemetry link. On a 25×60 m strip we rigged four poles with two UWB anchors each, at 1 m and 3 m, plus a Raspberry Pi running a TDMA scheme so several tags could share the radio, which the POZYX designers hadn’t planned for. Flights ran in the morning; by midday the valley wind topped 30 km/h. I was there for it.

The field verdict was blunt. The GPS fix proved unreliable flight after flight, while POZYX held decimetre precision with only rare, isolated outliers.

The Erle-Copter flown at the trials: Erle-Brain, XBee 2.4 GHz link and POZYX UWB board The actual aircraft: Erle-Brain on top, XBee link for monitoring, POZYX UWB tag for positioning.

The tool: Trajectory Visualizer

To make that verdict visible and quantitative, I built a Python application on ROS and Qt, wrapped around an embedded RViz 3D view. It loads nominal paths from .csv, replays real flights from ROS .bag logs, or tracks a live PoseStamped topic while the drone flies. Both trajectories render in 3D with ground shadows, and red comparison lines connect each measured point to its nearest nominal one, recent lines opaque and older ones fading, so drift shows the moment it starts. A metrics engine streams position, speed, acceleration and deviation into a live readout, with a PyQtGraph strip chart tracking deviation over time.

The whole thing is four independent components (core, files, metrics, and the RViz widget) talking only through ROS topics and services, so any one of them can be swapped out by someone else. It sorted a flight into a small taxonomy: the ideal path, the nominal one, the real flight, the measured track. Underneath sat a study of trajectory-similarity metrics (Euclidean, DTW, Edit Distance, LCSS), with resampling, point-shifting and noise handling and a temporal factor, and the choice of metric was left user-definable rather than baked in.

The assigned research question was whether one of those metrics beat plain Euclidean for the job. That part never gripped me. Building the tool did. It turned “is the drone where it should be?” into something you can watch.

The original tool, 2017: the RViz view mid-replay (green nominal, blue measured, red comparison lines) and the live metrics widget The 2017 original: RViz view mid-replay on the left, the live metrics widget on the right.

Rebuilt for the browser

The original ROS workspace and its flight bags are long gone, so I rebuilt the experience as a self-contained demo, down to the displays and the metrics, plus the one thing the trials made obvious. You can switch the positioning sensor mid-flight and watch the same run through POZYX eyes or GPS eyes.

The rebuilt visualizer on POZYX UWB: the measured track hugs the nominal perimeter POZYX UWB: tight tracking, the occasional isolated spike.

The same flight on GPS: metres of wander, red comparison lines fanning out The same flight on GPS: slow metre-scale wander, the red comparison lines telling the story.

Launch the interactive demo

Fly the perimeter in your browser, orbit the RViz-style view, switch between POZYX UWB and GPS mid-flight, crank the wind, and watch the metrics and comparison lines react. Every flight is simulated to the thesis specs.

The thesis

BSc thesis, SUPSI–IDSIA, 2017, supervised by Luca Gambardella and Alessandro Giusti: a UWB positioning system validated in real flight, with numbers behind it, and a reusable tool that makes “is the drone where it should be?” watchable and measurable. It was also my first real Python project. The full record, Validazione sperimentale di un sistema di localizzazione e coordinamento per il volo di droni, survives as an archived SUPSI repository page.

next project: Defect detection on metal surfaces →