Error installing/running to use Aruco

OK, I’m stumped.

I have been using the Tello Drones all 1st semester (finally; see my prior thread with @dbaldwin , using the Raspberry Pi units. Python using Raspberry Pi--any success out there? - #3 by davidbayne)

We’re on to Aruco Markers using the instructions & videos provided by @pat.ryan; it’s great stuff but won’t install properly.

In a nutshell: We can’t run the code due to various errors with OpenCV and with droneblocksutils.

I even made new SD cards for my entire class, in hopes that it was the new PiOS which was the issue. No luck. And I’m mostly installing each element by hand, instead of letting setup.py do it for me, since that hiccups more often than not.

My steps to the install can be found at fixing flying - Google Docs

The pip packages installed are at pip - Google Docs , along with (at the bottom) a copy of the error message we’re receiving.

One of the students noticed that it may be a PATH error, because when he moves the droneblocksutils into the same folder with parts of the code it works–sometimes. But even that solution seems intermittent.

Help! I’ve spent too much time on this, and am not really any further along (though I did learn a lot about how setup.py was built, but that’s not something useful for today…)

Thanks for any help.

-David

We went hat route a few years ago, and gave up. Way to complicated for us. We are working with the DJI mission pads, DJi flight map, arUco markers, April markers, and QR codes. I would recommend looking into the Mind+, DFRobots Huskylens for the Tello Talent. Recommend switching to the to the Arduino, for low3er . Also the Robolink ZUMI sULV uses a Raspberry PI for recognition projects. See out work on Youtube channel MECATX,

David,

I’ll give this a try on my Pi 4 today or tomorrow. All of the original code was developed/tested on Mac/PC so hopefully we can get it working on Pi. Can you share any errors that you’re receiving?

What Pi models are you testing with?

Thanks,
Dennis

Dennis:
Thanks for your help.
The error is in the linked documents (I’m on the road so can’t look at it right now); it could be as easy as a PATH issue but I have no clue, to be honest.

We’re primarily on Pi4Bs, with a few Pi 3Bs in the mix. Doesn’t seem to be any difference.

Thanks for any insight.

-David

Hi @davidbayne

I was able to reproduce the problem and I have committed a few changes to the GitHub - dbaldwin/tello-adv-aruco: DroneBlocks Python, OpenCV, and ArUco markers course with Tello from Pat Ryan
repo.

Since you are using a RaspberryPI I would like to suggest a slightly different install process for you. I was generally using your script, and you might still need to install some libraries specific for your use case.

I am using the latest ( 3/20/2022 ) RaspberryPI OS 32 bit.

Execute Step 1 from your steps
Skip Step 2
Execute Step 3
Skip Steps 4,5,6,7

Personally I find installing OpenCV on the raspberry Pi can be tricky. Particularly the contrib library since it has to be built - AFAIK. If I try to pip install opencv-contrib-python, IF it works, it takes a long time. Most often, I dont have success with a pip install of the contrib library.

Instead I have a script that I use to install OpenCV and the OpenCV Contrib library on a Raspberry PI. You can find the script that I use in my GitHub repo:

Use the script: pi_install_cv2_455.sh

That script will create a virtual python environment in ‘~/.virtualenvs/cv2_env’ and it will install version OpenCV and Contrib 4.5.5. Please note, 4.5.5 is different than the version used to test the packages. This is important and I discovered another issue in the tests related to the latest 4.5.5 OpenCV version that I addressed as well.

If you would like to change location of the virtual environment, you can update the script to place it where you prefer.

After the script completes and you have opencv and opencv-contrib:

cd Documents

git clone https://github.com/dbaldwin/tello-adv-setup.git
git clone https://github.com/dbaldwin/tello-adv-aruco.git

source ~/.virtualenvs/cv2_env/bin/activate

Since you are running on a RaspberryPI you have ‘git’ available to you. The easiest way to get the repos is to ‘git clone’ them.

pip install jupyter
pip install imutils
pip install spicy
pip install djitellopy2

After pulling the new code, and building a virtual environment as described here I was able to run the tests.

cd ~/Documents/tello-adv-aruco/tests
python basic_droneblocks_marker_test.py

Please keep in mind I have not yet run through the entire course material yet on the Raspberry PI with these versions of the libraries.

However, I hope this gets you past your current issue.

Thanks for your patience and please let me know if this helped you.

Pat

Thanks for this. We are a lot closer.

The OpenCV still didn’t install correctly, so I used my steps 7abcd, which made the whole thing work (essentially it’s a version issue on the opencv-contrib-python). That part seems to be operating now; the tests directory files run fine.

However, when I tried to make the Drone fly with OpenCV (with the command python tello_script_runner.py --handler aruco-marker-flying.py --display-video --fly), it wouldn’t fly and show video (actually neither part worked). Instead I got a smooshed video window (not sure how to describe it; instead of square, it was a rectangular black box). The drone was connected since I got a battery reading.

I have put the entire error stream into a document at more errors 3-21 - Google Docs since it’s too much for this page.

Thanks for your continued help!

-David

OK, I’m not sure why, but the same command ( python tello_script_runner.py --handler aruco-marker-flying.py --display-video --fly) is now working on a Pi3

It doesn’t center on the Aruco Marker (we’ll continue working on that), but it IS working. Huge success!

Thanks for all your help!

-David