Beispiel #1
0
  public Robot() {
    server = CameraServer.getInstance();
    server.setQuality(50);
    // the camera name (ex "cam0") can be found through the roborio web
    // interface
    server.startAutomaticCapture("cam0");

    table = NetworkTable.getTable("SharkCV/contours/0");

    autonomousCommand = new Auton();
  }
Beispiel #2
0
  /**
   * This function is run when the robot is first started up and should be used for any
   * initialization code.
   */
  public void robotInit() {
    RobotMap.init();
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    drive = new Drive();
    elevator = new Elevator();
    claw = new Claw();
    lights = new Lights();
    camera = CameraServer.getInstance();
    camera.setQuality(50);
    camera.startAutomaticCapture("cam0");

    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    // OI must be constructed after subsystems. If the OI creates Commands
    // (which it very likely will), subsystems are not guaranteed to be
    // constructed yet. Thus, their requires() statements may grab null
    // pointers. Bad news. Don't move it.
    oi = new OI();

    // instantiate the command used for the autonomous period
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS
    autonomousCommand = new Figure8();

    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS
  }
Beispiel #3
0
 /**
  * This function is run when the robot is first started up and should be used for any
  * initialization code.
  */
 public void robotInit() {
   oi = new OI();
   chooser = new SendableChooser();
   chooser.addDefault("Auto1RightLow", new Auto1RightLow()); /*-Default-*/
   chooser.addObject("Auto1RightHigh", new Auto1RightHigh());
   chooser.addObject("Auto2RightLow", new Auto2RightLow());
   chooser.addObject("Auto3MidHigh", new Auto3MidHigh());
   chooser.addObject("Auto4MidHigh", new Auto4MidHigh());
   chooser.addObject("Auto5LeftLow", new Auto5LeftLow());
   chooser.addObject("Auto5MidHigh", new Auto5MidHigh());
   chooser.addObject("AutoCross", new AutoCross());
   chooser.addObject("AutoGenericRightLow", new AutoGenericRightLow());
   chooser.addObject("AutoGenericLeftLow", new AutoGenericLeftLow());
   //      chooser.addObject("My Auto", new MyAutoCommand());
   SmartDashboard.putData("Auto mode", chooser);
   CameraServer.getInstance().startAutomaticCapture("cam2");
 }
  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);
  }
Beispiel #5
0
 public Robot() {
   server = CameraServer.getInstance();
   server.setQuality(50);
   // the camera name (ex "cam0") can be found through the roborio web interface
   server.startAutomaticCapture("cam0");
 }