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

Streaming Video from Tello and Tello EDU Drones with Python

frequency

Active member
Joined
Apr 18, 2019
Messages
30
Reaction score
10
Dear All,

Anyone tried Stream video out from Tello???



I received below error:


Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
======= RESTART: D:\2019\Tello\Tello-Python-master\Tello_Video\main.py =======
Traceback (most recent call last):
File "D:\2019\Tello\Tello-Python-master\Tello_Video\main.py", line 1, in <module>
import tello
File "D:\2019\Tello\Tello-Python-master\Tello_Video\tello.py", line 4, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
>>>


Thanks
frequency
 
Last edited:

seajay

Member
Joined
Jan 31, 2019
Messages
13
Reaction score
3
You are missing a (well-known) python math library (numpy).

The github package has a Windows installer that you did not run (or got errors running).

Looks like you might be new to python. I suggest a tutorial that introduces you to things like 'pip' and library/dependency management in python.

If you are a python developer, my apologies; the video poster would like you to post issues to his github repo if you cannot use the code.
 

frequency

Active member
Joined
Apr 18, 2019
Messages
30
Reaction score
10
Dear Seajay,

Thank for your fast reply.

I followed the video and installed below both Install.bat and Install_manual.bat for windows:

Hence I don't understand which steps I am missing.

OR did i need to install below except homebrew??

Please guide me!

Thanks

frequency
 
Last edited:

seajay

Member
Joined
Jan 31, 2019
Messages
13
Reaction score
3
Looks like you should only need to run one of the files.

The install.bat file is used when you do not have python27 on your computer. It goes out and gets it, and then gets all of the dependencies.

install_manual.bat appears to be used when you already have python27 installed. This might be tricky if you are not using the directory structure they assume.

Providing guidance is tricky (almost impossible), as lots of things can get weird with python on windows, and we can't see logs/outputs from your work to see what went wrong.

Some advice:
1) This thread should be moved to Tello Development if you must keep it here
2) You might want to uninstall everything and use the dji-sdk/Tello-Python project, as they updated it 3 months ago, and dbaldwin's project was forked 6 months ago. Some major changes seem to have happened there.
 

frequency

Active member
Joined
Apr 18, 2019
Messages
30
Reaction score
10
Looks like you should only need to run one of the files.

The install.bat file is used when you do not have python27 on your computer. It goes out and gets it, and then gets all of the dependencies.

install_manual.bat appears to be used when you already have python27 installed. This might be tricky if you are not using the directory structure they assume.

Providing guidance is tricky (almost impossible), as lots of things can get weird with python on windows, and we can't see logs/outputs from your work to see what went wrong.

Some advice:
1) This thread should be moved to Tello Development if you must keep it here
2) You might want to uninstall everything and use the dji-sdk/Tello-Python project, as they updated it 3 months ago, and dbaldwin's project was forked 6 months ago. Some major changes seem to have happened there.

Dear Seajay,

Thank you very much for your advice!

i will take note on the 1st point next time. thks.

I am using Python 3.7.3 does this affect the installation?

Cheers,
frequency
 
Last edited:

seajay

Member
Joined
Jan 31, 2019
Messages
13
Reaction score
3
Yes, it makes it near bloody impossible! Huge syntactic differences between v2x and v3x, it could take months to get that stuff running on python3.

The installer might be allowing side-by-side python installs (not sure I have ever tried it on windows), so you have to make sure your paths all point at the right place(s) when you run your 2.7x stuff, otherwise you get crosstalk and NO python happens...
 

frequency

Active member
Joined
Apr 18, 2019
Messages
30
Reaction score
10
Yes, it makes it near bloody impossible! Huge syntactic differences between v2x and v3x, it could take months to get that stuff running on python3.

The installer might be allowing side-by-side python installs (not sure I have ever tried it on windows), so you have to make sure your paths all point at the right place(s) when you run your 2.7x stuff, otherwise you get crosstalk and NO python happens...
Hi,

Thanks. In the mean time, I will use another laptop to install their install. Bat with py 2.7.

My current laptop with 3.7 is for swarming therefore I wouldn't want to touch them.

I will let u know the result. Thks thks

Best Regards.,
frequency
 
Last edited:

Walleye

Well-known member
Joined
Mar 7, 2019
Messages
86
Reaction score
21
You are missing a (well-known) python math library (numpy).

The github package has a Windows installer that you did not run (or got errors running).

Looks like you might be new to python. I suggest a tutorial that introduces you to things like 'pip' and library/dependency management in python.

If you are a python developer, my apologies; the video poster would like you to post issues to his github repo if you cannot use the code.
Hello Seajay,
Where might I find the tutorial that you mentioned to learn about ‘pip’ and library/dependency management in Python?
Thanks!
W
 

nodecaf

Member
Joined
Apr 7, 2019
Messages
24
Reaction score
25
Location
Melbourne, Australia
Evening,
I became curious myself how you get this working, and have to admit the instructions were rather unclear. Perhaps I can help by sharing what I've learned.
The install script is flaky/unreliable, it even says so in the install notes (TelloPython_FAQ.txt), and you must probably install it manually.

