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

New App For Linux

Suphi

Member
Joined
Nov 15, 2020
Messages
7
Reaction score
4
Good day i have created a application for Linux using GTK + FFPLAY in order to fly my tello drone using my Laptop + XBOX 360 controller + High-Gain WiFi dongle (36 dBm)

i have had around 50+ flights with this program and have not once had any problems

You can find the project here written in the C language you can use the tello.h + tello.c to write your own program if you wish
https://gitlab.com/Suphi/Tello

ScreenShot.png

How i got 36dBm on my TP-LINK TL-WN722N
AUR (en) - wireless-regdb-pentest
 
Last edited:
  • Like
  • Love
Reactions: cgbsu, Fari and Neo

Neo

Member
Joined
Oct 19, 2020
Messages
11
Reaction score
10
Location
Spain
Nice project! It could be interesting to try with a Raspberry....
 

Fari

Well-known member
Joined
Jul 23, 2020
Messages
118
Reaction score
111
Location
Québec City
Good day i have created a application for Linux using GTK + FFPLAY in order to fly my tello drone using my Laptop + XBOX 360 controller + High-Gain WiFi dongle (30 dBm)

i have had around 50+ flights with this program and have not once had any problems

You can find the project here written in the C language you can use the tello.h + tello.c to write your own program if you wish
https://gitlab.com/Suphi/Tello
Thank You! I'll try that for sure this winter (for some reasons Quebec isnt dead frozen yet this year so I'm out there flying still).
But seriously THANKS, I'm a not working at the moment Web Dev's on Linux that pilot with a xbox controller, and I do not feel like learning C this year, my brain's already boiling with this piloting stuff :p

Open Source|Data for the Win!
 
Last edited:

Suphi

Member
Joined
Nov 15, 2020
Messages
7
Reaction score
4
for some reason my Tello is not sending me command 4176 so that i can ack it to start getting the 4177 command
is this only for the EDU version?

more info can be found here
Has anyone decoded the log headers/messages from the Tello?

other then that i made some small updates
if you launch the application before you turn the Tello on it will still connect to it once it comes online
its also possible to search for the gamepad after the app has started by pressing the enter key
 

Suphi

Member
Joined
Nov 15, 2020
Messages
7
Reaction score
4
I think i worked it out the 4176 command is failing the crc16 check and that was because my buffer size was not large enough i wonder what the max package size is

EDIT*
ok new update Added position, rotation and velocity data (0405d6f6) · Commits · Suphi / Tello
tello.c now saves
  • velocity_forward, velocity_right, velocity_down
  • position_forward, position_right, position_down, position_uncertainty
  • rotation_w, rotation_x, rotation_y, rotation_z
  • relative_velocity_forward, relative_velocity_right, relative_velocity_down
iv started adding return to home in the main.c but all it does for now is rotate back to the starting direction
 
Last edited:
  • Like
Reactions: cgbsu

cgbsu

New member
Joined
Nov 17, 2020
Messages
4
Reaction score
0
This is awesome, for a point of clarity, the user writes a callback to read the camera data, then it signals the tello to take more video, is that correct?
 

Suphi

Member
Joined
Nov 15, 2020
Messages
7
Reaction score
4
This is awesome, for a point of clarity, the user writes a callback to read the camera data, then it signals the tello to take more video, is that correct?

C:
// we first create a socket
int camera_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);

// And setup the address we will send the camera data
struct sockaddr_in camera_address;
memset(&camera_address, '0', sizeof(camera_address));
camera_address.sin_family = AF_INET;
camera_address.sin_port = htons(11111);
inet_pton(AF_INET, "0.0.0.0", &(camera_address.sin_addr));

void tello_camera_callback(uint8_t *data, int size)
{
    // The first 2 bytes are counters you can printf them to see what they do
    // data[0] goes upto 255 then loops back to 0
    // This if will run around once a second and will send a package to the tello telling it for a iframe
    // Search for h.264 iframe for more info
    if ((data[0] % 32) == 0 && data[1] == 0) tello_request_iframe(&tello);

    // Next we send the data to are socket we opened skipping the first 2 bytes
    sendto(camera_socket, &data[2], size-2, 0, (struct sockaddr *)&camera_address, sizeof(camera_address));
}

Now if you run this in a terminal

Code:
ffplay -fflags nobuffer -flags low_delay -framedrop -sync ext -probesize 32 -framerate 60 udp://0.0.0.0:11111

You should be able to watch the video feed

or if you want to record the video

Code:
ffmpeg -use_wallclock_as_timestamps 1 -framerate 30 -i udp://0.0.0.0:11111 -c copy PATHTOSAVE
 
Last edited:

Suphi

Member
Joined
Nov 15, 2020
Messages
7
Reaction score
4
New update

Added auto fly home: Added fly home (706d3d21) · Commits · Suphi / Tello
fly to any location then press the X button to save your current position

then fly away and tap the Y button to turn auto fly on the drone will rotate towards to the saved position and start flying towards it and stop once it gets close to the save position

the drone will not go up or down it will simple goto the X and Z position it will ignore the Y position

to stop auto fly you can simple tap Y again or move any of the d pads



the maths

C:
// Set the target position
float targetPosition_x = 10;
float targetPosition_z = 20
   
// Direction vector ignoring Y axis
float targetDirection[] = {targetPosition_x - tello.position_x, targetPosition_z - tello.position_z};

// Workout target distance before we normalize the direction
float targetDistance = hypot(targetDirection[0], targetDirection[1]);

// Normalize the target direction
float l = 1 / sqrt(targetDirection[0] * targetDirection[0] + targetDirection[1] * targetDirection[1]);
targetDirection[0] *= l; targetDirection[1] *= l;

// Tellos quaternion
float q[] = {tello.rotation_x, tello.rotation_y, tello.rotation_z, tello.rotation_w};

// Workout tellos forward vector using the quaternion without the Y axis
float v[] = {2 * (q[0]*q[2] + q[3]*q[1]), 1 - 2 * (q[0]*q[0] + q[1]*q[1])};

// As we never used the Y axis the forward vector is not normalize so we must normalize
float l = 1 / sqrt(v[0] * v[0] + v[1] * v[1]);
v[0] *= l; v[1] *= l;

// Using the target direction and forward vector workout the angle diffrence the value will be from -PI to PI
float a = atan2(v[0]*targetDirection[1]-v[1]*targetDirection[0], v[0]*targetDirection[0]+v[1]*targetDirection[1]);

// Clamp the angle from -1 to 1 as Tello.H will not clamp it for us so we need to make sure we clamp it before setting the dpad
if (a < -1) a = -1; else if (a > 1) a = 1;

// Set the dpad to rotate acording to the angle
tello.left_x = -a;

// If the angle is below 0.2 then set the dpad to move forward
if (a > -0.2 && a < 0.2) tello.right_y = 0.4;
 
Last edited:

New Threads

Members online

No members online now.

Forum statistics

Threads
5,115
Messages
36,990
Members
13,826
Latest member
BenBazz