GithubHelp home page GithubHelp logo

dji-sdk / tello-python Goto Github PK

View Code? Open in Web Editor NEW
1.3K 97.0 642.0 28.4 MB

This is a collection of python modules that interact with the Ryze Tello drone.

License: Other

Python 50.25% CMake 1.61% C++ 17.05% Shell 4.42% Batchfile 26.66%

tello-python's Introduction

Tello-Python

Introduction

This is a collection of python-based sample code that interact with the Ryze Tello drone.

Project Description

This toolkit contains three sample programs based on tello sdk and python2.7,including Single_Tello_Test, Tello_Video, and Tello_Video (With_Pose_Recognition). There is also a program file named tello_state.py.

  • Single_Tello_Test

In Single_Tello_Test,You can design a series of command combinations by writing a txt script to let tello execute a series of actions you have designed. This program can also be used as a command set test tool for tello.

  • Tello_Video

In Tello_Video,You can receive the video stream data from tello, decode the video through the h264 decoding library, and display it on a GUI interface based on Tkinter and PIL. In addition, it also supports a control panel that can operate tello. This sample code provides an example of receiving and processing and getting the correct video data. The source code of the h264 decoding library is also provided in the package, which can be used for your reference.

  • Tello_Video(With_Pose_Recognition)

Tello_Video_With_Pose_Recognition is an application version modified from Tello_Video.It uses the decoded video data,and everytime extract a single frame image for pose recognition operation , and binds the specific posture and aircraft control commands to realize the pose control of Tello.This code is mainly used as an application case for utilizing the decoded video data of tello for image processing.

  • Tello_state.py

Tello_state.py can read the various status data of tello, and can be used as a tool to debug and view the status of tello.

Environmental configuration

The sample codes above are based on python2.7.There is no need to install additional third-party libraries for running Single_Tello_Test and tello_state.py.For Tello_Video and Tello_Video (With_Pose_Recognition), you need to install a series of third-party libraries. Therefore, in these two folders, a one-click installation script (based on windows32/64, linux and macos) is provided, which can facilitate you with installing all relevant dependencies.

Specific to the content and description of each package, you can refer to the readme file in the related folder.

Contact Information

If you have any questions about this sample code and the installation, please feel free to contact me. You can communicate with me by sending e-mail to [email protected]. And recently we have committed a new FAQ file under the 'Tello-Python'.If you have any questions,you can firstly refer to it .

About Multi-Tello-Formation

Please refer to github repository https://github.com/TelloSDK/Multi-Tello-Formation. This is a python program that enable the function of multi-tello swarms.

tello-python's People

Contributors

hanker-lu avatar paoloc68 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tello-python's Issues

Moving to python3

Python 2.7 will soon be deprecated. Have you considered moving the project to python3?

Tello_state

I don't know why with me it did but, my tello just broke because of your script. tello_state.py has ripped it. If I start my tello now it immediately turns off again. Help would be nice.

Set speed

Hi! I'm trying to set speed by using command, e.g., send_command('speed 10'), and even though I receive back 'ok', the drone doesn't move (when I use other commands like send_command('up 20') I receive back 'ok' and actually it works). How can I solve this problem?
Moreover, the speed I set along which direction it works? There is the possibility to set only vertical velocity? (Without using go x y z speed command I mean)
Thank you

RuntimeError: cannot open context ("Tello instance has no attribute 'socket'")

python main.py [indeo3 @ 0x1360440] Invalid picture dimensions: 0 x 0! Traceback (most recent call last): File "main.py", line 14, in <module> main() File "main.py", line 7, in main drone = tello.Tello('', 8889) File "/home/martin/Schreibtisch/Tello-Python-master/Tello_Video_With_Pose_Recognition/tello.py", line 25, in __init__ self.decoder = libh264decoder.H264Decoder() RuntimeError: cannot open context Exception AttributeError: "Tello instance has no attribute 'socket'" in <bound method Tello.__del__ of <tello.Tello instance at 0x7f02518d68c0>> ignored
Any idea?

Thanks

Can't get Single_Tello_Test working with a Tello EDU

Hi, I'm unable to get the Single_Tello_Test working with my Tello EDU drone. This works fine with my older original Tello.

Here's the transcript:

clyde@fastr:~/projects/Tello-Python/Single_Tello_Test (master)$ python2 tello_test.py command.txt
sending command: command to 192.168.10.1
from ('192.168.10.1', 8889): ok
Done!!! sent command: command to 192.168.10.1
sending command: takeoff to 192.168.10.1
from ('192.168.10.1', 8889): error
Done!!! sent command: takeoff to 192.168.10.1
delay 5.0
sending command: land to 192.168.10.1
from ('192.168.10.1', 8889): error
Done!!! sent command: land to 192.168.10.1

