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

PHP Wrapper

ttrolololll

New member
Joined
Apr 12, 2018
Messages
4
Reaction score
2
Hey there! I've created a simple wrapper to interact with the Tello Drone in PHP.

ttrolololll/tello-php

It has been tested on my Tello and is working.

Btw, if you download the Tello Scratch programming package, you'll find a file called Tello3.js. You can invoke it with 'node Tello3.js' in the terminal. And if you examine the code, you'll realise that you can issue commands via GET requests. You have a ready-made REST API endpoints to interact with the Tello, pretty nifty.

It's a pity that the Tello Drone developers decided not to open up the SDK for the onboard sensors and camera... :(
 
  • Like
Reactions: Cyke

pbennett87

Member
Joined
May 1, 2018
Messages
13
Reaction score
1
What is the "require __DIR__.'/vendor/autoload.php';" and why is it not in the folders, finally, I have never used node, is there another method?
 

ttrolololll

New member
Joined
Apr 12, 2018
Messages
4
Reaction score
2
What is the "require __DIR__.'/vendor/autoload.php';" and why is it not in the folders, finally, I have never used node, is there another method?
That's just to load any library dependencies (in this case, monolog to log down events) using composer. But it is currently not in use. You can safely get away without that line of code.
 

cyberar

New member
Joined
Nov 30, 2018
Messages
3
Reaction score
1
Location
Buenos Aires, Argentina
Hello! I'm don't work in apache

I lauch the file tinker.php in apache and response with error:

Fatal error: Uncaught Error: Call to undefined function Tello\socket_create() in C:\Apache24\www\sitio1\tello\Tello.php:126 Stack trace: #0 C:\Apache24\www\sitio1\tello\Tello.php(20): Tello\Tello->preFlightSetup() #1 C:\Apache24\www\sitio1\tinker.php(5): Tello\Tello->__construct() #2 {main} thrown in C:\Apache24\www\sitio1\tello\Tello.php on line 126

i dont find my error, please do you help me?

regards
 

an3k

Active member
Joined
Dec 11, 2018
Messages
44
Reaction score
34
Fatal error: Uncaught Error: Call to undefined function Tello\socket_create() in C:\Apache24\www\sitio1\tello\Tello.php:126 Stack trace: #0 C:\Apache24\www\sitio1\tello\Tello.php(20): Tello\Tello->preFlightSetup() #1 C:\Apache24\www\sitio1\tinker.php(5): Tello\Tello->__construct() #2 {main} thrown in C:\Apache24\www\sitio1\tello\Tello.php on line 126
That means the function socket_create() isn't defined anywhere. Your PHP installation is not working correctly.

I assume for this I need a wifi dongle on the PC connected to the Tello?
You just need to connect your computer (running this PHP Wrapper) to the Tello. If you have a Tello EDU you can connect the drone to your local WiFi to which your computer is connected (through wire). For the regular Tello you directly need to connect the computer to the drone (using WiFi).
 

ErikThiart

Member
Joined
Dec 22, 2018
Messages
21
Reaction score
6
Location
South Africa
Website
www.erikthiart.com
Just played with this works like a charm!

(if you get a socket error changes are you are running it via the command line and not through your web server directly (XAMMP/WAMP)
^Windows specific issue.


@an3k what are some cool flights you have built so far? I just played with the basic lift of move forward backward etc, I want to do a bit more flying, but find the lag between commands to interfere or I am not sleeping enough between commands, what does the API spec say? (Do you have a link?)

I wonder... Is there a way to get access to the video feed?
Idea: Use a facial recognition library to issue commands through your PHP wrapper. Example: if I raise my hands then the drone must go up.
 

an3k

Active member
Joined
Dec 11, 2018
Messages
44
Reaction score
34
@ErikThiart I haven't written any flights yet. The evening before I got my Tello I got sick (two weeks ago) and I just got rid of it, thus I wasn't really in the mood or even able to do anything. And even though I'm familiar with PHP I probably will use Python. I'm not into "web" developing anymore and don't want to handle all the webserver, php, etc. stuff. Python is easier in that case.

A huge let down was when I noticed I can't control the drone as I could do with the app or a controller but have to wait for the drone to finish the command I just send before I could another command. I can't do what I want to do (flying forward AND descending AND rotating at the same time) even though it's technically possible and in fact very easy.
One idea I had was flying through the whole house and coming back to the starting point. Sure, it works with one command after another but it's too easy and really looks like a robot from the stoneage. Once you have all the communication stuff (send command, read response and react to it, etc.) you basically need a list of commands like takeoff,forward 54,ccw90,forward 30,down 30,etc.).

I also thought about 3d printing a charging station on which the powered on Tello sits (,gets charged) and waits for commands. When somebody rings the doorbell I could say "Ok Google, who's at the door" which then would trigger a script that tells the Tello to takeoff, check the front door, fly back to the charging station and landing on it. Using pattern recognition and that really nice horizontal stability it would be possible. But since the Tello overheats within 5 minutes without flying and is also powering off very fast it's not possible.

So in the end I probably just write a framework in Python and maybe PHP that works flawless with the regular Tello and Tello EDU.
 

ErikThiart

Member
Joined
Dec 22, 2018
Messages
21
Reaction score
6
Location
South Africa
Website
www.erikthiart.com
Thanks for the detailed reply @an3k I fully understand. I ran into the same stumble block with it being limited to single commands.

If you ever get the framework up and running I would love to test it (and use it).
 

New Threads

Members online

Forum statistics

Threads
2,778
Messages
21,838
Members
6,694
Latest member
Pabou