Windows-Environment-Advanced Tello Program with Python 3 and Open CV Lesson 4

Thank you for providing these lessons, Mr. Ryan!
Question #1: I use Anaconda’s Spyder for writing and executing Python code. It seems to work OK while running tello_camera_no and tello_camera Should I be using the virtual environment for Windows as described in the lesson?

Question #2:
Students who try to close the program without hitting ESC and succeed will encounter WinError 10048 [ One usage of each socket address is normally permitted]. I find only a shutdown of their laptop clears the socket. Any comments to handle recovery from this situation? Thank You!

Let me address #1 and I’ll touch base with @pat.ryan regarding #2.

I generally prefer working in virtual environments and it lets me keep my Python drone coding projects isolated from one another. All dependencies for a project are stored within that virtual environment and don’t interfere with my other projects.

It also makes it easier to manage certain versions of packages. For example, you may have an OpenCV version that you need for one project, but a different version for another. If you install this at the system level (outside of your venv) it sometimes becomes a pain to uninstall a package and install a different one. Prior to using virtual environments this was a real problem for me.

It’s not the end of the world if you don’t use a virtual environment, but we do encourage it especially if your students will be working on multiple projects.

I hope this helps and please don’t hesitate to reach out with any other questions. Best of luck with coding your Tello drones!

Hi @mikejp

In the original implementation of the we were using processing, pipes and sockets. We changed that implementation to use a single process with a threading model.

I spoke with @dbaldwin and we merged the threading version into this course GitHub repo. If you get a chance can you try the latest version and see if that works better for you.

Thanks for pointing this out!

Just FYI here is the pull request if you want to see the changes that Pat implemented.

Updated to latest version and removed LOGGER.debug for simple print in by youngsoul · Pull Request #1 · dbaldwin/tello-adv-setup (

Hi David,
I uploaded dbaldwin/tello-adv-setup and ran on a Tello Talent. Once it worked as expected. I no longer get a WIN_ERROR, Thanks for solving that. But now I get an image error which makes the application unresponsive. The drone just takes off and lands shortly. Even after takeoff, the python script is totally unresponsive to keyboard entry. I was able to run tello_camera_no_fly and 01_takeoff-land with no issues. Thanks for your assistance!

I’ll run a test in the next day or two and see what I can find out. In the meantime if you comment these lines out:

Are you able to fly around with your keyboard? Pat does make mention of the script freezing although I would expect that you would have keyboard input:

I run a test where I commented out lines 25 & 26. Keyboard input still fails. The error printed to the screen is “error while decoding MB”. Strange!

I just ran the code with no issues. I was able to launch, see the camera feed, and control Tello with my keyboard (WASD and some other keys). Can you share more about your setup? Are you still trying this from an IDE like you mentioned earlier? I believe it was Spyder that you were trying to use.

Also, I want to make sure it’s clear that you’re trying to issue the keyboard commands in the video window that has focus and not directly in your script. Sometimes that will get me. What happens should be the following:

  1. You connect to Tello and then run the Python script

  2. A video feed window opens and it needs to have focus (be at the foreground)

  3. Issue WASD commands with the video window in focus. This is what receives keyboard input and commands Tello.

If that doesn’t help then let us know. Surely we can help you get to the bottom of this!

In trying again, I experienced a “No valid IMU” error. I am following the imu calibration script. on the Tello app. I successfully do steps 1-3 ( propellers off but not the guards). Then the drone drops connection to the internet and I am forced to redo the calibration. I can’t seem to get past step 3. Any suggestions please. Thanks!

How long would you generally say you’re into the process (step 3) when it disconnects? Also, does it jus drop the connection or does the drone power off? If it’s the latter I wonder if Tello has overheated, which is not uncommon when it’s sitting on a desk for a while. If that’s the case perhaps a fan would help just to get through the calibration. If you watch this tutorial it makes mention of contacting DJI support if calibration fails several times:

Sorry you’re having to deal with all this! Keep us posted as I’d really like to know what’s going on here.

I got the calibration working today. Ran with dbaldwin/tello-adv-setup(github,com) with no issues using both spyder and anaconda prompt. Thanks for your assistance!

Hi, i have similar problems. I callibrated the drone multiple times.
Each time i run a script that contains movement/rotation, i got a error message “error No valid imu”.
I did the callibration exactly it i shown in the video… still no change. What did you change in your callibration process? Or how did you fix the problem?