NOTE: SDK8.0+ is required.
This year for PowerPlay, one of the tasks teams have to complete is coming up with a way to detect their custom signal sleeve, placed on top of a cone for the autonomous period. To speed up the process, we created this example signal sleeve template, along with code to show how to use it, and an attached picture of the signal sleeve being used, so that any team can instantly download our code, print out the signal sleeve, and with a little tuning be ready to go for auto.
Another common problem this plans to help out is give people an easier option for detecting the signal sleeve as opposed to using software like TensorFlow
Here's why:
- TensorFlow can be slow, causing it to not work as well at times
- Without the right tuning and models, might be innacurate
- Rookies are unable to debug it by themselves, leading to it being hard to learn
- If you switch your signal sleeve, you'll have to retrain the model
This template exists to help give rookies a start when it comes to detecting signal sleeves efficiently and effectively.
Use the VisionTest.java
and SleeveDetection.java
to get started.
These instructions will cover how to install the required files, how to setup EasyOpenCV, and tune the pipeline.
NOTE: SDK8.0+ is required.
For detailed instructions on how to install the necessary files and setup EOCV, see EasyOpenCV Installation Setup
Now that all necessary files have been added, download the VisionTest.java
and SleeveDetection.java
files above, and drop them into your project files.
Before we continue, you should take the Signal Sleeve file given and print it out. Once printed out, cut around the edges of the sleeve, and then glue the dark ends together. It is important to note that for a custom signal sleeve to be legal, your team number must be written under it. There are white boxes located underneath each color, where you are supposed to write it. We recommend adding it via a tool like Photoshop or Paint.
Now that we have all the necessary steps required for running and getting pipeline results, we can begin the short and quick tuning process.
The box displayed on the screen, inside it specifically, is where you want the signal sleeve to appear. It's fine if it's not completely inside, such as only a small bit of it is popping through. When it's detecting correctly, it will alter it's color based on the color picked up. If the box however needs to be moved around and scaled, you can modify the variables seen below to change the position, width, and height.
// TOPLEFT anchor point for the bounding box
private static final Point SLEEVE_TOPLEFT_ANCHOR_POINT = new Point(145, 168);
// Width and height for the bounding box
public static int REGION_WIDTH = 30;
public static int REGION_HEIGHT = 50;
After setting up the camera, (example can be seen in VisionTest.java
) if you want to get the current position stored in an enum, then you can do
sleeveDetection.getPosition()
If all the initialization and download steps are completed, you will be able to run the VisionTest.java
example OpMode and then preview the camera on your driver hub.
If you need help with the pipeline or have trouble tuning, don't be afraid to reach out to us!
Discord: ProDCG#0641
Project: Repository Link
For repository specific concerns, feel free to make a fork of this repo, and send a PR.