Python using Raspberry Pi--any success out there?

Hi all

I’ll be using the DroneBlockly curriculum to teach Python programming this fall, and have run across a snag.

I can use the Python coding just fine from my Windows machine, but am getting errors from the Raspberry Pi units. Due to a mixup with my district, that’s what my students will be using to code & fly with.

Has anyone had luck programming/flying the drones from the Pis, and especially the code from damiafuentes (DJITelloPy)?

Any assistance/advice appreciated!

-David

Hi David, any chance you can share any error messages that you’re receiving on Pi? Have all the python dependencies installed correctly? Will you share the output of “pip list” please?

Dennis:

So near as I can tell, all of the dependencies are correctly installed. I’m running Python 3.7.3 and updated the rest yesterday (and I’m about to burn a new SD card since this is driving me nutso).

My PIP list is: (sorry, it doesn’t mean anything to me, but I’m sure you’re looking for something specific).
Package Version


anyio 2.0.2
argon2-cffi 20.1.0
asn1crypto 0.24.0
astroid 2.1.0
asttokens 1.1.13
async-generator 1.10
attrs 20.3.0
automationhat 0.2.0
Babel 2.9.0
backcall 0.2.0
beautifulsoup4 4.7.1
biyam 2017.12.22a0.dev1
bleach 3.2.1
blinker 1.4
blinkt 0.1.2
buttonshim 0.0.2
Cap1xxx 0.1.3
certifi 2018.8.24
cffi 1.14.4
chardet 3.0.4
Click 7.0
colorama 0.3.7
colorzero 1.1
cookies 2.2.1
cryptography 2.6.1
cupshelpers 1.0
cycler 0.10.0
decorator 4.3.0
defusedxml 0.6.0
djitellopy 2.3.1
docutils 0.14
drumhat 0.1.0
entrypoints 0.3
envirophat 1.0.0
ExplorerHAT 0.4.2
Flask 1.0.2
fourletterphat 0.1.0
gpiozero 1.6.2
html5lib 1.0.1
idna 3.0
importlib-metadata 3.3.0
ipykernel 5.4.2
ipython 7.19.0
ipython-genutils 0.2.0
ipywidgets 7.6.2
isort 4.3.4
itsdangerous 0.24
jedi 0.13.2
Jinja2 2.10
json5 0.9.5
jsonschema 3.2.0
jupyter 1.0.0
jupyter-client 6.1.7
jupyter-console 6.2.0
jupyter-core 4.7.0
jupyter-server 1.1.3
jupyterlab 3.0.0
jupyterlab-pygments 0.1.2
jupyterlab-server 2.0.0
jupyterlab-widgets 1.0.0
keyring 17.1.1
keyrings.alt 3.1.1
kiwisolver 1.0.1
lazy-object-proxy 1.3.1
logilab-common 1.4.2
lxml 4.3.2
MarkupSafe 1.1.0
matplotlib 3.0.2
mccabe 0.6.1
microdotphat 0.2.1
mistune 0.8.4
mote 0.0.4
motephat 0.0.3
mypy 0.670
mypy-extensions 0.4.1
nbclassic 0.2.5
nbclient 0.5.1
nbconvert 6.0.7
nbformat 5.0.8
nest-asyncio 1.4.3
notebook 6.1.6
numpy 1.16.2
oauthlib 2.1.0
olefile 0.46
opencv-python 4.5.3.56
packaging 20.8
pandocfilters 1.4.3
pantilthat 0.0.7
parso 0.3.1
pexpect 4.6.0
pgzero 1.2
phatbeat 0.1.1
pianohat 0.1.0
picamera 1.13
pickleshare 0.7.5
piglow 1.2.5
pigpio 1.78
Pillow 5.4.1
pip 21.2.1
prometheus-client 0.9.0
prompt-toolkit 3.0.8
psutil 5.5.1
ptyprocess 0.7.0
pycairo 1.16.2
pycparser 2.20
pycrypto 2.6.1
pycups 1.9.73
pygame 1.9.4.post1
Pygments 2.7.3
PyGObject 3.30.4
pyinotify 0.9.6
PyJWT 1.7.0
pylint 2.2.2
pyOpenSSL 19.0.0
pyparsing 2.2.0
pyrsistent 0.17.3
pyserial 3.4
pysmbc 1.0.15.6
python-apt 1.8.4.3
python-dateutil 2.7.3
pytz 2020.5
pyxdg 0.25
pyzmq 20.0.0
qtconsole 5.0.1
QtPy 1.9.0
rainbowhat 0.1.0
reportlab 3.5.13
requests 2.21.0
requests-oauthlib 1.0.0
responses 0.9.0
roman 2.0.0
RPi.GPIO 0.7.0
RTIMULib 7.2.1
scipy 1.1.0
scrollphat 0.0.7
scrollphathd 1.2.1
SecretStorage 2.3.1
Send2Trash 1.5.0
sense-hat 2.2.0
setuptools 40.8.0
simplejson 3.16.0
six 1.12.0
skywriter 0.0.7
sn3218 1.2.7
sniffio 1.2.0
soupsieve 1.8
spidev 3.5
ssh-import-id 5.7
terminado 0.9.1
testpath 0.4.4
thonny 3.3.10
tornado 6.1
touchphat 0.0.1
traitlets 5.0.5
twython 3.7.0
typed-ast 1.3.1
typing-extensions 3.7.4.3
unicornhathd 0.0.4
urllib3 1.24.1
wcwidth 0.2.5
webencodings 0.5.1
Werkzeug 0.14.1
wheel 0.32.3
widgetsnbextension 3.5.1
wrapt 1.10.11
zipp 3.4.0

