[SOLVED] GoPiGo3 Firmware problem with Virtual Environments

I think right now I shouldn’t mess with the venv and be happy, that (as it seems) everything is working so far. Not quite sure about opencv, but I will test that in the next days. Now I want to make progress and if I can assess that I have enough time for everything. Them I will set the SD up clean again. Again thanks to all of you for helping and suggesting great tips! I really appreciate it

3 Likes

Not a problem, we’re glad to help someone who is serious about succeeding.

What you can do is keep us in the loop and share your project’s progress with us.

Thanks!

1 Like

Here was my “OpenCV detect lanes” (continue reading for the correct link to the video):

3 Likes

Ohhhh… that’s you! Of course, I already saw that one here. Did you test your lane detection with curves?
Do you have any idea how to get the gopigo to drive accordingly?

3 Likes

Yup.  That’s him.

Except that you’re on a schedule. . .  You could spend several weeks doing nothing but reading his and @KeithW’s posts from day-1 until today and it would richly repay you.

Me?  I watch their stuff like a hawk.  A lot of it I don’t understand yet, but the opportunity to sit at the feet of someone of his and @KeithW’s caliber and just learn is an honor in itself.

What say ye?

2 Likes

No - it is too simplistic for curves. Its purpose was to compare single thread against multi-threaded OpenCV line recognition performance.

Did you watch the PiWars Orionrobots video? That is a typical, simple, implementation of dealing with curves.

Did you see this one (Ackerman steering but sensing and control are similar)?

I think there are basically two schools of thought on lane following (I have not researched):

  1. train a NN on the whole pipeline (reco, steer, repeat)
  2. Use object detection as input to a control algorithm
    a) this can be edges, this can be lines, this can be color regions etc.
    b) control algorithm can be simple (turn to an angle) to complex (PID steering to a moving target angle)

You mention this is for a bachelor level class, and the challenge is simply to implement something, not to extend the science. I want to remind you that a well written report of the successful aspects and failure aspects is always a valid fallback if you decide to start writing with enough time to write it up instead of bashing your head against the failures all the way to the deadline.

2 Likes

Yes i saw the PiWars Orionrobots video and it was very interesting. Nothing I have seen before to be honest :smiley: The Ackerman steering is new to me. But I will look into it.

Yeah, I think so too. These two options are pretty much it. I tend towards the second option with edge detection and an algorithm that controls the lane keeping in any way. I am not sure if I could even try a NN with my raspberry pi 3b+

It is for my bachelors degree, yes. I have a little less then two more months till submission. Absolutely true. My problem right now is that I have so many sources and github pages saved up and I need to sort and probably filter them in a way. So yes, I have two jobs in the next two months. Get the gopigo to do his job of lane detection, lane keeping and optional obstacle avoidance based on the raspberry pi cam v2 feed. And to write a good scientific report on that part :sweat_smile:

3 Likes

As I was testing my camera. I noticed that opencv gets me errors quite often. After trying to fix this error:
[ WARN:0@0.778] global /home/pi/opencv/modules/videoio/src/cap_gstreamer.cpp (2076) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Failed to allocate required memory.
[ WARN:0@0.779] global /home/pi/opencv/modules/videoio/src/cap_gstreamer.cpp (1053) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0@0.779] global /home/pi/opencv/modules/videoio/src/cap_gstreamer.cpp (616) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

I tried to fix that one but not i get this error:
ImportError: numpy.core.multiarray failed to import

So somehow I have a numpy problem… How do I know which version of opencv is compatible with a version of numpy :thinking:?

Also it seems that cv2.VideoCapture(0) doesn’t work with raspberry pi cam v2… I have to say… i am pretty tempted to get a new installation of Buster on the sd card… I fear this installs and potential error fixes in the venv might have broken something here…

On a positiv note… I tried the gopigo movement and it works great… very fun to see that little boy drive through the living room :smiley:

3 Likes

Do not know that one.

I have not updated my OpenCV or numpy in over a year, so my versions are:

pi@Carl:~/Carl $ pip3 freeze | grep opencv
opencv-contrib-python==4.1.1.26
pi@Carl:~/Carl $ pip3 freeze | grep numpy
numpy==1.16.2
pi@Carl:~/Carl $ python3 --version
Python 3.7.3

I saw in one search hit that OpenCV (version unknown) is still using numpy 1.19 , and in another Python3.6 uses numpy 1.19 but obviously that does not answer your specifics.

So you could try:

pip3 install --upgrade numpy==1.19.1
2 Likes

I’ve been out of the OpenCV loop for a bit, but I do remember there were too many different ways to access the PiCameras to get a feel for which to use when.

Here is a basic test that uses the python picamera module to acquire video frames and display them using the OpenCV imshow():

Does that work for your setup?

I seem to remember different programs using:

  • PIL
  • picamera
  • imutils and picamera
  • cv2.VideoCapture(0)

but I don’t recall any of my working programs going direct using cv2.VideoCapture(0).

Also there are ways to use the Raspberry Pi GPU to perform algorithms in between video frames - I remember using this for motion detect / motion vector analysis without OpenCV that was very fast.

2 Likes

I will try that later… I swapped the SD cards and installing opencv right now… just in case :smiley: One more question for the day… Since the firmware error is “fixed”, are their any rules in this forum, that I shouldn’t ask about different stuff in this thread? I mean… it’s probably better to open up a “new project” thread about all the current errors and progress, right?

3 Likes

Since you opened the thread - your rules apply.

I would suggest changing the title for this thread to:

  • “[SOLVED] GoPiGo3 Firmware problem with Virtual Environments”,

and then start a new thread for each problem you encounter,
or start a new thread with a project title rather than a specific problem.

Thread creep is always going to happen, but good titles help spot solutions when searching later.

2 Likes

That sounds like a plan. I have to say, it’s not really clear how to change a thread title :sweat_smile:. I don’t see any option here…

3 Likes
3 Likes

Hi! @superbam

I was wondering how you solved this firmware version error with GoPiGo3? I am having the exact same issue telling me to downgrade firmware versions to 0.3.x from 1.0.0.

3 Likes

If I remember correctly the solution was not to use a virtual environment. Nothing else seemed to work for me

3 Likes

@superbam Sorry I’m really new to this! Would that mean removing my venv folder from my python code in raspian? And it is still able to run ok after that?

3 Likes

The secret is to install first to the system, then create your venv

1 Like

@cyclicalobsessive Thanks for the response! What would I need to install? Is there a set of instructions for this?

2 Likes
2 Likes