I will assume you have a 64-bit windows (you do if you have win10/computer from the last 5 years)
1) Install pyton 2.7 64-bit first https://www.python.org/ftp/python/2.7.16/python-2.7.16.amd64.msi
Reboot after installation as requested. The latest version comes with pip, so don't worry about that.

2) Download and unzip the Tello git repo dji-sdk/Tello-Python

3) Open command prompt (cmd.exe) and do the following pip installs (pip is included in latest python), just type each python commands (your computer must be connected to the internet)
python -m pip install numpy
python -m pip install matplotlib
python -m pip install -v opencv-python==3.4.2.17
python -m pip install pillow

3) Inside the git repo (zip file), there is another x64 library file: tello-python-master\tello_video_dll(ForWin64).zip file, open it and go into the tello_video_dll and copy all files except vcredist_x64 into the C:\Python27\Lib\site-packages folder.

4) Execute (double click) the vcredist_x64.exe file and install the vc distributable.

Now, fire up your tello, connect to the tello wifi when it becomes available, open up cmd (command prompt) and go into the tello-python-master\tello_video and type: python main.py

That's it! You should now see the tello camera and control window pop up!

Fly Safe - NoDecaf
 

frequency

Active member
Joined
Apr 18, 2019
Messages
30
Reaction score
10
Evening,
I became curious myself how you get this working, and have to admit the instructions were rather unclear. Perhaps I can help by sharing what I've learned.
The install script is flaky/unreliable, it even says so in the install notes (TelloPython_FAQ.txt), and you must probably install it manually.

I will assume you have a 64-bit windows (you do if you have win10/computer from the last 5 years)
1) Install pyton 2.7 64-bit first https://www.python.org/ftp/python/2.7.16/python-2.7.16.amd64.msi
Reboot after installation as requested. The latest version comes with pip, so don't worry about that.

2) Download and unzip the Tello git repo dji-sdk/Tello-Python

3) Open command prompt (cmd.exe) and do the following pip installs (pip is included in latest python), just type each python commands (your computer must be connected to the internet)
python -m pip install numpy
python -m pip install matplotlib
python -m pip install -v opencv-python==3.4.2.17
python -m pip install pillow

3) Inside the git repo (zip file), there is another x64 library file: tello-python-master\tello_video_dll(ForWin64).zip file, open it and go into the tello_video_dll and copy all files except vcredist_x64 into the C:\Python27\Lib\site-packages folder.

4) Execute (double click) the vcredist_x64.exe file and install the vc distributable.

Now, fire up your tello, connect to the tello wifi when it becomes available, open up cmd (command prompt) and go into the tello-python-master\tello_video and type: python main.py

That's it! You should now see the tello camera and control window pop up!

Fly Safe - NoDecaf
Dear Nodecaf,

I think you are my Avengers (who protected us) LOLLLLLL!!!!!!!! I totally agree with you that the instructions were rather unclear by the provider in GitHub!

I wanted to lean and try it myself(as a novice). As it was fun, hence when I get my hand dirty this will make me lean the stuff inside out.

Tello is the tiniest drone in DJI family but if anyone is going to dig in and lean out of it, it will be real fun to know the science behind.

It is very difficult to have someone sharing such information with me. On the other hand, it maybe a commercial value to someone.
With the vast internet resources availability nowadays, it's very fulfilling. I am so GRATEFUL that you guys care and share!

I will try Seajay and your advice, please wait for my ans.

I hope you guys have a good weekend.

THANK YOU and Appreciated!!!

Best Regards,
frequency
 
Last edited:

frequency

Active member
Joined
Apr 18, 2019
Messages
30
Reaction score
10
Dear Nodecaf,

It work!!!!

Thanks you and Appreciated !

Best Regards,
frequency
 
Last edited:
  • Like
Reactions: nodecaf

frequency

Active member
Joined
Apr 18, 2019
Messages
30
Reaction score
10
Dear nodecaf,

Does the keyboard command work for you?

For my, it cant control the drone?. So I have to use scratch to join in for the direction flying.

Best Regards,
frequency
 

nodecaf

Member
Joined
Apr 7, 2019
Messages
24
Reaction score
25
Location
Melbourne, Australia
Dear nodecaf,

Does the keyboard command work for you?

For my, it cant control the drone?. So I have to use scratch to join in for the direction flying.

Best Regards,
frequency
@frequency ,
no, I did test again, and found that while the camera worked, the only commands aside from taking off and landing that worked were rotate (cw/ccw).

I obviously could not let that rest unresolved. I found that there is a bug(s) in the script where the move commands don't check what the distance scale/slider value in the GUI is set to, and always use the default of 0.1, which is too short and you'll receive an out of range responds is the minimum.

To fix the problem, in the tello_control_ui.py file, e.g. for the ascend command (W), find this section of code (line 313)

