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