Programming the Ryze/DJI Tello with Python

in #python4 years ago

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()
Sort:  

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 :)

@makerhacks You have received a random upvote from @looktothefuture because this post did not use any bidbots.

If you use the the #nobidbot tag as one of your five tags on future posts, you may be selected for a random upvote from @transparencybot.

Coin Marketplace

STEEM 0.24
TRX 0.08
JST 0.040
BTC 28598.22
ETH 1729.70
USDT 1.00
SBD 2.49