Skip to content

Our teams template for future vision projects. Contains a variety of setup scripts that should be run to enable the camera and import OpenCV libraries. Also has a template for processing images via the Pi Camera and creating a UDP server.

Notifications You must be signed in to change notification settings

HuskieRobotics/Huskie-Vision

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Huskie-Vision

Our teams template for future vision projects. Contains a variety of setup scripts that should be run to enable the camera and import OpenCV libraries. Also has a template for processing images via the Pi Camera and creating a UDP server.

Stuff to buy

  1. Buy a Raspberry Pi and Pi Camera v2 from here

  2. Buy a case here

  3. Buy a camera case

  4. You'll also need a mini sd card (8GB +), you can buy this anywhere

  5. Buy a LED RING

Setup

  1. Download Raspbian onto your personal computer: Raspbian

  2. Download Etcher and flash the pi using the Raspbian image.

  3. Once your SD card is formatted, place an empty text file called ssh in the boot folder to enable SSH. You can then install Putty on your desktop to access the pi. Then hook up your pi to your internet (via ethernet cable) and then ssh into the pi using putty with a hostname of raspberrypi.local a username of pi and a password of raspberry. You may change these once in the terminal by running sudo raspi-config. This is the easiest way to access the shell of the RPI however you may also hook up a monitor, keyboard, and mouse if you would like to use the desktop.

  4. Make sure your pi is connected to the internet and install git via sudo apt-get install git or follow these instructions

  5. Then fork this repository and clone it. Instructions here... If you do not have access to the desktop/web browser you may just clone the repository. To just clone use git clone https://github.com/HuskieRobotics/Huskie-Vision

  6. Now run my setup file (it may take up to 6 hours+ to compile the opencv library, run this overnight). Use the commands

sudo chmod +x /home/pi/Huskie-Vision/setup/setup_script.sh
sudo sh /home/pi/Huskie-Vision/setup/setup_script.sh

Programming Vision

  1. Take a look at the vision files and fill in your code as necessary. There are a variety of comments that detail exactly how and where to write your code.

  2. Also make sure to use the Testing Suite to tune your camera using HSV, Brightness, ISO, etc. It contains trackbars that you can slide around to tune.

What do the files do???

  1. /setup/setup_script.sh This file runs all the setup scripts

  2. /setup/VisionStartup.service This file is a systemd service. It is copied into the file path etc/systemd/system/ and given permissions that allow it run the Vision Processing when the Pi boots up. Basically autoruns the program on startup so you don't have to during competition.

  3. /setup/enable_systemd_service.sh This file sets up the VisionStartup.service file in the systemd service folder.

  4. /setup/enable_cam.sh This file enables the camera module. You don't necessarily need this if you use a USB camera.

  5. /setup/install_opencv.sh This file installs OpenCV for Python 2.7. It does take a long time to run.

  6. /setup/launcher.sh This file launches the Vision Processing. Is called by the systemd service.

  7. /setup/pip_installs.sh This file uses pip to install all other relevant modules including numpy, socket, and time.

  8. /vision processing/Image_Processing.py This file takes the image, finds the contours, and gets all the data you would like from the image.

  9. /vision processing/Testing Suite.py This file is a testing suite for your HSV, brightness, and ISO tuning.You will then use these values and plug them into your image processing thresholding.

  10. /vision processing/UDP_Server.py Class for the UDP server object that sends JSON packets to the roborio.

  11. /vision processing/Vision_Main.py Main Vision program where images are grabbed from camera and the server and Image Processing modules are called.

Important Links

Team 254 Vision Video SUPER HELPFUL: here

Vision Tracking in FRC (A short guide): here

Learning about OpenCV: here

Learning about Contours: here

What is UDP: here

3D Printed Camera Cases

Our GrabCad Partner space has the files for all of this: here This model actually has a spot for the LED ring to sit on.

About

Our teams template for future vision projects. Contains a variety of setup scripts that should be run to enable the camera and import OpenCV libraries. Also has a template for processing images via the Pi Camera and creating a UDP server.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published