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