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