Thanks for your help!

-David

I reinstalled PiOS and installed Jupyter Notebook. It gave me some errors but runs. I was able to get the code running for the box lab (and the Tello Drone flew), so whatever that error actually was must have been related to the PiOS I was using.

I tried using the simple.py in the DJITello from the DamienFuentes GitHub repository, but with no luck (and some errors).

I’ve put all of the error messages in the following file:

It’s long. Sorry.

Any assistance is appreciated.

I have another fresh SD card ready to go. Note that I’m traveling on business through Saturday evening so will not be working on this again until Sunday/Monday.

Thanks for all your help!

-David

David,

I took a different route that I wanted to share and just got this running. For starters I highly recommend doing this in a Python virtual environment. It keeps the dependencies clean and isolated from any global Python dependencies you may have. Pat covers that in the README file from the repo:

dbaldwin/DroneBlocks-DJITelloPy-Tutorial (github.com)

The problem that I ran into is that opencv-contrib-python as specified in the requirements file wouldn’t install. I’m talking about the version here:

DroneBlocks-DJITelloPy-Tutorial/setup.py at master · dbaldwin/DroneBlocks-DJITelloPy-Tutorial (github.com)

DroneBlocks-DJITelloPy-Tutorial/setup.py at master · dbaldwin/DroneBlocks-DJITelloPy-Tutorial (github.com)

So I went ahead and did the following.

  1. After you initialize your virtual environment be sure to upgrade pip:
python -m pip install pip wheel --upgrade
  1. The install the requirements:
pip install -r requirements.txt
  1. It’s likely the opencv-contrib-python package won’t install. So I installed an older one:
pip install opencv-contrib-python==3.4.14.51
  1. The I had install some system libraries:
sudo apt install libhdf5-103
sudo apt install libatlas-base-dev
  1. After that I was able to connect to Tello and run the takeoff and land example:
    DroneBlocks-DJITelloPy-Tutorial/01_takeoff-land.py at master · dbaldwin/DroneBlocks-DJITelloPy-Tutorial (github.com)

Here is an output of my pip list from the virtual environment:

Package Version Location


djitellopy2 2.3
DroneBlocks-DJITelloPy-Tutorial 1.0 /home/pi/Downloads/DroneBlocks-DJITelloPy-Tutorial
imutils 0.5.4
numpy 1.21.1
opencv-contrib-python 3.4.14.51
opencv-python 4.5.3.56
pip 21.2.1
pkg_resources 0.0.0
setuptools 40.8.0
wheel 0.36.2

In the near future I’ll talk to @pat.ryan about getting this fixed up so hopefully we can get it working out of the box.

FYI this was done on RPi 3 Mobel B

That worked!

(took me 2 tried because the SD card decided to die in the middle, but that’s a different issue).

I appreciate the help, and any simplification you can provide.

-David