Jul 19, 2019

Parrot Ground SDK

Parrot Ground SDK

In our last drone blog we did an overview of four SDK’s that you can use to create mobile apps that power drones. In the next few weeks we’re going to take a look at each of these SDK’s to help understand what you need to get started. This week we’re going to look at the Ground SDK which runs on Parrot’s Anafi drones.

The Ground SDK is a viable alternative to DJI’s Mobile SDK for developers who want to build apps on a commercial platform. In this blog we’ll talk about what it takes to get the SDK installed and up and running. We’ll talk about the Anafi ecosystem and how it all fits together. Finally we’ll also walk through a simple take off and land app we created for the drone.

Demo app

To install the SDK go to https://developer.parrot.com/. Choose from either the iOS and Android version of the SDK depending on your needs. The installation instructions are available here.  The goal here is to get the demo app to build and then install it on your phone.

For Android you have to install a slightly earlier version of the Android Native Development Kit or NDK to get the demo app to build. It pays to read the instructions.

Running the app on your iOS or Android phone is pretty straightforward and it’s simple to connect the app to the drone and use it to fly the drone.

The demo ground-sdk app is comprehensive. While it’s not exactly a recreation of Parrot’s Free Flight app it is a fully functional app that has complete flight controls, with lots of sensor information and even a section on how to interact with the optional thermal camera. Parrot has spent a lot of time putting together a more complete example than usual to show how to use the Ground SDK API.

Parrot Ecosystem

And there’s more good news. Parrot also has an excellent simulator called Sphinx. You can control the Anafi as well as many of the other Parrot drones inside Sphinx using Olympe, a Python environment, see takeoff example below.

# -*- coding: UTF-8 -*-
import olympe
from olympe.messages.ardrone3.Piloting import TakeOff
drone = olympe.Drone("10.202.0.1")
drone.connection()
drone(TakeOff()).wait()
drone.disconnection()

Unfortunately Sphinx runs on Linux and not on Android or iOS and the Olympe Python API is different from the Java or Swift Ground-SDK API. But it’s a great way to get to grips with the possible drone commands.

Create your own Anafi app

So now for the bad news. While the demo app looks great and has a wide range of functionality that really hits all the high points of the Ground SDK API, unfortunately that is it. There are no other videos, tutorials, or even other people’s code samples to learn from. True, there is a developer forum but there’s little or no information on the forum on how to use the SDK. Hopefully there will be a lot more resources soon as I see Parrot’s Ground SDK as being a great alternative to the DJI or Arudpilot SDKs.

In an effort to move the conversation along, we decided to recreate a skinnied down version of the demo app from scratch.  Our version doesn’t have any bells and whistles. It’s an iOS app that connects to the drone, and has two joysticks that allow you to control the drone, see image below.  That’s it.  Nothing more.

We’ve published the iOS source code which you can find up on github.   The guts of our demo app is in two files, HomeViewController.swift and HudViewController.swift.  HomeViewController lists and connects to any available Parrot Anafi Drones.  HudViewController interfaces with the drone, allows you to take off and land and sends commands based on your interactions with the joysticks.

Feel free to download or clone it and let us know how you get on.  If you’re looking for a place to start and the Ground Sdk demo app is too overwhelming then we’re hoping this will get you started.