Hello Tello Pilot!
Join our DJI Tello community & remove this banner.
Sign up

tellTello - A console-based frontend to the SDK. Written in Python3

martinpi

Well-known member
Joined
Dec 15, 2019
Messages
45
Reaction score
27
Location
Vienna. Austria
Website
martinpi.at
Tell Tello what to do.
I wrote this program basically for myself to try various things. It got bigger and bigger and maybe it is useful for you as well.
It is far from perfect and heavily under construction. I know that my programming style is very oldschool, I never learned OOP.
Comments, suggestions and bug reports are very welcome.

See cozmobotics/tellTello

What it does:
  • Fly Tello with text commands (like "ccw 90") or with keys (like w/a/s/d and cursor keys)
  • execute commands from a text file
  • watch selected variables from the status string and write them to a comma-separated list (csv-format)
An example how to use it is a test of the barometer.

Have some fun with it!
 
Last edited:

martinpi

Well-known member
Joined
Dec 15, 2019
Messages
45
Reaction score
27
Location
Vienna. Austria
Website
martinpi.at
The scripting feature is very basic. No loops, branches, etc.
You can add comments with a # or "comment out" a line by placing a # in the first column.
You can use all string-based commands in a script, including "script" which loads a script and inserts it at the current position.

Scripts may look like this:

Script1.txt:

Code:
key # useful, so you can manually correct the flight path while the script is executed
watch bat baro temph
watchperiod 1
takeoff
script Script2.txt # will do some rotation commands
up 50
script Script2.txt # the same script again
land
battery?
time?
end # shut down tellTello

Script2.txt:

Code:
cw 90
cw 90
cw 90
cw 90

And, yes, you can build an infinite recursion by calling the same script you are executing. If it is the last statement in the file, it will not do any harm but start an infinite loop.
 

martinpi

Well-known member
Joined
Dec 15, 2019
Messages
45
Reaction score
27
Location
Vienna. Austria
Website
martinpi.at
The watch feature

tellTello constantly receives state frames from Tello.
You can print one or more lines with the command like "state 3" which will print 3 lines on the console window.
When using key-based input, press F2 to print one line.

The line looks like this:
mid:-1;x:0;y:0;z:0;mpry:0,0,0;pitch:-1;roll:0;yaw:0;vgx:0;vgy:0;vgz:0;templ:51;temph:54;tof:10;h:0;bat:88;baro:38.28;time:0;agx:-13.00;agy:-5.00;agz:-998.00;

The reason for printing only one or a few lines is, that you can clog your interface when you print all frames which are received. My first prototype which tried to print all frames did not react to any input, not even Ctrl-C.

You can print frames repeatedly, the command is

watchperiod n

which will print one frame every n seconds. Fractions of seconds are allowed. Again, when you put in a too small value, like 0.01, you will clog your interface. so that tellTello does not react to any command.

Setting the watchperiod to -1 (or any negative value) will stop the output of state frames.

Selecting values and writing csv

When you want to monitor only one or a group of values, like I did for the barometer test, you can write something like

watch bat pitch agz

When you request state frames, you get

>state 5
>watch;time;bat;pitch;agz;LastCommand;
watch;1578764256,3427002;88;-1;-998,00;up 70;
watch;1578764257,3646185;88;-1;-998,00;up 70;
watch;1578764258,3865974;88;-1;-998,00;up 70;
watch;1578764259,3988905;88;-1;-998,00;up 70;
watch;1578764260,4111822;88;-1;-998,00;up 70;

which you can paste into a spreadsheet, do some calculations, create a diagram or whatever you like,
(In this example, the values don't change because this is an offline-test with dummy values - see the -o or --offline command line parameter)

if you make a mistake, like writing "bro" instead of "baro", you will get "error" in the respecting column instead of a numerical value.

The first line is the header which explains the meaning of the columns. The header is printed every time you select a new watchset.

The columns are:
"watch" so I can filter out the interesting lines
time ... for sorting the lines and to see what happened when
bat;pitch;agz ... the selected values
LastCommand ... to see which command hat which effect

Being a german-speaking user, I've chosen semicolons for separation and comma as decimal point.
You can change this by removing the line

OutString = OutString.replace ('.',',') # +++ add an arg to decide whether or not to replace

from the function interpreteState(). It's a todo for me to let you choose which format you prefer.

Writing the command "watch" with no parameters sets the watch feature back to the raw state string.
 
Last edited:

martinpi

Well-known member
Joined
Dec 15, 2019
Messages
45
Reaction score
27
Location
Vienna. Austria
Website
martinpi.at
New feature in V1.1: joystick mode

In this mode, the keyboard simulates a joystick (controller).
The keys are the same as in "key" mode, but rather than starting in one straight direction (up/down/left/...) and stopping at the end, the speed gradually increases with every keystroke.
You can move in all axes simultaneously.
The space bar (or "h" or "5") acts as "emergency brake" and sets all speeds to 0.
 

martinpi

Well-known member
Joined
Dec 15, 2019
Messages
45
Reaction score
27
Location
Vienna. Austria
Website
martinpi.at
New version 1.2

My program is growing fast, even though my ideas come even faster and so the todo list still grows.

Thanks, folks, for posting in the thread Tello Video Web Streaming
I successfully tried to receive the video stream and put this feature in tellTello.

The new commands in tellTello are:
  • oscommand ... enter an os command which is executed in a new window.
    This is, sorry Linux users, Windows-specific.
    I leave the window open for later inspection.
  • video ... send "streamon" and open ffmpeg in a new window
  • ready ... ready for takeoff: start motors and enter joystick mode
Check it out on cozmobotics/tellTello and have some fun with it!
 

f41ardu

Well-known member
Joined
Jan 3, 2019
Messages
57
Reaction score
20
Location
Back in Stuttgart ;->
Tell Tello what to do.
I wrote this program basically for myself to try various things. It got bigger and bigger and maybe it is useful for you as well.
It is far from perfect and heavily under construction. I know that my programming style is very oldschool, I never learned OOP.
Comments, suggestions and bug reports are very welcome.

See cozmobotics/tellTello

What it does:
  • Fly Tello with text commands (like "ccw 90") or with keys (like w/a/s/d and cursor keys)
  • execute commands from a text file
  • watch selected variables from the status string and write them to a comma-separated list (csv-format)
An example how to use it is a test of the barometer.

Have some fun with it!
For Tello video have a look at

f41ardu/Tello-Python
-> f41ardu/Tello-Python
Branch develop and h264decoderpi3

cmake for Raspberry is still broken, will fix ist soon.

mkdir build
cd build
cmake ../CMakeList.txt -DPython_ADDITIONAL_VERSIONS=3.7 -DBoost_PYTHON_LIBRARY_RELEASE=/usr/lib/arm-linux-gnueabihf/libboost_python37.so ../
make

Look for a .264 sample file, it will work. On Raspberry performance is no such good. I assume that I will perform much better on a Linux client. I guess it may perfom better on an Raspberry PI 4.
 

New Threads

Members online

Forum statistics

Threads
4,081
Messages
31,054
Members
10,425
Latest member
CS-ZA