Skip to content

C# API for controlling a Tello Drone with associated collector to write drone telemetry to a SQL database

License

Notifications You must be signed in to change notification settings

davewalker5/TelloCommander

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TelloCommander

Build Status GitHub issues Coverage Status Releases NuGet License: MIT Language GitHub code size in bytes

NOTE: The separate Tello Commander Database and demo application repositories have been merged with the TelloCommander repository. The intention is to update the README and the Wiki to provide further guidance on the merged repository structure

About

Tello Commander is a C# API for controlling a Tello drone, offering the following features:

  • A simple interface to connect to, control and disconnect from the drone
  • Validation of all commands to ensure only valid commands are sent to the drone
  • Command/response history
  • Response parser for processing drone "read" command responses
  • Execution of commands from pre-prepared scripts
  • Background monitoring and reporting of drone status
  • Capture of drone telemetry information to CSV
  • Capture of drone telemetry to a SQL database

The following database types are supported:

Type Purpose
In Memory In-memory database for transient storage and primarily targetted at unit testing
SQLite Permanent storage in a SQLite database

A demonstration console application is provided to demonstrate use of the API to connect to and communicate with a drone. It provides the following connection types:

Type Purpose
Mock Uses a mock that simulates responses from the drone without establishing a connection
Simulator The application is connected to the simulator, running on the same machine
Drone The application is connected to a real drone

It is based on the ConsoleCommander class provided by the API.

Getting Started

Once the API is referenced by a project, you should include the following "using" statements to import the necessary types:

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

The following code snippet can be pasted into the Main() method of a C# console application to demonstrate connection to the drone, command processing and disconnection from the drone:

// Connect to the drone
var dictionary = CommandDictionary.ReadStandardDictionary("1.3.0.0");
var commander = new DroneCommander(new TelloConnection(), dictionary);
commander.Connect();

// Ask for a command to process and process it. Repeat until the an empty
// command is entered
bool isEmpty;
do
{
    Console.Write("Please enter a command or press [ENTER] to quit : ");
    string command = Console.ReadLine().Trim();
    isEmpty = string.IsNullOrEmpty(command);
    if (!isEmpty)
    {
        try
        {
            // Process the command using the API
            Console.WriteLine($"Command  : {command}");
            commander.RunCommand(command);
            Console.WriteLine($"Response : {commander.LastResponse}");
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }
}
while (!isEmpty);

// Disconnect from the drone
commander.Disconnect();

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.

The following is example output for a simple takeoff, height query and landing:

Please enter a command or press [ENTER] to quit : takeoff
Command  : takeoff
Response : ok
Please enter a command or press [ENTER] to quit : height?
Command  : height?
Response : 6dm
Please enter a command or press [ENTER] to quit : land
Command  : land
Response : ok

Wiki

More complete information on the capabilities and use of the API are provided in the Wiki

Authors

Feedback

To file issues or suggestions, please use the Issues page for this project on GitHub.

License

This project is licensed under the MIT License - see the LICENSE file for details