def on_keypress_w(self, event):
print "up %d m" % self.distance
self.telloUp(self.distance)


and update the last line to check the value of the distance bar instead of referring to the fixed self.distance:

self.telloUp(self.distance_bar.get())

This will need to be done for the other move commands as well, however, if you just want to quickly test, you can just update the self.distance on line 32 to 0.2 or bigger.

I found when trouble shooting these scripts it is handy to uncomment the print out the return of the commands from the tello in the tello.py line 87. This is how I saw the tello was returning out of range always:

print(self.response)

Hope it helps!

Fly Safe - NoDecaf
 

frequency

Active member
Joined
Apr 18, 2019
Messages
30
Reaction score
10
@frequency ,
no, I did test again, and found that while the camera worked, the only commands aside from taking off and landing that worked were rotate (cw/ccw).

I obviously could not let that rest unresolved. I found that there is a bug(s) in the script where the move commands don't check what the distance scale/slider value in the GUI is set to, and always use the default of 0.1, which is too short and you'll receive an out of range responds is the minimum.

To fix the problem, in the tello_control_ui.py file, e.g. for the ascend command (W), find this section of code (line 313)

def on_keypress_w(self, event):
print "up %d m" % self.distance
self.telloUp(self.distance)


and update the last line to check the value of the distance bar instead of referring to the fixed self.distance:

self.telloUp(self.distance_bar.get())

This will need to be done for the other move commands as well, however, if you just want to quickly test, you can just update the self.distance on line 32 to 0.2 or bigger.

I found when trouble shooting these scripts it is handy to uncomment the print out the return of the commands from the tello in the tello.py line 87. This is how I saw the tello was returning out of range always:

print(self.response)

Hope it helps!

Fly Safe - NoDecaf
Dear NoDecaf,

It's works!!!!!!!

Question

What is the function of the red circle (Compiled python file) file?

3926

2nd)


I have remove the # to let print(self.response) work

Thanks and best regards,
Frequency
 
Last edited:
  • Like
Reactions: nodecaf

nodecaf

Member
Joined
Apr 7, 2019
Messages
24
Reaction score
25
Location
Melbourne, Australia
@frequency ,
1) Yeah, that looks right. Try it and see what happens!

"If I change the py file will the red circle (Compiled python file) effected???"

They should not. The .py files are the human readable scripts (~english), however, this means when the computer runs them it has to be translated into computer language (bytecode), which takes a little bit of time each time. Python can be translated (compiled) beforehand, which saves time each time you run the script, these are the .pyc files. Sometimes these compiled files are called "binaries".

For our use here, it is probably not worth doing, but I noticed I got them as well, maybe python does it automatically. On the command line, make sure you use "python main.py" to ensure you use the scripts and not the old binaries (compiled files).
==================
UPDATE:
Apparently python creates these files automatically first time you run a new/modifed script:


How do I create a .pyc file?
Python automatically compiles your script to compiled code, so called byte code, before running it.
When a module is imported for the first time, or when the source is more recent than the current compiled file, a .pyc file containing the compiled code will usually be created in the same directory as the .py file. When you run the program next time, Python uses this file to skip the compilation step.



==================
Let us know if you got it working!

Fly Safe - NoDecaf
 
Last edited:

frequency

Active member
Joined
Apr 18, 2019
Messages
30
Reaction score
10
@frequency ,
1) Yeah, that looks right. Try it and see what happens!

"If I change the py file will the red circle (Compiled python file) effected???"

They should not. The .py files are the human readable scripts (~english), however, this means when the computer runs them it has to be translated into computer language (bytecode), which takes a little bit of time each time. Python can be translated (compiled) beforehand, which saves time each time you run the script, these are the .pyc files. Sometimes these compiled files are called "binaries".

For our use here, it is probably not worth doing, but I noticed I got them as well, maybe python does it automatically. On the command line, make sure you use "python main.py" to ensure you use the scripts and not the old binaries (compiled files).
==================
UPDATE:
Apparently python creates these files automatically first time you run a new/modifed script:


How do I create a .pyc file?
Python automatically compiles your script to compiled code, so called byte code, before running it.
When a module is imported for the first time, or when the source is more recent than the current compiled file, a .pyc file containing the compiled code will usually be created in the same directory as the .py file. When you run the program next time, Python uses this file to skip the compilation step.



==================
Let us know if you got it working!

Fly Safe - NoDecaf

Dear Nodecaf,

I go it all work and with your help.

REALLY APPRECIATED!!!!!!!!!!!!!!!!!!!! AND thousand of thanks.!

I saw another file using Tello_Video_With_Pose_Recognition. I will try later.

Anyway I have bother you a lot LOLLLLLL

Hey have a good rest and pls take care do let me know if you coming to Singapore!!

Best Regards,
frequency
 

New Threads

Members online

Forum statistics

Threads
3,233
Messages
25,007
Members
8,333
Latest member
Just8Will