New DroneBlocks Course with Python and OpenCV from Pat Ryan

We’re excited to announce course #1 of a 3 course series that showcases using OpenCV with Tello’s camera. Thanks to Pat Ryan for putting this together and doing a great job of diving into Python 3, Jupyter Notebooks, DJITelloPy, and OpenCV. Be sure to check out the preview lesson to see what’s in the course:

2 Likes

@trinalin check out the section in the course that shows using a Jupyter Notebook to control Tello. Maybe that’s an option to get around not having command line access on your PCs. Obviously you’ll need some level of access to get the software installed, but after that you should be good!

Hello, @dbaldwin. I hope all is well. I actually started the course. I get the following error in Jupyter Notebook when I try to execute the line of code in the picture. I didn’t get any errors in Terminal when I ran the “from djitellopy import Tello” in the python environment. Do you have any ideas of what can be causing this error? Thank you for any assitance.

That’s really strange. I just fired up my virtual environment and didn’t have any problems. One thing that comes to mind is whether or not you were in your virtual environment when you installed djitellopy? Meaning did you start the venv and then use pip like here:

tello-adv-setup/setup.py at master · dbaldwin/tello-adv-setup (github.com)

Also, are you on Mac or PC? If you can share more details we’ll get this figured out. Thanks for bringing this to our attention.

Thanks for getting back to me so quickly @dbaldwin. I started the whole process over and followed Lessons 1and 2 step by step. I was in my virtual environment when I when I installed djitellopy. I am using an iMac. When I look for the djitellopy directory it is in “tello_projects/tello-adv-setup-master/venv/lib/python3.8/site-packages/”. It seems as if the Jupyter Notebook that I created is working out of “tello_projects/tello-adv-setup-master” directory. Is it possible that Jupyter Notebook is not seeing the djitellopy directory because it’s not on the same level that the Jupyter Notebook is on?


@dbaldwin, I did a little more research and added the 2 lines before the “from djitellopy import Tello” and I no longer get the error.

Nice find…and I’m glad to hear it’s working. But this shouldn’t be necessary unless we’re overlooking something. When you get a chance can you activate your virtual environment (source venv/bin/activate) and then type which jupyter, does that give you the path to jupyter in your current virtual environment? It will look something like

[your_home_directory]/tello_projects/tello-adv-setup-master/venv/bin/jupyter

Or does it show jupyter’s path to somewhere else? You obviously have enough technical knowledge to figure this out, but I’m afraid others will hit a roadblock!

Thanks.

1 Like

@dbaldwin, thanks for the vote of confidence. I’m just good at Googling some times. LOL. So, Jupyter is not running from that directory. it is running from [my_home_directory]/opt/anaconda3/bin/jupyter. I had Jupyter as part of the Anaconda package before taking this course. Is that what’s causing the problem? If so, would I have to delete the Jupyter Notebook that was installed via Anaconda?

Now we’re making progress! No…the beauty of virtual environments is that all the python libraries installed in that environment are isolated and should not impact anything already installed on your system. When you activate the environment you then run the setup script, which installs Jupyter in your virtual environment as you can see specified here:

tello-adv-setup/setup.py at master · dbaldwin/tello-adv-setup (github.com)

Just make sure you are in the virtual environment (you’ll see the (venv) at your command prompt). Then you should be good to go. Let us know!

1 Like

@dbaldwin, I finally figured out the issue. Although I was running everything from my venv virtual environment, I was also inside of Anaconda’s base environment, which caused Jupyter Notebook to run via Anaconda and not from the one in the venv virtual environment. After trying the process a 3rd time, I noticed my prompt changed to (venv)(base) after quitting Juypter. After conferring with my best friend Google about the (base) prompt, I found out it was from Anaconda and learned how to deactivate it. Now everything is running as it should.

1 Like

Very glad to hear that and we appreciate your persistence in getting this figured out. I would have never have thought of such a conflict and glad you brought it to our attention. Stay tuned for the part 2 course that has aruco markers. I personally am really excited about it!

1 Like

I’ll be sure to check out the course & see what I can do. For now, the kids today used Jupyter Notebook to communicate with their Tellos & find out the battery %. Most of the kids even figured out what the number meant that their drone sent back to them. :slight_smile:

That’s encouraging to hear! BTW are you familiar with the flip restriction on Tellos? If the battery is less than 50% it won’t flip? We had to learn that from trial and error.