- Todo:
- Add project description to main page
- Finish the description of the project
About this project
This is FRC team 4529's vision system, built by Andrew Silver.
It is built in C++, and uses OpenCV 2.4 (http://opencv.org/).
It is very high performance, reliable, is platform-independant, and is simple to use in C, C++ and Java. It can run on both the driver station, and even on the RoboRIO itself!
The system will pick up the tote markers from a frame source, and will report the center X position of the marker, along with the rotation direction and the total width of the detected area (including space in between).
Vision Representation
- See also
- rotation_t Rotation direction
-
LineResult Output data from the vision system
Download
Setting up the library
Getting the library
You can either:
Manual compilation
- Download/setup OpenCV 2.4.10 from http://opencv.org/downloads.html
- Attention
- Do NOT use 3.x, as the library is not currently compatable!
If you wish to port it yourself, feel free!
- Note
- If you want to use this for the RoboRIO, you will need to compile OpenCV from source.
-
Modify the ARM toolchain that comes with OpenCV, and use cmake - DO NOT USE frcmake!
Instead, check the contents of the toolchain file it uses, and incorperate the changes into the OpenCV ARM toolchain.
- Clone the library source source.
1 $ git clone https://github.com/frc4529/2015-Vision.git
- Compile the code
- Note
- frcmake will NOT work with this. frcmake is a cmake wrapper, we do not use cmake.
- Move on to Using the library
Using a pre-compiled binary
- Go to https://github.com/frc4529/2015-Vision/releases and download the latest release.
- Move on to Using the library
Using the library
C++ usage
C++ on the RoboRIO
See https://github.com/frc4529/2015-Vision/blob/master/test.cpp for usage.
C++ on the driver station
See https://github.com/frc4529/2015-Vision/blob/master/test.cpp for usage.
Java usage
Java on the RoboRIO
To have the code compile in eclipse, add this to the end of your project's build.properties file (open with a text editor):
1 wpilib=${user.home}/wpilib/java/${version}
2 wpilib.lib=${wpilib}/lib
3 wpilib.jar=${wpilib.lib}/WPILib.jar
4 networktables.jar=${wpilib.lib}/NetworkTables.jar
5 jna.jar=/full/path/to/jna.jar
6 classpath=${wpilib.jar}:${networktables.jar}:${jna.jar}
Change the jna.jar property (line 5) to the full path of the jna.jar file.
For Windows, include the drive letter in the path for jna.jar - and ONLY jna.jar (E.g. "C:/path/to/jnalib.jar")
- Note
- If the project doesn't compile, reporting multiple errors similar to "Cannot find symbol" relating to Pointer, PointerType, jna, etc, you have set the path to the jar incorrectly.
-
The file will most likely not be called jnalib.jar or jna.jar. Most of the time it is named jna-x.x.x.jar
- Attention
- Ensure you have set the FULL path to the JNA jar file, and you have included the full filename including the extension.
Move on to step 1 of Java on the driver station
Java on the driver station
- Include https://github.com/frc4529/2015-Vision/blob/master/pikavision/PikaVisionLibrary.java and https://github.com/frc4529/2015-Vision/blob/master/pikavision/LineResult.java
- Set JNA_LIBRARY_NAME on line 15 to the path to the library.
- See https://github.com/frc4529/2015-Vision/blob/master/pikavision/test.java for usage.
- Author
- Andrew Silver - https://github.com/Silvea12/