Esempio n. 1
0
  public void teleopPeriodic() {
    Definitions.drivetrain.arcadeDrive(
        Definitions.xbox1.getRawAxis(1), Definitions.xbox1.getRawAxis(4), false);
    DriveShifter.checkGearShift();
    SparkyIntakeBar.loadingRoutine();
    Shooter.firingRoutine(5000);
    ArduinoComm.communicate();

    try {
      if (!backfailed && !frontfailed) {
        if (Definitions.buttonbox.getRawButton(2) && !lastbutton4) {
          if (currsession == front) {
            NIVision.IMAQdxStopAcquisition(currsession);
            currsession = back;
            NIVision.IMAQdxConfigureGrab(currsession);
          } else if (currsession == back) {
            NIVision.IMAQdxStopAcquisition(currsession);
            currsession = front;
            NIVision.IMAQdxConfigureGrab(currsession);
          }
        }
      }
      lastbutton4 = Definitions.buttonbox.getRawButton(2);
      NIVision.IMAQdxGrab(currsession, frame, 1);
      CameraServer.getInstance().setImage(frame);
    } catch (Exception e) {
      //    		System.out.println("Camera problem");
    }
    SmartDashboard.putNumber("Pressure", 250 * (Definitions.pressuretrans.getVoltage() / 5.0) - 25);
    SmartDashboard.putNumber("ballSeater", Definitions.ballholder.get() ? 1 : 0);
    SmartDashboard.putBoolean(
        "catapultReady", (250 * (Definitions.pressuretrans.getVoltage() / 5.0) - 25) > 40);

    if (Definitions.joystick.getRawButton(3) && !lastbutton3) {
      Definitions.flashlightrelay.set(
          Definitions.flashlightrelay.get() == Relay.Value.kOff
              ? Relay.Value.kForward
              : Relay.Value.kOff);
    }
    //    	System.out.println(Definitions.flashlightrelay.get());
    lastbutton3 = Definitions.joystick.getRawButton(3);
    System.out.println(Definitions.pdp.getCurrent(4));

    Timer.delay(0.01);
  }
Esempio n. 2
0
 public synchronized void stopCapture() {
   if (m_id == -1 || !m_active) return;
   NIVision.IMAQdxStopAcquisition(m_id);
   NIVision.IMAQdxUnconfigureAcquisition(m_id);
   m_active = false;
 }