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