Programming the Ryze/DJI Tello with Python

in python •  last year 

Did you see my post on Python and UDP?

Well, it turns out that is exactly how you can communicate with the DJI Tello drone, programatically!

Use the official list of commands and the following code

https://dl-cdn.ryzerobotics.com/downloads/tello/0228/Tello+SDK+Readme.pdf

import socket

tello = ("192.168.10.1", 8889)

# create our udp socket
try:
    socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
except socket.error:
    print("Oops, something went wrong connecting the socket")
    exit()

while 1:
    message = input("> ")

    # encode the message
    message = message.encode()

    try:
        # send the message
        socket.sendto(message, tello)

        # output the response (if any)
        data, ip = socket.recvfrom(1024)

        print("{}: {}".format(ip, data.decode()))

    except socket.error:
        print("Error! {}".format(socket.error))
        exit()
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

So did you actually fly your drone from the above app?

Not very well but yes. I will do an update using the controller code from previous articles :)