id: 0
command: command
response: ok
start time: 2018-12-10 15:04:13.334845
end_time: 2018-12-10 15:04:13.382918
duration: 0.048073

id: 1
command: takeoff
response: error
start time: 2018-12-10 15:04:13.383024
end_time: 2018-12-10 15:04:13.433856
duration: 0.050832

id: 2
command: land
response: error
start time: 2018-12-10 15:04:18.439188
end_time: 2018-12-10 15:04:18.482665
duration: 0.043477

Thanks.

framework version 01.04.35.01

What version of the framework are you using?

I use the version 01.04.35.01 and the video does not work by the computer, only by the mobile app

Feature Request: Video Stream with Separate AP

The limitation is mentioned in the FAQ:

Q8:Can Tello EDU transmit video streams externally in station mode (send ap 'ssid' 'password' command for Tello EDU)?

A8:This feature is currently not supported.

Can this feature be added to the Firmware / SDK? It would make the EDU edition much more useful for may lab.

Currently, this limitation removes all benefits of having the EDU edition because I need live video from all drones in the swarm.

custom model

could I add my custom model such as object detection model(for example yolo)?
must these models be developed with caffe?

errors about video transmission on raspberrypi

runned in raspberrypi , python2.7 , environments descriped in ./linux_install.sh were installed.
Getting the following error.
error image

1.error while decoding MB 22 11, bytestream -12
2.non-existing pps 0 referenced
i think there something wrong with ffmpeg and libh264decoder. so how to fix it ?
appreciate for your help

Python 2.7 EOL

Hi,

Python 2.7 has reached its End Of Life. Its at least no longer supported. OpenCV won't install using pip (on a raspberry pi at least) even from the additional repository. Pip3 installs OpenCV (quite rightly) in a Python3 directory on a Raspberry Pi but that's incompatible for this code: "import cv2" fails as its in the wrong directory? I'm not sure if one could build OpenCV to make it compatible with Python2.7?

So, as far as I can see the best solution all round would be to port this code to Python 3 as others are saying please? I don't know how big a job that is though?

Cheers, WW.

there is no video from tello edu...

hi all could someone please help me? i use ubuntu 16.04

i open 11111

i copy Tello_Video to my file

install linux_install.sh

use the step from demend to compile h264decoder
(at this time libh264decoder.so show up in main.py file)

I type "python main.py" and it can run and can use keyboard to control

but there is no video GUI show up!! neither the snapshot
(snapshot will show opencv error but there is no error durring senting command in terminal)
(I confirm that there is no wrong with opencv because I install ROS and it will install opencv
and other things I need)

Please tell me how to solve it.....is there something step I forgot?

cannot control with keyboard

Hi guys,
I have installed everything and works as expected. I have video feed and I can make it takeoff and land with the buttons in the UI but I cannot make keyboard buttons works. It simply doesn't recognize them.
What can I do?

Tello_video is not working.

Is not able to include the package h264 even if is it in the correct folder, do you have any suggestion?

File "D:\Tello\Tello-Python-master\Tello-Python-master\Tello_Video\tello.py", line 5, in <module> import libh264decoder ImportError: DLL load failed: The specified module could not be found.

Tello_Video & Tello_Video_With_Pose_Recognition

Hi all,

I was trying out both Tello_Video & Tello_Video_With_Pose_Recognition packages in my Linux - ubuntu 16.04 LTS

At first, I installed Tello_Video with the one click install and it has successfully run, however, when i tries to install and run Tello_VIdeo_With_Pose_Recognition, it shows the following errors, and now it no longer runs again.

I have checked and I moved the 'libh264decoder.so' file into my python's site-packages file & /usr/lib/ , the above move was suggested by the internet. But still getting the error:

spark@spark:~/Downloads/Tello-Python-master/Tello_Video_With_Pose_Recognition$ python main.py

Traceback (most recent call last):
File "main.py", line 1, in
import tello
File "/home/spark/Downloads/Tello-Python-master/Tello_Video_With_Pose_Recognition/tello.py", line 5, in
import libh264decoder
ImportError: libavcodec.so.57: cannot open shared object file: No such file or directory

spark@spark:~/Downloads/Tello-Python-master/Tello_Video_With_Pose_Recognition$ cd ..
spark@spark:~/Downloads/Tello-Python-master$ cd Tello_Video

