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