Owing to the fact that we are not robots (well, hopefully. At least,
I'm not a robot), it's difficult to tell you if that code "works." Try to run it on an actual robot, especially before build ends in 1.5 weeks
You should also try using the debugger (debug as > wpilib java deploy) if you need step-by-step execution of code.
That said,
-
Code:
Robot.visionMaybe.centerX1 = this.centerX;
Did you mean this to be the other way around? -
Code:
synchronized (Robot.visionMaybe.imgLock) {
synchronized is usually not necessary when you're just reading values (assuming above point is true) - Is this what you wanted in isFinished()?
Code:
return centerX <= 0 && centerX >= 237;
- Also with the above code, it's not clear whether it's the behavior you're actually looking for. Could you explain in words?
- I'm noticing a lot of magic numbers everywhere. You should make those named constants to make your code readable and clean.