Log in

View Full Version : target tracking in Java


HansJ
05-07-2010, 16:45
In our off season, we are attempting to learn Java by programming our 2010 bot in it. Last year, we used Labview, and did absolutely nothing with the camera beyond the default circle tracking in Labview. We are trying to figure out how to implement something similar in Java. We'd like it to target a circle, and show us that target by outlining it on the camera output on the driver's station. We've got the live camera image showing in the driver's station, but nothing beyond that.
How should we start to implement this?

Dustin Shadbolt
06-07-2010, 11:01
Hello!
This year we are also switching over to Java from Labview from the previous season. We are learning JAVA over the summer and hopefully we will be up to speed by 2010. The camera wasn't even on our robot last year due to several reasons. There is vision tracking default code that comes with the FRC Java updates. Have you tried using that? I heard from several people and read that the default tracking code is pretty much already to go.
-Dustin Shadbolt

isaacdl
06-07-2010, 12:24
We should have mentioned (I'm on the OP's team) that we'd like to just get basic circle tracking, like what they had by default in Labview, *without* the gyro. All it did was show what circle it'd targeted by outlining it in green on the live view on the Driver's station. The circle tracking examples in Java are a.) too complicated for our limited understanding right now, and b.) require the gyro.

Robototes2412
07-07-2010, 13:45
remove the gryo calls in the code, and you are good to go

oh! and it helps to make the camera code a function callable by the push of a button. Next year, my team is going to write the camera code in c++ with java bindings for the sake of speed.

HansJ
07-07-2010, 13:50
Ok, we will try that. Do you know what purpose the gyro serves in the camera code?

billbo911
07-07-2010, 14:03
Ok, we will try that. Do you know what purpose the gyro serves in the camera code?

I can tell you what is was used for with Labview but not Java. I can only assume the function would be similar, but have no proof of that.

In Labview it had two functions. 1) It was used to measure how many degrees the robot rotated after a positioning solution was determined based on the camera image. 2) If no targets were identified in the camera image, it was used to rotate the robot back to the zero degree position established during initialization at boot-up.