- passPortcullis = new DigitalButton(
- new DigitalInput(Constants.OI.PASS_PORTCULLIS_PORT));
- passPortcullis.whenPressed(new PassPortcullis());
-
- passChevalDeFrise = new DigitalButton(
- new DigitalInput(Constants.OI.PASS_CHEVAL_DE_FRISE_PORT));
- passChevalDeFrise.whenPressed(new PassChevalDeFrise());
-
- passDrawbridge = new DigitalButton(
- new DigitalInput(Constants.OI.PASS_DRAWBRIDGE_PORT));
- passDrawbridge.whenPressed(new PassDrawBridge());
-
- passSallyPort = new DigitalButton(
- new DigitalInput(Constants.OI.PASS_SALLYPORT_PORT));
- passSallyPort.whenPressed(new PassSallyPort());
-
- lowerChevalDeFrise = new DigitalButton(
- new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_ONE_PORT));
- lowerChevalDeFrise.whenPressed(new MoveIntakeArmToAngle(
- IntakeArm.potAngles[0], IntakeArm.moveIntakeArmSpeed));
-
- moveToIntakeBoulder = new DigitalButton(
- new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_TWO_PORT));
- moveToIntakeBoulder.whenPressed(new MoveIntakeArmToAngle(
- IntakeArm.potAngles[1], IntakeArm.moveIntakeArmSpeed));
-
- poiseAboveChevalDeFrise = new DigitalButton(
- new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_THREE_PORT));
- poiseAboveChevalDeFrise.whenPressed(new MoveIntakeArmToAngle(
- IntakeArm.potAngles[2], IntakeArm.moveIntakeArmSpeed));
-
- moveIntakeArmInsideRobot = new DigitalButton(
- new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_FOUR_PORT));
- moveIntakeArmInsideRobot.whenPressed(new MoveIntakeArmToAngle(
- IntakeArm.potAngles[3], IntakeArm.moveIntakeArmSpeed));
-
- toggleShooter = new JoystickButton(leftJoystick,
- Constants.OI.LEFT_JOYSTICK_TRIGGER_PORT);
- SpinRobot180_1 = new JoystickButton(leftJoystick,
- Constants.OI.SPIN1_PORT);
- SpinRobot180_1.whenPressed(new Turn180());
-
- SpinRobot180_2 = new JoystickButton(leftJoystick,
- Constants.OI.SPIN2_PORT);
- SpinRobot180_2.whenPressed(new Turn180());
-
- compactRobot_1 = new JoystickButton(leftJoystick,
- Constants.OI.LEFT_JOYSTICK_TOP_CENTER_PORT);
- compactRobot_2 = new JoystickButton(leftJoystick,
- Constants.OI.LEFT_JOYSTICK_TOP_LOW_PORT);
-
- intakeBoulder = new JoystickButton(rightJoystick,
- Constants.OI.RIGHT_JOYSTICK_TRIGGER_PORT);
- shootBoulder = new JoystickButton(rightJoystick,
- Constants.OI.RIGHT_JOYSTICK_THUMB_PORT);
-
- toggleScaling = new DigitalButton(
- new DigitalInput(Constants.OI.TOGGLE_SCALING_PORT));
- toggleScaling.whenPressed(new ToggleScaling());
-
- if (!Constants.Scaler.SCALING) {
- toggleShooter.toggleWhenPressed(new runShooter());
- compactRobot_1.whenPressed(new CompactRobot());
- compactRobot_2.whenPressed(new CompactRobot());
-
- intakeBoulder.whenPressed(new IntakeBall());
- shootBoulder.whenPressed(new Shoot());
-
- } else {
- // toggleShooter becomes winch
- // compact robot button 1 and 2 retracts the lift
- // intake button stops the winch
- // shoot button extends the lift
- toggleShooter.whenPressed(new RunWinchContinuous(
- Constants.Scaler.WINCH_IN_SPEED, Constants.Scaler.WINCH_TIMEOUT));
- compactRobot_1.whenPressed(new RetractLift());
- compactRobot_2.whenPressed(new RetractLift());
-
- intakeBoulder.whenReleased(new StopWinch());
- shootBoulder.whenPressed(new ExtendLift());
- }
+ // Left joystick
+ gearShift = new JoystickButton(leftJoystick,
+ Constants.OI.LEFT_JOYSTICK_GEAR_SHIFT_PORT);
+ gearShift.whenPressed(new SetLowGear());
+ gearShift.whenReleased(new SetHighGear());
+
+ extendIntake1 = new JoystickButton(leftJoystick,
+ Constants.OI.LEFT_JOYSTICK_EXTEND_INTAKE_1_PORT);
+ extendIntake1.whenPressed(new MoveIntakeArm(Constants.IntakeArm.EXTEND));
+
+ extendIntake2 = new JoystickButton(leftJoystick,
+ Constants.OI.LEFT_JOYSTICK_EXTEND_INTAKE_2_PORT);
+ extendIntake2.whenPressed(new MoveIntakeArm(Constants.IntakeArm.EXTEND));
+
+ retractIntake1 = new JoystickButton(leftJoystick,
+ Constants.OI.LEFT_JOYSTICK_RETRACT_INTAKE_1_PORT);
+ retractIntake1.whenPressed(new MoveIntakeArm(Constants.IntakeArm.RETRACT));
+
+ retractIntake2 = new JoystickButton(leftJoystick,
+ Constants.OI.LEFT_JOYSTICK_RETRACT_INTAKE_2_PORT);
+ retractIntake2.whenPressed(new MoveIntakeArm(Constants.IntakeArm.RETRACT));
+
+ toggleFront = new JoystickButton(leftJoystick,
+ Constants.OI.LEFT_JOYSTICK_TOGGLE_FRONT_PORT);
+ toggleFront.whenPressed(new ToggleFront());
+
+ // Right joystick
+ intake = new JoystickButton(rightJoystick,
+ Constants.OI.RIGHT_JOYSTICK_INTAKE_PORT);
+ intake.whenPressed(new RunIntake(Constants.IntakeArm.IN));
+ intake.whenReleased(new RunIntake(Constants.IntakeArm.STOP));
+
+ outtake1 = new JoystickButton(rightJoystick,
+ Constants.OI.RIGHT_JOYSTICK_OUTTAKE_1_PORT);
+ outtake1.whenPressed(new RunIntake(Constants.IntakeArm.OUT));
+ outtake1.whenReleased(new RunIntake(Constants.IntakeArm.STOP));
+
+ outtake2 = new JoystickButton(rightJoystick,
+ Constants.OI.RIGHT_JOYSTICK_OUTTAKE_2_PORT);
+ outtake2.whenPressed(new RunIntake(Constants.IntakeArm.OUT));
+ outtake2.whenReleased(new RunIntake(Constants.IntakeArm.STOP));
+
+ shooterUp = new JoystickButton(rightJoystick,
+ Constants.OI.RIGHT_JOYSTICK_SHOOTER_UP_PORT);
+ shooterUp.whenPressed(new FireCatapult());
+
+ shooterDown1 = new JoystickButton(rightJoystick,
+ Constants.OI.RIGHT_JOYSTICK_SHOOTER_DOWN_1_PORT);
+ shooterDown1.whenPressed(new ResetCatapult());
+
+ shooterDown2 = new JoystickButton(rightJoystick,
+ Constants.OI.RIGHT_JOYSTICK_SHOOTER_DOWN_2_PORT);
+ shooterDown2.whenPressed(new ResetCatapult());