| 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.intakearm.RunBothIntakeMotors; |
| 5 | import org.usfirst.frc.team3501.robot.commands.intakearm.RunIntakeMotor; |
| 6 | import org.usfirst.frc.team3501.robot.commands.shooter.Shoot; |
| 7 | |
| 8 | import edu.wpi.first.wpilibj.Joystick; |
| 9 | import edu.wpi.first.wpilibj.buttons.Button; |
| 10 | import edu.wpi.first.wpilibj.buttons.JoystickButton; |
| 11 | |
| 12 | public class OI { |
| 13 | public static Joystick leftJoystick; |
| 14 | public static Joystick rightJoystick; |
| 15 | |
| 16 | public static Button leftIntakeArmMotorUp; |
| 17 | public static Button leftIntakeArmMotorDown; |
| 18 | public static Button rightIntakeArmMotorUp; |
| 19 | public static Button rightIntakeArmMotorDown; |
| 20 | public static Button bothIntakeArmMotorUp; |
| 21 | public static Button bothIntakeArmMotorDown; |
| 22 | |
| 23 | // // first column of arcade buttons - getting past defenses |
| 24 | // public static DigitalButton passPortcullis; |
| 25 | // public static DigitalButton passChevalDeFrise; |
| 26 | // public static DigitalButton passDrawbridge; |
| 27 | // public static DigitalButton passSallyPort; |
| 28 | // |
| 29 | // // second column of arcade buttons - different angles for intake arm |
| 30 | // // TO DO: change position numbers to angle values (?) |
| 31 | // public static DigitalButton lowerChevalDeFrise; |
| 32 | // public static DigitalButton moveToIntakeBoulder; |
| 33 | // public static DigitalButton poiseAboveChevalDeFrise; |
| 34 | // public static DigitalButton moveIntakeArmInsideRobot; |
| 35 | // |
| 36 | // // left joystick buttons |
| 37 | // public static Button toggleShooter; |
| 38 | // public static Button SpinRobot180_1; // both do the same thing, just two |
| 39 | // public static Button SpinRobot180_2; // different buttons |
| 40 | // public static Button compactRobot_1; |
| 41 | // public static Button compactRobot_2; |
| 42 | // |
| 43 | // right joystick buttons |
| 44 | public static Button intakeBoulder; |
| 45 | public static Button shootBoulder; |
| 46 | public static Button toggleGear; |
| 47 | |
| 48 | // |
| 49 | // // button to change robot to the scaling mode |
| 50 | // public static DigitalButton toggleScaling; |
| 51 | |
| 52 | public OI() { |
| 53 | leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT); |
| 54 | rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT); |
| 55 | |
| 56 | toggleGear = new JoystickButton(leftJoystick, |
| 57 | Constants.OI.LEFT_JOYSTICK_TOP_CENTER_PORT); |
| 58 | toggleGear.toggleWhenPressed(new ChangeGear()); |
| 59 | |
| 60 | shootBoulder = new JoystickButton(leftJoystick, |
| 61 | Constants.OI.LEFT_JOYSTICK_TRIGGER_PORT); |
| 62 | shootBoulder.whenPressed(new Shoot()); |
| 63 | |
| 64 | leftIntakeArmMotorUp = new JoystickButton(leftJoystick, |
| 65 | Constants.OI.LEFT_JOYSTICK_BOTTOM_LEFT_FORWARD_BUTTON); |
| 66 | leftIntakeArmMotorUp |
| 67 | .whenPressed(new RunIntakeMotor( |
| 68 | Robot.intakeArm.getLeftIntakeArmMotor(), |
| 69 | Constants.IntakeArm.DEFAULT_INTAKE_ARM_SPEED)); |
| 70 | leftIntakeArmMotorDown = new JoystickButton(leftJoystick, |
| 71 | Constants.OI.LEFT_JOYSTICK_BOTTOM_LEFT_BACK_BUTTON); |
| 72 | leftIntakeArmMotorDown |
| 73 | .whenPressed(new RunIntakeMotor( |
| 74 | Robot.intakeArm.getLeftIntakeArmMotor(), |
| 75 | -Constants.IntakeArm.DEFAULT_INTAKE_ARM_SPEED)); |
| 76 | |
| 77 | rightIntakeArmMotorUp = new JoystickButton(leftJoystick, |
| 78 | Constants.OI.LEFT_JOYSTICK_BOTTOM_RIGHT_FORWARD_BUTTON); |
| 79 | rightIntakeArmMotorUp |
| 80 | .whenPressed(new RunIntakeMotor(Robot.intakeArm |
| 81 | .getRightIntakeArmMotor(), |
| 82 | Constants.IntakeArm.DEFAULT_INTAKE_ARM_SPEED)); |
| 83 | rightIntakeArmMotorDown = new JoystickButton(leftJoystick, |
| 84 | Constants.OI.LEFT_JOYSTICK_BOTTOM_RIGHT_BACK_BUTTON); |
| 85 | rightIntakeArmMotorDown.whenPressed(new RunIntakeMotor(Robot.intakeArm |
| 86 | .getRightIntakeArmMotor(), |
| 87 | -Constants.IntakeArm.DEFAULT_INTAKE_ARM_SPEED)); |
| 88 | |
| 89 | bothIntakeArmMotorUp = new JoystickButton(leftJoystick, |
| 90 | Constants.OI.LEFT_JOYSTICK_BOTTOM_BACK_LEFT_BUTTON); |
| 91 | bothIntakeArmMotorUp.whenPressed(new RunBothIntakeMotors( |
| 92 | Constants.IntakeArm.DEFAULT_INTAKE_ARM_SPEED)); |
| 93 | bothIntakeArmMotorDown = new JoystickButton(leftJoystick, |
| 94 | Constants.OI.LEFT_JOYSTICK_BOTTOM_BACK_RIGHT_BUTTON); |
| 95 | bothIntakeArmMotorDown.whenPressed(new RunBothIntakeMotors( |
| 96 | -Constants.IntakeArm.DEFAULT_INTAKE_ARM_SPEED)); |
| 97 | |
| 98 | // passPortcullis = new DigitalButton( |
| 99 | // new DigitalInput(Constants.OI.PASS_PORTCULLIS_PORT)); |
| 100 | // passPortcullis.whenPressed(new PassPortcullis()); |
| 101 | // |
| 102 | // passChevalDeFrise = new DigitalButton( |
| 103 | // new DigitalInput(Constants.OI.PASS_CHEVAL_DE_FRISE_PORT)); |
| 104 | // passChevalDeFrise.whenPressed(new PassChevalDeFrise()); |
| 105 | // |
| 106 | // passDrawbridge = new DigitalButton( |
| 107 | // new DigitalInput(Constants.OI.PASS_DRAWBRIDGE_PORT)); |
| 108 | // passDrawbridge.whenPressed(new PassDrawBridge()); |
| 109 | // |
| 110 | // passSallyPort = new DigitalButton( |
| 111 | // new DigitalInput(Constants.OI.PASS_SALLYPORT_PORT)); |
| 112 | // passSallyPort.whenPressed(new PassSallyPort()); |
| 113 | // |
| 114 | // lowerChevalDeFrise = new DigitalButton( |
| 115 | // new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_ONE_PORT)); |
| 116 | // lowerChevalDeFrise.whenPressed(new MoveIntakeArmToAngle( |
| 117 | // IntakeArm.potAngles[0], IntakeArm.moveIntakeArmSpeed)); |
| 118 | // |
| 119 | // moveToIntakeBoulder = new DigitalButton( |
| 120 | // new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_TWO_PORT)); |
| 121 | // moveToIntakeBoulder.whenPressed(new MoveIntakeArmToAngle( |
| 122 | // IntakeArm.potAngles[1], IntakeArm.moveIntakeArmSpeed)); |
| 123 | // |
| 124 | // poiseAboveChevalDeFrise = new DigitalButton( |
| 125 | // new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_THREE_PORT)); |
| 126 | // poiseAboveChevalDeFrise.whenPressed(new MoveIntakeArmToAngle( |
| 127 | // IntakeArm.potAngles[2], IntakeArm.moveIntakeArmSpeed)); |
| 128 | // |
| 129 | // moveIntakeArmInsideRobot = new DigitalButton( |
| 130 | // new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_FOUR_PORT)); |
| 131 | // moveIntakeArmInsideRobot.whenPressed(new MoveIntakeArmToAngle( |
| 132 | // IntakeArm.potAngles[3], IntakeArm.moveIntakeArmSpeed)); |
| 133 | // |
| 134 | // toggleShooter = new JoystickButton(leftJoystick, |
| 135 | // Constants.OI.LEFT_JOYSTICK_TRIGGER_PORT); |
| 136 | // SpinRobot180_1 = new JoystickButton(leftJoystick, |
| 137 | // Constants.OI.SPIN1_PORT); |
| 138 | // SpinRobot180_1.whenPressed(new Turn180()); |
| 139 | // |
| 140 | // SpinRobot180_2 = new JoystickButton(leftJoystick, |
| 141 | // Constants.OI.SPIN2_PORT); |
| 142 | // SpinRobot180_2.whenPressed(new Turn180()); |
| 143 | // |
| 144 | // compactRobot_1 = new JoystickButton(leftJoystick, |
| 145 | // Constants.OI.LEFT_JOYSTICK_TOP_CENTER_PORT); |
| 146 | // compactRobot_2 = new JoystickButton(leftJoystick, |
| 147 | // Constants.OI.LEFT_JOYSTICK_TOP_LOW_PORT); |
| 148 | // |
| 149 | // intakeBoulder = new JoystickButton(rightJoystick, |
| 150 | // Constants.OI.RIGHT_JOYSTICK_TRIGGER_PORT); |
| 151 | // shootBoulder = new JoystickButton(rightJoystick, |
| 152 | // Constants.OI.RIGHT_JOYSTICK_THUMB_PORT); |
| 153 | // |
| 154 | // toggleScaling = new DigitalButton( |
| 155 | // new DigitalInput(Constants.OI.TOGGLE_SCALING_PORT)); |
| 156 | // toggleScaling.whenPressed(new ToggleScaling()); |
| 157 | // |
| 158 | // if (!Constants.Scaler.SCALING) { |
| 159 | // toggleShooter.toggleWhenPressed(new runShooter()); |
| 160 | // compactRobot_1.whenPressed(new CompactRobot()); |
| 161 | // compactRobot_2.whenPressed(new CompactRobot()); |
| 162 | // |
| 163 | // intakeBoulder.whenPressed(new IntakeBall()); |
| 164 | // shootBoulder.whenPressed(new Shoot()); |
| 165 | // |
| 166 | // } else { |
| 167 | // // toggleShooter becomes winch |
| 168 | // // compact robot button 1 and 2 retracts the lift |
| 169 | // // intake button stops the winch |
| 170 | // // shoot button extends the lift |
| 171 | // toggleShooter.whenPressed(new RunWinchContinuous( |
| 172 | // Constants.Scaler.SCALE_SPEED, Constants.Scaler.SECONDS_TO_SCALE)); |
| 173 | // compactRobot_1.whenPressed(new RetractLift()); |
| 174 | // compactRobot_2.whenPressed(new RetractLift()); |
| 175 | // |
| 176 | // intakeBoulder.whenReleased(new StopWinch()); |
| 177 | // shootBoulder.whenPressed(new ExtendLift()); |
| 178 | // } |
| 179 | } |
| 180 | } |