Quote:
Originally Posted by Fauge7
Team 3019 graciously presents their vision tracking program for everybody to use and borrow! Now instead of dreaming about the perils of computer vision YOU can bring your team the joy of having a robot that is capable of tracking the target with ease! No more Grip crashes or weird deploys, can calculate fun things such as: distance to target, and angle to target! to be used to auto align and auto aim!
if you are going to modify the code, all i ask is give me and my team credit in a comment at the top of the code and comment your suggestions and or your praise!
to install: - download opencv 3.1 from here
- download Network table 3.0 jar
- make a new project in eclipse
- make opencv and networktables added as a user library to the build path of your new project
- copy opencv_ffmpeg310_64.dll from C:\Path\to\opencv\build\bin to C:\Windows\System32
- add the code in a class that is named TowerTracker.java
- when your ready to export
- export the .jar file as a runnable jar
- move the .jar to a folder similar to this
- run the .jar with "java -jar c:\Path\to\TowerTracker.jar" on a command prompt window
the code is just an example of what it can do, i can add network table stuff soon but i thought i would publish it first!
github link
want to see an example of what it can output?
here you go!
how it works: using an axis camera or a mjpeg streamer you can use a stream of a webcam to process images using an opencv program that runs on the driver station computer. This program can be modified to run on a coprocessor and directly input to the roborio for even better results because network tables can only go at 10hz vs the camera stream which is 30hz...this program can easily be ported over to c++ and python and would probably run better with those as c++ and python are way more supported then java with opencv.
|
Fauge7, thanks so much for taking the time to write this out! We are trying to use your solution but there are a few errors in your github code. I fixed a couple of them (for example, line 87 and a few merge artifacts left over near the bottom), but I'm still getting the following error when running the jar file in the command line:
Code:
Exception in thread "main" java.lang.NullPointerException at org.usfirst.frc.team5407.robot.TowerTracker.main(TowerTracker.java:107)
We are totally new to java, or any language for that matter. Does anyone have working java code they would be willing to share?? Thanks!