BOILER TRACKER - SWAT 1806
S.W.A.T. 1806 is proud to present our newest vision library, Boiler Tracker. Programmers, no longer do you have to have your mentors yelling at you to get your vision for auto done, it’s all right here. This can run on both your drivers station laptop or a coprocessor. This uses a combination of generated code from GRIP and some of my own code, so it’s super flexible and easy to tune the values at competition.
Here is the GitHub repo: https://github.com/TheGuyWhoCodes/BoilerTracker
**Here are the instructions: **
- Clone the repository, using
git clone https://github.com/TheGuyWhoCodes/BoilerTracker.git
- Make sure you have the opencv library downloaded, and Network Tables 3.0 (included)
- Import the project into Eclipse, and go to your build path and add the included NetworkTables jar, and opencv-XXX.jar that you downloaded
- Change the variables inside the code to your situation, especially the distance constant, which you can find on the post
- Open the .grip file included inside of the project on GRIP. Tune your HSV values to your liking using your webcam and go to Tools->Generate code
- Using the Generate Code feature will export a *.java file. Open that file and copy all the code, and replace the BoilerTracker.java code inside the project
- After that, export it as a runnable jar, (File->Export->Java->Runnable JAR file).
- Run the jar file using
java -jar blahblahblah.jar
- Vision Track!
Here is how you tune your Distance Constant:
The way we found the distance from the target in the public release of this program is by the equation distance = k*centerY.
So what we did, was open up GRIP, and lined up the robot at different distance points, (36, 48, 60, 72, 84) and recorded the centerY values for the top vision tape on the boiler. We would then divide the distance by the centerY’s, then average like this:
36in – 90px 36/90
48in – 139px 48/90
60in – 176px 60/176
72in – 210px 72/210
This is the most simple way to do it, though not the most accurate. If you want to be more precise, you can use some line fitting software to make you an equation.
Have fun, ask me any questions that you have.