コード例 #1
0
  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);
  }
コード例 #2
0
  /** Initialize the camera. */
  public void init() {
    robotCamera = AxisCamera.getInstance();

    // To be replaced with image processing code
    // Sets axis camera stuff at the beginning of the robot
    robotCamera.writeMaxFPS(15);
    robotCamera.writeCompression(70);
    robotCamera.writeColorLevel(100);
    robotCamera.writeResolution(AxisCamera.ResolutionT.k320x240);
    robotCamera.writeBrightness(50);
  }
コード例 #3
0
  public void robotInit() {
    try {
      drive_control = new Joystick(1);
      control = new Joystick(2);
      drive = new Drive();
      station = DriverStationLCD.getInstance();
      camera = AxisCamera.getInstance();
      camera.writeResolution(AxisCamera.ResolutionT.k320x240);
      camera.writeBrightness(0);
      camera.writeMaxFPS(10);
      launcher = new CANJaguar(7);
      belt1 = new Relay(1);
      // belt1.setDirection(Relay.Direction.kBoth);
      belt2 = new CANJaguar(8);
      turret = new Victor(4);

      /*launcher.setPID(0.5, 0.001, 0.0);
      launcher.configEncoderCodesPerRev(360);
      launcher.changeControlMode(CANJaguar.ControlMode.kSpeed);
      launcher.enableControl();*/
      launcher.configEncoderCodesPerRev(360);
      launcher.setSpeedReference(CANJaguar.SpeedReference.kQuadEncoder);
      launcher.setPositionReference(CANJaguar.PositionReference.kQuadEncoder);
      /*wheelEncoder = new Encoder(1, 2, true, CounterBase.EncodingType.k4X);
      wheelEncoder.setDistancePerPulse(1);
      wheelEncoder.setReverseDirection(true);
      wheelEncoder.start();*/
      csc = new CANSpeedController(.02, 0, 0, launcher);
      csc.setInputRange(0, 3000);
      csc.enable();

      timer = new Timer();
      // tracking = new EagleEye();
      lights = new Relay(3);
      /*try {
          serial = new SerialPort(115200);
      } catch (Exception ex) {
          System.out.println("Cannot open serial connection " + ex);
      }*/

    } catch (CANTimeoutException ex) {
      System.out.println(ex);
    }

    wedge = new wedge(2, 1, 2);
    // servo1 = new Servo(1);
    // servo2 = new Servo(2);
    // wedge = new Relay(2);
  }