public TargetFinder() { System.out.println("TargetFinder() begin " + Timer.getFPGATimestamp()); cam = AxisCamera.getInstance(); cam.writeResolution(AxisCamera.ResolutionT.k320x240); cam.writeBrightness(camBrightness); cam.writeColorLevel(camColor); cam.writeWhiteBalance(camWhiteBalance); cam.writeExposureControl(camExposure); cam.writeMaxFPS(15); cam.writeExposurePriority(AxisCamera.ExposurePriorityT.none); cam.writeCompression(50); // System.out.println("TargetFinder() * " + cam.toString() + "[" + Timer.getFPGATimestamp()); boxCriteria = new CriteriaCollection(); inertiaCriteria = new CriteriaCollection(); boxCriteria.addCriteria( NIVision.MeasurementType.IMAQ_MT_BOUNDING_RECT_WIDTH, 30, bboxWidthMin, false); boxCriteria.addCriteria( NIVision.MeasurementType.IMAQ_MT_BOUNDING_RECT_HEIGHT, 40, bboxHeightMin, false); inertiaCriteria.addCriteria( NIVision.MeasurementType.IMAQ_MT_NORM_MOMENT_OF_INERTIA_XX, 0, inertiaXMin, true); inertiaCriteria.addCriteria( NIVision.MeasurementType.IMAQ_MT_NORM_MOMENT_OF_INERTIA_YY, 0, inertiaYMin, true); Timer.delay(7); }
/** * This function is run when the robot is first started up and should be used for any * initialization code. */ public void robotInit() { black = new Jaguar(4, 1); red = new Jaguar(4, 2); leftEncoder = new Encoder(4, 5); rightEncoder = new Encoder(6, 7); left = new Joystick(1); right = new Joystick(2); gamePad = new Joystick(3); watchdog = Watchdog.getInstance(); dsLCD = DriverStationLCD.getInstance(); photoreceptorL = new DigitalInput(4, 1); photoreceptorM = new DigitalInput(4, 2); photoreceptorR = new DigitalInput(4, 3); camera = AxisCamera.getInstance(); driveMode = 0; // 0 = Tank; 1 = Arcade; 2 = Kaj driveToggle = false; cruiseControl = false; camera.writeResolution(AxisCamera.ResolutionT.k160x120); camera.writeWhiteBalance(AxisCamera.WhiteBalanceT.hold); camera.writeExposureControl(AxisCamera.ExposureT.hold); camera.writeExposurePriority(AxisCamera.ExposurePriorityT.frameRate); leftEncoder.start(); rightEncoder.start(); }