CTello is a C++ library to interact with the DJI Ryze Tello Drone using the Tello SDK 2.0. The purpose of this project is to encapsulate the UDP socket communication and provide a clean and easy-to-use interface to control the drone. However, CTello has no clutter that might hide parts of the Tello communication protocol, or restrict the interaction with the device in any way. CTello is transparent to the commands that are sent or responses that are received and gives full control to the user over the drone.
See the Tello SDK 2.0 User Guide
This project was developed and tested with the versions listed below.
Name | Version |
---|---|
C++ | 17 |
C++ compiler | GCC 9.3.0, Clang 9.0.1 |
CMake | 3.17 |
spdlog | 1.5.0-1 |
OpenCV | 4.2.0-2 |
Clone the repository:
git clone [email protected]:carlospzlz/ctello.git
Build it:
mkdir build
cd build
cmake ..
make -j
Install it:
sudo make install
This will install the library plus some tools in /usr/local
.
Now you can write a very simple program like this:
#include "ctello.h"
int main()
{
ctello::Tello tello;
if (!tello.Bind())
{
return 0;
}
tello.SendCommand("takeoff");
// Wait for response
while (!(tello.ReceiveResponse()));
tello.SendCommand("flip b");
while (!(tello.ReceiveResponse()));
tello.SendCommand("land");
while (!(tello.ReceiveResponse()));
return 0;
}
Build it:
g++ -std=c++17 -I/usr/local/include flip_world.cpp /usr/local/lib/libctello.so -o flip-world
Switch on your Tello and connect to its Wi-Fi.
Run your flip-world (you may need to add /usr/local/lib
to your
LD_LIBRARY_PATH
):
./flip-world
You can also enable logging output to see in detail what's going on:
env SPDLOG_LEVEL=debug ./flip-world
This project includes some executables built on top of the CTello library.
Emulates a command line interpreter to send commands to the drone.
Receives the state of the drone and shows a table with the different fields.
Receives the video stream from the drone and displays it in an OpenCV window.
Two examples are included.
Very simple example, similar to the previous flip-world.
This example shows case how image processing can be used to drive the drone's actions. Here, we try to follow a light by steering the drone towards it.