spark@spark:~/Downloads/Tello-Python-master/Tello_Video$ python main.py

Traceback (most recent call last):
File "main.py", line 1, in
import tello
File "/home/spark/Downloads/Tello-Python-master/Tello_Video/tello.py", line 5, in
import libh264decoder
ImportError: libavcodec.so.57: cannot open shared object file: No such file or directory
spark@spark:~/Downloads/Tello-Python-master/Tello_Video$ `

Any help will be greatly appreciated.

TypeError: __init__() should return None, not 'NoneType'

I'm Getting the following error while running main.py

Traceback (most recent call last):
File "main.py", line 14, in
main()
File "main.py", line 7, in main
drone = tello.Tello('', 8889)
File "/Users/vsvsvarma/Desktop/Tello-Python/Tello_Video/tello.py", line 25, in init
self.decoder = libh264decoder.H264Decoder()
TypeError: init() should return None, not 'NoneType'
Exception AttributeError: "Tello instance has no attribute 'socket'" in <bound method Tello.del of <tello.Tello instance at 0x1237d0d88>> ignored

snapshot not work

Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python27\lib\lib-tk\Tkinter.py", line 1541, in call
return self.func(*args)
File "D:\Desenvolvimento\tello\Tello-Python-master\Tello_Video\tello_control_ui.py", line 245, in takeSnapshot
cv2.imwrite(p, cv2.cvtColor(self.frame, cv2.COLOR_RGB2BGR))
error: OpenCV(3.4.3) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:181: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

Error when Snapshot (Ubuntu 18.04)

I follow the steps but failed to take snapshot. I try every method but it don't work. Thx for help.

Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1550, in call
return self.func(*args)
File "/home/sxt17/Desktop/Tello-Python/Tello_Video/tello_control_ui.py", line 245, in takeSnapshot
cv2.imwrite(p, cv2.cvtColor(self.frame, cv2.COLOR_RGB2BGR))
error: OpenCV(4.1.1) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

How do I switch to camera mode to get 5 million pixel images?

Hi, I'm working on a project where I want to use a python script, run from a computer, to command my drone to fly around and take pictures. But the image I got from the video mode is 960*720.
How do I switch to camera mode to get 5 million pixel images?

Tello drone shuts down when idle

Hi,

I have my Tello drone sitting idle on my desk and it shuts down after about 4 minutes.
This happens consistently.

Does anyone know if this is a common issue? Is it due to overheating of the downward-facing sensors that are close to the table surface?

AirSim Support with unity or unreal engine python control

so I am having trouble with using airsim with tellopy. I am am getting an error
Traceback (most recent call last):

File "", line 1, in
runfile('C:/Users/fahre/Desktop/dronecontrol.py', wdir='C:/Users/fahre/Desktop')

File "C:\ProgramData\Anaconda2\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)

File "C:\ProgramData\Anaconda2\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 95, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)

File "C:/Users/fahre/Desktop/dronecontrol.py", line 73, in
tellodrone = tellopy.Tello()

File "C:\ProgramData\Anaconda2\lib\site-packages\tellopy_internal\tello.py", line 91, in init
self.sock.bind(('', self.port))

File "C:\ProgramData\Anaconda2\lib\socket.py", line 228, in meth
return getattr(self._sock,name)(*args)

error: [Errno 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted

Tello_Video main.py does not render video feed MacOS High Sierra

Hi there, I have installed the project successfully using the ./install.sh script.

files in Tello_Video:

LICENSE.md		__pycache__		h264decoder		install			main.py			tello.pyc		tello_control_ui.pyc
README.md		get-pip.py		img			libh264decoder.so	tello.py		tello_control_ui.py	venv
python main.py 
sent: command
sent: streamon

screen shot 2019-02-09 at 8 24 46 am

screen shot 2019-02-09 at 8 24 53 am

when I run main.py the control window opens fine but no video feed appears.

Tello SDK cannot go move after take off

Hi, the I am using this sdk for my newly bought tello. The video feed is fine, the take off and landing command works, and the rotate cw and ccw command works "Response: ok". However, when I send the any other commands (forward, backward, left, right etc) the command always return a "Response: Out of Range", and consequently my Tello can only take off, rotate on the spot, and land....

But it shouldn't be a connection issue, as it can recognize the rotate, take off and landing perfectly.

And the drone works perfectly well on my tello app in all aspects (if this info helps)

A example of the command from the tello.py file that does not work is this

def move_backward(self, distance):
    """Moves backward for a distance.

    See comments for Tello.move().

    Args:
        distance (int): Distance to move.

    Returns:
        str: Response from Tello, 'OK' or 'FALSE'.

    """

    return self.move('back', distance)

I didnt change the code, so it is as it originally was.

Anyone has any idea whats the issue :( its been bugging me. Any help will be appreciated!

Setting up in installation

I have followed the following steps:

Mac

Make sure you have the latest Xcode command line tools installed. If not, you might need to update your OS X and XCode to the latest version in order to compile the h264 decoder module
Go to the "install\Mac" folder folder in command line, run
chmod a+x ./mac_install.sh
./mac_install.sh

However, my installation said:

Configuring incomplete, errors occurred!
See also ''User/hkpc/downloads/Tello-Python-master/Tello_Video/h264decoder/build/CMakeFiles/CMakeOutput.log''.
make: *** No targets specified and no makefile found. Stop.
cp: libh264decoder.so: No such file or directory
Compilation and Installation Done!

Can I know what am I missing and how to fix this?

cv::dnn::ReadProtoFromTextFile

Hi, I got this error to run .\Tello_Video_With_Pose_Recognition\main.py after running the .\Tello_Video_With_Pose_Recognition\tello_pose.py

cv2.error: OpenCV(3.4.2) C:\projects\opencv-python\opencv\modules\dnn\src\caffe\caffe_io.cpp:1121: error: (-2:Unspecified error) FAILED: fs.is_open(). Can't open "model/pose/mpi/pose_iter_160000.caffemodel" in function 'cv::dnn::ReadProtoFromTextFile'

Can you help me?

Pose recognition doesn't work

Hi!
I'm attempting to use pose recognition, but when i run the main project and i switch on the pose recognition, the joints' skeleton of my body doesn't appear. I've downloaded the model and followed instructions written in the readme. Any solution?

Tello_Video & Tello_Video_With_Pose_Recognition #41

Hi all,

I was trying out both Tello_Video & Tello_Video_With_Pose_Recognition packages in my Mac Os catalina
At first, I installed Tello_Video with the one click install and it not work. still getting the error:

CMake Error at /usr/local/lib/cmake/Boost-1.71.0/BoostConfig.cmake:117 (find_package):
Could not find a package configuration file provided by "boost_python"
(requested version 1.71.0) with any of the following names:

boost_pythonConfig.cmake
boost_python-config.cmake

Add the installation prefix of "boost_python" to CMAKE_PREFIX_PATH or set
"boost_python_DIR" to a directory containing one of the above files. If
"boost_python" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
/usr/local/lib/cmake/Boost-1.71.0/BoostConfig.cmake:182 (boost_find_component)
/usr/local/Cellar/cmake/3.15.4/share/cmake/Modules/FindBoost.cmake:443 (find_package)
CMakeLists.txt:12 (find_package)

-- Configuring incomplete, errors occurred!
See also "/Tello_Video/h264decoder/build/CMakeFiles/CMakeOutput.log".

Any help will be greatly appreciated.

How to get video with separate AP

Hello,

I am trying to use this SDK with a Tello EDU connected to a separate AP, but the video socket bound to port 1111 never seems to get any data.

The receive socket bound to 8889 is able to get responses, and I can send commands without issue.

This is my code:

import time
from tello import Tello

drone = Tello('', 8889, tello_ip='192.168.2.108')

drone.send_command('battery?')
time.sleep(0.5)
print(drone.get_response()) # 72

frame = None
while frame is None:
    frame = drone.read()
    print(frame) # None
    time.sleep(0.5)
    

print(frame)

drone.read() always returns None when connected to the external AP, but it works fine and returns data when the Tello is acting as its own hotspot.

Should video feed to work with a separate AP? Is it a limitation of the SDK, or a configuration error on my end?

Edit:
My question is in the FAQ:

Q8:Can Tello EDU transmit video streams externally in station mode (send ap 'ssid' 'password' command for Tello EDU)?

A8:This feature is currently not supported.

Python 3

Is their a python 3 SDK that can be downloaded for the Tello Drone?

Error when taking snapshot - `Exception in Tkinter callback`

Error log:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1536, in __call__
    return self.func(*args)
  File "/Users/jimipedros/git/Tello-Python/Tello_Video/tello_control_ui.py", line 245, in takeSnapshot
    cv2.imwrite(p, cv2.cvtColor(self.frame, cv2.COLOR_RGB2BGR))
error: OpenCV(4.0.0) /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/color.cpp:181: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.