This is a vision processing program created for the 2020 FRC game, Infinite Recharge. It can identify the game's vision target and send its horizontal offset to a connected roboRIO via UDP. Additionally, it is entirely configurable using the CrevoDashboard JavaFX GUI.
Hardware requirements include:
- A Raspberry Pi (we used a Pi 3 B+)
- A Raspberry Pi Camera Module (we used this infrared camera (the lights are included))
- A normal UVC camera (we used this fisheye camera)
Software requirements include:
- GStreamer-1.0 and all related libraries and packages
- gst-rpicamsrc
- OpenCV 3.4.2 installed with GStreamer support
- Boost 1.58.0 (only the system module is used)
- mjpg-streamer
- yaml-cpp
This assumes you have a Raspberry Pi already up and running. If you don't, I would recommend following this tutorial. Don't forget to enable the Raspberry Pi Camera Module in raspiconfig.
Please make sure all software prerequisites are installed before continuing.
- Open a new terminal
- Install git (
sudo apt install git) - Run
cd ~/ - Run
git clone https://github.com/CrevolutionRoboticsProgramming/Vision2020 - Run
cd Vision2020 - Run
cmake . - Run
make - To run the program, run
./run.sh
If you would like to run the program on startup, follow these steps:
- Open a new terminal
- Run
sudo nano /etc/rc.local - Before
exit 0, add a new line with the contentscd ~/Vision2020 && ./run.sh & - Press
Ctrl + Oto write your changes - Press
Ctrl + Xto exit
Once ran, the program requires no user input. It includes a custom configuration protocol for storing and updating program-wide values like HSV thresholds and video formatting which can be accessed via our CrevoDashboard JavaFX GUI.
Once the program identifies a vision target, it calculates its vertical and horizontal offset from the center of the target, ranging from -0.5 to 0.5, and streams it via UDP with the labelling "Y OFFSET:" or "X OFFSET:" respectively to the roboRIO. The stream can be received with the UDPHandler class included in CrevoLib.
The video stream can be received from index.html in any web browser.
The MJPEGWriter.cpp and MJPEGWriter.hpp files come from JPery's MJPEGWriter and are used for transmitting the video stream. They have been altered to fit the needs of the project.