cc5dcc5d467bec867243f0722612c647ec0f8c43
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / OI.java
1 package org.usfirst.frc.team3501.robot;
2
3 import org.usfirst.frc.team3501.robot.commands.shooter.PrintData;
4 import org.usfirst.frc.team3501.robot.commands.shooter.RecordData;
5 import org.usfirst.frc.team3501.robot.commands.shooter.Test1;
6 import org.usfirst.frc.team3501.robot.commands.shooter.Test2;
7 import org.usfirst.frc.team3501.robot.commands.shooter.Test3;
8
9 import edu.wpi.first.wpilibj.Joystick;
10 import edu.wpi.first.wpilibj.buttons.Button;
11 import edu.wpi.first.wpilibj.buttons.JoystickButton;
12
13 public class OI {
14 public static Joystick leftJoystick;
15 public static Joystick rightJoystick;
16 public static Button recordData;
17 public static Button shoot;
18 public static Button incrementSpeed;
19 public static Button decrementSpeed;
20 public static Button printData;
21
22 // // first column of arcade buttons - getting past defenses
23 // public static DigitalButton passPortcullis;
24 // public static DigitalButton passChevalDeFrise;
25 // public static DigitalButton passDrawbridge;
26 // public static DigitalButton passSallyPort;
27 //
28 // // second column of arcade buttons - different angles for intake arm
29 // // TO DO: change position numbers to angle values (?)
30 // public static DigitalButton lowerChevalDeFrise;
31 // public static DigitalButton moveToIntakeBoulder;
32 // public static DigitalButton poiseAboveChevalDeFrise;
33 // public static DigitalButton moveIntakeArmInsideRobot;
34 //
35 // // left joystick buttons
36 public static Button toggleShooter;
37
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 //
47 // // button to change robot to the scaling mode
48 // public static DigitalButton toggleScaling;
49
50 public OI() {
51 leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT);
52 rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
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
93 recordData = new JoystickButton(leftJoystick,
94 Constants.OI.SPIN1_PORT);
95 recordData.whenPressed(new RecordData());
96
97 shoot = new JoystickButton(leftJoystick,
98 Constants.OI.LEFT_JOYSTICK_TRIGGER_PORT);
99 shoot.whenPressed(new Test1());
100
101 incrementSpeed = new JoystickButton(leftJoystick,
102 Constants.OI.LEFT_JOYSTICK_TOP_CENTER_PORT);
103 incrementSpeed.whenPressed(new Test2());
104
105 decrementSpeed = new JoystickButton(leftJoystick,
106 Constants.OI.LEFT_JOYSTICK_TOP_LOW_PORT);
107 decrementSpeed.whenPressed(new Test3());
108
109 printData = new JoystickButton(leftJoystick,
110 Constants.OI.SPIN2_PORT);
111 printData.whenPressed(new PrintData());
112
113 // SpinRobot180_1 = new JoystickButton(leftJoystick,
114 // Constants.OI.SPIN1_PORT);
115 // SpinRobot180_1.whenPressed(new Turn180());
116 //
117 // SpinRobot180_2 = new JoystickButton(leftJoystick,
118 // Constants.OI.SPIN2_PORT);
119 // SpinRobot180_2.whenPressed(new Turn180());
120 //
121 // compactRobot_1 = new JoystickButton(leftJoystick,
122 // Constants.OI.LEFT_JOYSTICK_TOP_CENTER_PORT);
123 // compactRobot_2 = new JoystickButton(leftJoystick,
124 // Constants.OI.LEFT_JOYSTICK_TOP_LOW_PORT);
125 //
126 // intakeBoulder = new JoystickButton(rightJoystick,
127 // Constants.OI.RIGHT_JOYSTICK_TRIGGER_PORT);
128 // shootBoulder = new JoystickButton(rightJoystick,
129 // Constants.OI.RIGHT_JOYSTICK_THUMB_PORT);
130 //
131 // toggleScaling = new DigitalButton(
132 // new DigitalInput(Constants.OI.TOGGLE_SCALING_PORT));
133 // toggleScaling.whenPressed(new ToggleScaling());
134 //
135 // if (!Constants.Scaler.SCALING) {
136 // toggleShooter.toggleWhenPressed(new runShooter());
137 // compactRobot_1.whenPressed(new CompactRobot());
138 // compactRobot_2.whenPressed(new CompactRobot());
139 //
140 // intakeBoulder.whenPressed(new IntakeBall());
141 // shootBoulder.whenPressed(new Shoot());
142 //
143 // } else {
144 // // toggleShooter becomes winch
145 // // compact robot button 1 and 2 retracts the lift
146 // // intake button stops the winch
147 // // shoot button extends the lift
148 // toggleShooter.whenPressed(new RunWinchContinuous(
149 // Constants.Scaler.SCALE_SPEED, Constants.Scaler.SECONDS_TO_SCALE));
150 // compactRobot_1.whenPressed(new RetractLift());
151 // compactRobot_2.whenPressed(new RetractLift());
152 //
153 // intakeBoulder.whenReleased(new StopWinch());
154 // shootBoulder.whenPressed(new ExtendLift());
155 // }
156 }
157 }