A newbie that is completely lost

Hello! So I’m currently working on a capstone project, to summarize the project, I’m creating a control system for a mechanism that will have a Raspberry Pi Camera Module 3, an Arduino, a CQ Robot Ocean ToF VL53L1X distance sensor and a Raspberry Pi 4 B. Basically, there will be a payload with ArUco or Apriltag markers on it and the camera is responsible for identifying the marker and telling the pilot when the camera is directly in the center of the marker, then the distance sensor will be in charge of telling the pilot (by using LED bulbs) at what distance the payload is (to be able to grab it) and once the payload grabs it then give distance feedback (with another LED) to the pilot and that way see if the mechanism successfully grabbed the payload.

I have the distance sensor connected to the arduino (that’s what my robotics prof. told me to do) but could the distance sensor be connected to the raspberry pi? the code is pretty simple and having the arduino feels a little bit unnecessary.

My real problem comes with the marker detection with the camera and the raspberry. I’ve only worked with Arduino and Matlab at university and they taught us pretty basic stuff. So the maker detection is way out of my league. I’m trying to use matlab in the raspberry pi but I can’t figure out how to get it to work. I’ve been trying to use Python/Thonny and trying to download Opencv, Apriltag to Import in Thonny by creating virtual environments for each one and it doesn’t seem to work. I’ve seen so many videos but nothing is quite helping and I just need someone to help me or explain this to me like I’m 5 years old. I don’t have a mentor and don’t really know many people that can help me figure this all out. Any suggestion, comments, anyone that is whiling to help, I’ll gladly appreciate it.

-Carol

1 Like

Hi Caroline
That is some project for a newcomer to take on. Can you break it up into smaller components to get individual bits operating then marry everything up (a bit at a time) until you have it all working.
Cheers Bob

3 Likes

Greetings Bob!
Yes! My goal right now is to at least get the raspberry pi camera to identify a marker. I know I could use Matlab in the raspberry pi and use Apriltags or use Python and use ArUco markers. But I haven’t had any success in installing Matlab in the raspberry pi or installing OpenCV to use in Python.

1 Like

I would recommend selecting which of these you want to use and then providing the details of exactly what you did and what happened when it failed.

2 Likes

Okay, I’ll choose MATLAB since it’s what’s familiar to me.

I had initially tried to follow “Connect to Raspberry Pi Hardware Board in MATLAB online” doc in MathWorks but it didn’t work (later on discovered that it’s for older versions). Then I went to “Raspberry Pi Support from MATLAB” and tried to download it from the Raspberry browser but then it told me that I should open the file through MATLAB. My robotics professor had told me to visit the “MATLAB (Linux)” doc in MathWorks but I honestly don’t understand what or where I’m supposed to write the syntax shown. All the videos I’ve been able to find about Raspberry Pi and MATLAB are from 6 years ago and its not working for me. I currently have matlab online in the raspberry’s browser and I’ve tried to run “raspberrypi” and “raspilist” commands but it’s not detecting the hardware. I also had read another doc that I can’t seem to find right now, but it said to install something that was going to rewrite the SD card of the raspberry and I was a little scared to try it. I know that I could use my laptop, run matlab there and communicate with the raspberry pi that way but I’m unsure if that will give me any problems when trying to use the raspberry pi camera module.

1 Like

So I presume you are using Matlab on the desktop. What happened when you downloaded the support package through Matlab?

Are you using one of the supported models of Pi? It looks like support for newer models isn’t available, and that will certainly cause problems with the camera module.

1 Like

This happened :smiling_face_with_tear:

1 Like

I don’t know if to give up with matlab since I don’t know how the camera will react or not with matlab or if the camera will detect apriltags.

1 Like

Failure to install a package could indicate that it is not compatible with the version of the operating system. That has been the issue with the cameras on newer models of Pi. Which model and which OS are you using?

1 Like

Hi Caroline,

By the looks of things you may be running into issues installing these programs over each other. I would personally recommend OpenCV as it has way more support running on a Pi compared to MATLAB. Python as a language is one of the easiest to pick up and if you have some prior code experience you shouldn’t find it to difficult.

Having said that if you haven’t already found it MATLAB does have some packages and support available for a project like this here. There is also a bit on that page about using a camera module that may be helpful to you.

My suggestion would be to go back to square one and start from a fresh install of your Raspberry Pi operating system if possible to avoid software issues and install either MATLAB or OpenCV from this blank slate. Hopefully you have less issues like that.

Hope this helps!
Sam

2 Likes

Hi Carol,

I’ve got some experience in MatLab as well and can vouch that it wont run too well on the Pi.
Python will be a much better option at running your whole project.

Would it be possible to send through a link to the sensor you have? The VL53L1X is used in the PiicoDev laser distance sensor so you could use that library.

Virtual environments are a bit funny, usually peeps stick to one virtual environment for a whole project instead of separate systems.

Super keen to see the hardware you’re using at the moment as well :smiley:
What robot are you interfacing with?

1 Like

I’m using Raspberry Pi 4 B and the 64 bit (which was the recommended suggestion)

I started new! I’ve had no errors so far and hopefully it’ll be smoother sailing from here :sweat_smile: I’m currently going to try to make something happen through Thonny (I’m contemplating on using Visual Studio Code but it looks veeery intimidating, would it make a difference if I use one or the other?)

1 Like

this is the one I’m using: https://a.co/d/1DIxmvb
and I used this library, VL53L1X · PyPI, let’s see if I regret it later :smiling_face_with_tear:

I’m using the raspberry pi 4B and I won’t be using a robot for this project, this whole control system will be attached to a DJI M600

so I think I successfully installed everything, I’ve been trying to activate my Pi Camera using Thonny but I get this error. Also, I tried picamera2 but it’s as if I didn’t install it? But when I go to Tools>Manage Packages, the library appears.

Hi Caroline,

Hopefully this is an easy one. Python is case sensitive so the libraries you are importing need to be spelled exactly as expected including uppercase letters.

so in your import line:

from picamera import Picamera, Preview

You may be running into issues due to how you have written this line.

try replacing this with:

from picamera import PiCamera, Preview

The difference being “PiCamera” has what I think is the correct letter case for importing this library.

Hope this helps!
Sam