WARG Groundstation

January 2016

The groundstation is one of my proudest and most developed projects to date. I started building it back in January 2016, after being assigned as the project lead to the project at the Waterloo Aerial Robotics Group.

The Problem

WARG is a student design team at the University of Waterloo that deals with unmanned aircraft. Even though SPIKE, our current gen plane, can fly by itself, it needs something to tell it where to go. In addition, the ground crew flying the plane needs to know where the plane is, and whats currently happening with it. The groundstation is an application that directly communicates back and forth between the autopilot, displaying the current position and status of the plane as it flies.

The groundstation was a already fairly developed project when I first started. Back then it ran on Javascript and NW.JS, however the code-base didn't take advantage of the modularity and reusability that the node package manager provides! In addition it was a pretty crammed application, with all of its functionality packed into a single window. It didn't play well with smaller screen sizes, and had a few 1000 line files in it that made adding features extremely difficult. The old version of the app was developed in a rush before the 2015 UAS competition, so the application state was totally understandable, and looked like this:

Old version of groundstation

The Solution

Back then I had some pretty sweet features in mind for the groundstation. For example implementing scope level application logging, so that in case of bad flight days, we had lots of data to use to debug problems with. I'm usually not a fan of doing full-rewrites, especially if they can be avoided, however the features I wanted to implement would have required some major refactors.

Therefore, learning from the original code-base and using it as reference, I re-wrote the application during my winter break back in 2015. As before, it's a Javascript based app running on the Electron runtime. I added in Backbone.js as the front-end javascript framework to simplify management of the different views, and leaflet to manage the map. Overall its an easy to install, cross-platform, multi-windowed desktop application, written to leverage the modularity that the node package manager provides. This makes the application easy to develop as well as debug and maintain. The initial version looked like this (without the 3D view or path stuff):

Main layout of the groundstation

The entire application is completely open source and can be found on Github.

Result

After working in jobs that promoted unit tested code, I realized just how awesome unit testing is. The application is now being unit tested with a continuous integration server running against using TravisCI. Since this is a team project, I both developed and documented the project such that other team-members can easily work on it. I used JsDocs to automatically generate the API documentation for the groundstation. In addition, I hand-wrote some simple docs on getting introduced to the groundstation stack, which can be found on the WARG Documentation.

Features

The groundstation has grown into a project that is being worked on by multiple people, with some pretty awesome features, like a 3D view that orients itself with the actual position of the aircraft in real time. Some of the groundstation's features include:

  • Path Management: create, modify, delete waypoints and paths, and send them to the aircraft
  • 3D View : view the orientation of the aircraft
  • Dials : attitude, heading, and altitude dials to tell the position and orientation of the aircraft
  • Status View: display critical information about the plane and the application, such as GPS status, battery level, etc..)
  • Console: multi-level application logging can track warnings, info and debug messages, and errors
  • Gain Adjust: adjust the aircraft gains on the fly
  • Autonomous Level: modify the aircraft's autonomous level on the fly (ie. control the attitude with autopilot, and use RC for thrust)
  • Data Entry: take a labelled snapshot of the telemetry state and save it for debugging purposes
  • Import and Export: Gains, paths, and application settings
  • Persistent Settings: set local application settings without editing any config files

Other Windows

End Goal

Overall I'm extremely proud of the groundstation, and I'm continuously working to try to make it the best possible solution for UAV applications. I hope that one day it becomes as popular and widely used as Mission Planner, and lowers the gap for newcomers to enter the UAV industry. There's still a bit of a ways to go in terms of making it generic, stable, and documented enough for public use, but I believe that with the help of other WARG members and contributors that it can one day happen.

I learned an unprecedented amount about architecting software, as well as modularity and maintainability whilst developing the project. The experience made me a far better developer, and I hope to pass on the knowledge that I learned to others.

View on Github