| 1 | package org.usfirst.frc.team3501.robot; |
| 2 | |
| 3 | import org.usfirst.frc.team3501.robot.commands.driving.ChangeGear; |
| 4 | import org.usfirst.frc.team3501.robot.commands.shooter.Shoot; |
| 5 | |
| 6 | import edu.wpi.first.wpilibj.Joystick; |
| 7 | import edu.wpi.first.wpilibj.buttons.Button; |
| 8 | import edu.wpi.first.wpilibj.buttons.JoystickButton; |
| 9 | |
| 10 | public class OI { |
| 11 | public static Joystick leftJoystick; |
| 12 | public static Joystick rightJoystick; |
| 13 | |
| 14 | // first column of arcade buttons - getting past defenses |
| 15 | public static DigitalButton passPortcullis; |
| 16 | public static DigitalButton passChevalDeFrise; |
| 17 | public static DigitalButton passDrawbridge; |
| 18 | public static DigitalButton passSallyPort; |
| 19 | |
| 20 | // second column of arcade buttons - different angles for intake arm |
| 21 | // TO DO: change position numbers to angle values (?) |
| 22 | public static DigitalButton lowerChevalDeFrise; |
| 23 | public static DigitalButton moveToIntakeBoulder; |
| 24 | public static DigitalButton poiseAboveChevalDeFrise; |
| 25 | public static DigitalButton moveIntakeArmInsideRobot; |
| 26 | |
| 27 | // left joystick buttons |
| 28 | public static Button toggleShooter; |
| 29 | public static Button SpinRobot180_1; // both do the same thing, just two |
| 30 | public static Button SpinRobot180_2; // different buttons |
| 31 | public static Button compactRobot_1; |
| 32 | public static Button compactRobot_2; |
| 33 | |
| 34 | // right joystick buttons |
| 35 | public static Button intakeBoulder; |
| 36 | public static Button shootBoulder; |
| 37 | public static Button toggleGear; |
| 38 | |
| 39 | // button to change robot to the scaling mode |
| 40 | public static DigitalButton toggleScaling; |
| 41 | |
| 42 | public OI() { |
| 43 | leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT); |
| 44 | rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT); |
| 45 | |
| 46 | toggleGear = new JoystickButton(leftJoystick, |
| 47 | Constants.OI.LEFT_JOYSTICK_TOP_CENTER_PORT); |
| 48 | toggleGear.toggleWhenPressed(new ChangeGear()); |
| 49 | |
| 50 | shootBoulder = new JoystickButton(leftJoystick, |
| 51 | Constants.OI.LEFT_JOYSTICK_TRIGGER_PORT); |
| 52 | shootBoulder.whenPressed(new Shoot()); |
| 53 | |
| 54 | // passPortcullis = new DigitalButton( |
| 55 | // new DigitalInput(Constants.OI.PASS_PORTCULLIS_PORT)); |
| 56 | // passPortcullis.whenPressed(new PassPortcullis()); |
| 57 | // |
| 58 | // passChevalDeFrise = new DigitalButton( |
| 59 | // new DigitalInput(Constants.OI.PASS_CHEVAL_DE_FRISE_PORT)); |
| 60 | // passChevalDeFrise.whenPressed(new PassChevalDeFrise()); |
| 61 | // |
| 62 | // passDrawbridge = new DigitalButton( |
| 63 | // new DigitalInput(Constants.OI.PASS_DRAWBRIDGE_PORT)); |
| 64 | // passDrawbridge.whenPressed(new PassDrawBridge()); |
| 65 | // |
| 66 | // passSallyPort = new DigitalButton( |
| 67 | // new DigitalInput(Constants.OI.PASS_SALLYPORT_PORT)); |
| 68 | // passSallyPort.whenPressed(new PassSallyPort()); |
| 69 | // |
| 70 | // lowerChevalDeFrise = new DigitalButton( |
| 71 | // new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_ONE_PORT)); |
| 72 | // lowerChevalDeFrise.whenPressed(new MoveIntakeArmToAngle( |
| 73 | // IntakeArm.potAngles[0], IntakeArm.moveIntakeArmSpeed)); |
| 74 | // |
| 75 | // moveToIntakeBoulder = new DigitalButton( |
| 76 | // new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_TWO_PORT)); |
| 77 | // moveToIntakeBoulder.whenPressed(new MoveIntakeArmToAngle( |
| 78 | // IntakeArm.potAngles[1], IntakeArm.moveIntakeArmSpeed)); |
| 79 | // |
| 80 | // poiseAboveChevalDeFrise = new DigitalButton( |
| 81 | // new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_THREE_PORT)); |
| 82 | // poiseAboveChevalDeFrise.whenPressed(new MoveIntakeArmToAngle( |
| 83 | // IntakeArm.potAngles[2], IntakeArm.moveIntakeArmSpeed)); |
| 84 | // |
| 85 | // moveIntakeArmInsideRobot = new DigitalButton( |
| 86 | // new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_FOUR_PORT)); |
| 87 | // moveIntakeArmInsideRobot.whenPressed(new MoveIntakeArmToAngle( |
| 88 | // IntakeArm.potAngles[3], IntakeArm.moveIntakeArmSpeed)); |
| 89 | // |
| 90 | // toggleShooter = new JoystickButton(leftJoystick, |
| 91 | // Constants.OI.LEFT_JOYSTICK_TRIGGER_PORT); |
| 92 | // SpinRobot180_1 = new JoystickButton(leftJoystick, |
| 93 | // Constants.OI.SPIN1_PORT); |
| 94 | // SpinRobot180_1.whenPressed(new Turn180()); |
| 95 | // |
| 96 | // SpinRobot180_2 = new JoystickButton(leftJoystick, |
| 97 | // Constants.OI.SPIN2_PORT); |
| 98 | // SpinRobot180_2.whenPressed(new Turn180()); |
| 99 | // |
| 100 | // compactRobot_1 = new JoystickButton(leftJoystick, |
| 101 | // Constants.OI.LEFT_JOYSTICK_TOP_CENTER_PORT); |
| 102 | // compactRobot_2 = new JoystickButton(leftJoystick, |
| 103 | // Constants.OI.LEFT_JOYSTICK_TOP_LOW_PORT); |
| 104 | // |
| 105 | // intakeBoulder = new JoystickButton(rightJoystick, |
| 106 | // Constants.OI.RIGHT_JOYSTICK_TRIGGER_PORT); |
| 107 | // shootBoulder = new JoystickButton(rightJoystick, |
| 108 | // Constants.OI.RIGHT_JOYSTICK_THUMB_PORT); |
| 109 | // |
| 110 | // toggleScaling = new DigitalButton( |
| 111 | // new DigitalInput(Constants.OI.TOGGLE_SCALING_PORT)); |
| 112 | // toggleScaling.whenPressed(new ToggleScaling()); |
| 113 | // |
| 114 | // if (!Constants.Scaler.SCALING) { |
| 115 | // toggleShooter.toggleWhenPressed(new runShooter()); |
| 116 | // compactRobot_1.whenPressed(new CompactRobot()); |
| 117 | // compactRobot_2.whenPressed(new CompactRobot()); |
| 118 | // |
| 119 | // intakeBoulder.whenPressed(new IntakeBall()); |
| 120 | // shootBoulder.whenPressed(new Shoot()); |
| 121 | // |
| 122 | // } else { |
| 123 | // // toggleShooter becomes winch |
| 124 | // // compact robot button 1 and 2 retracts the lift |
| 125 | // // intake button stops the winch |
| 126 | // // shoot button extends the lift |
| 127 | // toggleShooter.whenPressed(new RunWinchContinuous( |
| 128 | // Constants.Scaler.SCALE_SPEED, Constants.Scaler.SECONDS_TO_SCALE)); |
| 129 | // compactRobot_1.whenPressed(new RetractLift()); |
| 130 | // compactRobot_2.whenPressed(new RetractLift()); |
| 131 | // |
| 132 | // intakeBoulder.whenReleased(new StopWinch()); |
| 133 | // shootBoulder.whenPressed(new ExtendLift()); |
| 134 | // } |
| 135 | } |
| 136 | } |