Skip to content

Demonstration Application

Dave Walker edited this page Jan 24, 2020 · 6 revisions

TelloCommanderConsole

The demonstration application uses the TelloCommander API to demonstrate how to connect to and communicate with a drone using the API, issue commands, query drone telemetry and capture telemetry to file or a SQL database.

It is published in its own repository:

The ConsoleCommander Class

The basis of the application is the ConsoleCommander class, that demonstrates background status monitoring and capture of telemetry with an interactive console-based drone commander. Its use is illustrated, below:

using TelloCommander.CommandDictionaries;
using TelloCommander.Connections;
using TelloCommander.Interfaces;

The following snippet can then be pasted into the Main() method of a console application to run the application:

CommandDictionary dictionary = CommandDictionary.ReadStandardDictionary("1.3.0.0");
new ConsoleCommander(new TelloConnection(), dictionary).Run(true);

The argument passed to the "ReadStandardDictionary" is the Tello API version number and defines the set of available commands (see the wiki) for more details.

In addition to the commands supported by the drone and the custom commands provided by the TelloCommander API, the console application also supports the following commands:

Command Parameters Purpose
? None Report the current status to the console
startcapture file interval Start writing telemetry to the specified file (in CSV format) at the specified interval (in milliseconds)
stopcapture None Stop file capture if it's in progress
startdbcapture drone session interval [property list] Start writing telemetry to th SQLite database defined in the appsettings.json file
stopdbcapture None Stop writing telemetry to a database if it's in progress

The arguments to the "startdbcapture" command are as follows:

Name Description
drone Name of the drone, as a single word e.g. TELLO-12345
session Name of the capture session, as a single word e.g. LoopTheLoop-001
interval The collection interval, in milliseconds e.g. 1000 = 1 second. A value <= 0 defaults to 1000 ms
property list A comma-separated list of the properties to capture e.g. pitch,roll,yaw

The "drone" and "session" arguments are just text tags that you can use to identify data points recorded for a specific drone and named session.

Valid properties for the property list are those returned in the Tello status, as documented in the drone APIs:

For example, to collect the height and battery charge at 1s intervals, use the folowing:

startdbcapture MY-TELLO My-Session-1 1000 h,bat

The ConsoleCommanderWrapper Class

The ConsoelCommanderWrapper class is a wrapper class that prompts for the command dictionary and type of connection to use and then calls the ConsoleCommander to prompt for and execute commands, as described above.

Its use is illustrated below:

using TelloCommander.CommandLine;

namespace TelloCommander.Console
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new ConsoleCommanderWrapper().Run();
        }
    }
}