1 package org
.usfirst
.frc
.team3501
.robot
;
3 import org
.usfirst
.frc
.team3501
.robot
.commands
.auton
.PassChevalDeFrise
;
4 import org
.usfirst
.frc
.team3501
.robot
.commands
.auton
.PassDrawBridge
;
5 import org
.usfirst
.frc
.team3501
.robot
.commands
.auton
.PassPortcullis
;
6 import org
.usfirst
.frc
.team3501
.robot
.commands
.auton
.PassSallyPort
;
7 import org
.usfirst
.frc
.team3501
.robot
.commands
.intakearm
.IntakeBall
;
8 import org
.usfirst
.frc
.team3501
.robot
.commands
.scaler
.ExtendLift
;
9 import org
.usfirst
.frc
.team3501
.robot
.commands
.scaler
.RetractLift
;
10 import org
.usfirst
.frc
.team3501
.robot
.commands
.shooter
.Shoot
;
11 import org
.usfirst
.frc
.team3501
.robot
.commands
.shooter
.runShooter
;
13 import edu
.wpi
.first
.wpilibj
.DigitalInput
;
14 import edu
.wpi
.first
.wpilibj
.Joystick
;
15 import edu
.wpi
.first
.wpilibj
.buttons
.Button
;
16 import edu
.wpi
.first
.wpilibj
.buttons
.JoystickButton
;
17 import edu
.wpi
.first
.wpilibj
.command
.Scheduler
;
20 public static boolean isScalingMode
= false;
21 public static boolean isCompactRobot
= false;
23 public static Joystick leftJoystick
;
24 public static Joystick rightJoystick
;
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
;
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
;
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
;
46 // right joystick buttons
47 public static Button intakeBoulder
;
48 public static Button shootBoulder
;
50 // button to change robot to the scaling mode
51 public static DigitalButton toggleScalingMode
;
54 leftJoystick
= new Joystick(Constants
.OI
.LEFT_STICK_PORT
);
55 rightJoystick
= new Joystick(Constants
.OI
.RIGHT_STICK_PORT
);
57 passPortcullis
= new DigitalButton(
58 new DigitalInput(Constants
.OI
.PASS_PORTCULLIS_PORT
));
59 passChevalDeFrise
= new DigitalButton(
60 new DigitalInput(Constants
.OI
.PASS_CHEVAL_DE_FRISE_PORT
));
61 passDrawbridge
= new DigitalButton(
62 new DigitalInput(Constants
.OI
.PASS_DRAWBRIDGE
));
63 passSallyPort
= new DigitalButton(
64 new DigitalInput(Constants
.OI
.PASS_SALLYPORT_PORT
));
66 lowerChevalDeFrise
= new DigitalButton(
67 new DigitalInput(Constants
.OI
.ARCADE_INTAKEARM_LEVEL_ONE_PORT
));
68 moveToIntakeBoulder
= new DigitalButton(
69 new DigitalInput(Constants
.OI
.ARCADE_INTAKEARM_LEVEL_TWO_PORT
));
70 poiseAboveChevalDeFrise
= new DigitalButton(
71 new DigitalInput(Constants
.OI
.ARCADE_INTAKEARM_LEVEL_THREE_PORT
));
72 moveIntakeArmInsideRobot
= new DigitalButton(
73 new DigitalInput(Constants
.OI
.ARCADE_INTAKEARM_LEVEL_FOUR_PORT
));
75 toggleShooter
= new JoystickButton(leftJoystick
,
76 Constants
.OI
.LEFT_JOYSTICK_TRIGGER_PORT
);
77 SpinRobot180_1
= new JoystickButton(leftJoystick
,
78 Constants
.OI
.LEFT_JOYSTICK_TOP_LEFT_PORT
);
79 SpinRobot180_2
= new JoystickButton(leftJoystick
,
80 Constants
.OI
.LEFT_JOYSTICK_TOP_RIGHT_PORT
);
81 compactRobot_1
= new JoystickButton(leftJoystick
,
82 Constants
.OI
.LEFT_JOYSTICK_TOP_CENTER_PORT
);
83 compactRobot_2
= new JoystickButton(leftJoystick
,
84 Constants
.OI
.LEFT_JOYSTICK_TOP_LOW_PORT
);
86 intakeBoulder
= new JoystickButton(rightJoystick
,
87 Constants
.OI
.RIGHT_JOYSTICK_TRIGGER_PORT
);
88 shootBoulder
= new JoystickButton(rightJoystick
,
89 Constants
.OI
.RIGHT_JOYSTICK_THUMB_PORT
);
91 toggleScalingMode
= new DigitalButton(
92 new DigitalInput(Constants
.OI
.SCALING_BUTTON_PORT
));
94 passPortcullis
.whenPressed(new PassPortcullis());
95 passChevalDeFrise
.whenPressed(new PassChevalDeFrise());
96 passDrawbridge
.whenPressed(new PassDrawBridge());
97 passSallyPort
.whenPressed(new PassSallyPort());
100 .whenPressed(/* TO DO: define this, and fill in commands */);
102 if (toggleScalingMode
.get()) {
103 if (!isScalingMode
) {
104 isScalingMode
= true;
105 if (!isCompactRobot
) {
106 Scheduler
.getInstance().add(new CompactRobot());
107 isCompactRobot
= true;
109 } else if (isScalingMode
) {
110 isScalingMode
= false;
111 Scheduler
.getInstance().add(new CompactRobot());
115 if (!isScalingMode
) {
116 toggleShooter
.toggleWhenPressed(new runShooter());
117 compactRobot_1
.whenPressed(new CompactRobot());
119 intakeBoulder
.whenPressed(new IntakeBall());
120 shootBoulder
.whenPressed(new Shoot());
122 } else if (isScalingMode
) {
123 toggleShooter
.toggleWhenPressed(new WinchIn());
124 compactRobot_1
.whenPressed(new RetractLift());
126 intakeBoulder
.toggleWhenPressed(new WinchOut());
127 shootBoulder
.whenPressed(new ExtendLift());
131 .whenPressed(/* rotate robot 180, reorient joystick controls */);