Connecting Tello Drone to Python

I would like more information on:

The process of sending and receiving UDP messages to Tello or the simulated Tello on the computer. I have tried the instructions in the Droneblocks modules, but have not been completely successfull. For example, one time I got the following message - “Package Sender attempted (and failed) to bind to port 8889.”

Other times I have been unsuccessful at sending a message to simulated Tello - message not showing up in Packet Sender. Not receiving string command.

Any suggestions?

One thing to double-check is when you have Tello simulated in Python it will start listening on port 8889 as specified here in this script:

You can certainly change that to any port you’d like. When you fire up Packet Sender there’s a good chance it’s trying to bind to this port as well (8889). But you don’t want to do that. You can turn off Packet Sender binding in the settings. That way Packet Sender will only be in client mode where you can send from Packet Sender to port 8889 (Python).

Please let us know if anything is unclear or you need clarification. Thanks.

Yes, I need clarification.

  1. the DroneBlocks instructional videos indicate to check Enable UPD Servers in PacketSender. How, they already come checked as a default setting. When you indicate “You can turn off Packet Sender in the settings”, what are you refering to? Where in settings?
  2. Your comment that I “don’t want to” bind to part 8889 seems to contradict the guidance in the DroneBlocks instrutional video, unless I am misunderstanding.

The furthest that I have gotten in following the DroneBlocks instructional video on Python is that I successfully ran the part of the UDPSender script that printed out - “Message Sent!” I have not been able to get further. PacketSender is not recognizing the Run of my script. There is no connection there.

On another subject, although I am obviously able to bring up Jupiter notebook and work with it, Jupiter notebook is not showing up in my Windows Terminal (Command prompt). Where would i find it there?

Sorry if my message was unclear. Our curriculum is centered around the Python code interfacing with Tello, which is a different “computer” with a different IP address. When you run Packet Sender and the Python simulator on the same computer it adds complexity due to port limitations. I’m going to post a screenshot of my setup and explain what is going on:

I have Packet Sender sending to port 8889 on localhost, which is the script running the Python simulator. Then I have Packet Sender listening (running a UDP Server) on 9000. When you send a message to the simulator on port 8889 it will see the message coming from port 9000 (Packet Sender) and the simulator will send “OK” back to Packet Sender on that port.

In my screen example I’m sending the “takeoff” command from Packet Sender to the simulator on 127.0.0.1, port 8889. In the right hand side of the screen you’ll see Python receive the message and print the IP and port of where the message came from.

I hope this helps. Please let me know if I can provide any further clarification.

Where do I input ‘9000’ for a port? How do I “have Packet Sender listening (running a UDP Server) on 9000”? Is 127.0.0.1 your local wireless IPv Address? What does your Python script look like for your sample in the email below (‘127.0.0.1’, 8889?)? I have still not succeeded (even using your numbers).
in sending a message (using UDP) to the simulated Tello. Any suggestions?

Here are images associated with my (so far) unsucessful efforts to send UDP messages to simulated Tello:

I think I see the problem and a video would explain it best. I’ll put one together tomorrow and post it here.

Here is a video explaining how to communicate with the Tello Python simulator and Packet Sender:

I hope this helps. If not, please let us know!

Thank you. With help from this instructional video, I did succeed in sending (via UDP) a packet from port 8889 (simulated-tello script) to port 9000 (Packet-Sender)

image

However, my Windows powershell does not look at all like the one in the instructional video. How do I get the powershell so that I can input the commands in the instructional video?

In the video I’m using Windows Terminal:

But PowerShell should be fine. You’ll need to clone the repository and then change into the directory with the simulator.py script. You can then run it with:

python simulator.py

You’ll need to learn some of the commands to navigate the file system. The main one is cd (change directory)

This article talks about many of the commands available in powershell:

But once again cd will be the most important for what you’re trying to do.

Thank you. I’ll take a look. I’ve been using Windows 11 - I wonder if that accounts for any difficulty that i’ve had sending a packet from Tello-simulator to Packet Sender…

When you indicate “You’ll need to clone the repository and then change into the directory with the simulator.py script” - do you mean download the repository and open up the Tello-Simulator file (Notepad - PY File)?
(I downloaded the ZIP file at the GitHub repository - I think that that is what you mean by clone)

I have made some progress in the Python curriculum: I got through Lesson 2. However, I was not able to successfully achieve the tasks for Lesson 3 - sending and receiving message between the Python script & the Tello drone (with the Packet Sender CLOSED). I am attaching some images:


So, I was wondering why?

image

Here is an update: I have managed to Send & Receive UDP message from my Python script to Tello Drone - per the instructions in Lesson 3 (see image below):
image
Progress marches on! (thank you for your consideration)

Although I have made progress in the online curriculum, I am unsure when/where I would type in ‘python simulator.py’ in Windows Powershell. For example, I tried in the example (image) below, but was not sucessful:


Anyways, I think that I can just open the Tello-simulator file in Anaconda Jupyter Notebook instead. Correct?

And, some related to this, here (below) is an image of the Jupyter Notebook terminal. It seems to be ‘stuck’ (not allowing me to type any commands).


How do I change this mode so that I can input commands into the terminal?

Hi @mwkappas

My name is Pat Ryan and I am in the instructor for some of the other DroneBlocks Python courses.

In those courses we leverage an open source package called, DJITelloPy

The GitHub repo can be found here.

The Tello class in the above package, handles all of the communication between the Tello and provides a nice Python API for us to program to. You can either use the high level methods, or you can send the low level SDK commands if you don’t find what you are looking for in the API.

There is a quick example script.

from djitellopy import Tello
import time

"""
* Using DJITelloPy package and Tello class.

"""

if __name__ == '__main__':

    print("Create Tello object")
    tello = Tello()

    print("Connect to Tello Drone")
    tello.connect()

    battery_level = tello.get_battery()
    print(f"Battery Life Percentage: {battery_level}")

    print("Takeoff!")
    tello.takeoff()

    print("Sleep for 5 seconds")
    time.sleep(5)

    print("landing")
    tello.land()
    print("touchdown.... goodbye")

I hope that helps but if you still have questions please let me know.

Does

replace
https://github.com/youngsoul/tello-adv-setup
(which is referenced in Lesson 1 but is not available on the world wide web)?

Hi @mwkappas

I am sorry for the confusion.

First, no the tello-adv-setup repository uses the DJITelloPy class from Damiafuentes to interface with the Tello drone.

Second, for the repo you are looking for.

The GitHub - youngsoul/tello-adv-setup: Tello Advance Setup was used initially but we moved the code to a droneblocks repo. I thought we mentioned that somewhere but I will have to look. The code you want is in:

I have added a note and a link in the youngsoul/tello-adv-setup repo to direct people to the dbaldwin/tello-adv-setup.

Please let me know if you have any other questions.

Thanks
Pat

On another subject, does this image indicate that my computer has (the proper) Python programming language installed on it?: