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
.PassSallyPort
;
6 import org
.usfirst
.frc
.team3501
.robot
.commands
.intakearm
.IntakeBall
;
7 import org
.usfirst
.frc
.team3501
.robot
.commands
.scaler
.ExtendLift
;
8 import org
.usfirst
.frc
.team3501
.robot
.commands
.scaler
.RetractLift
;
9 import org
.usfirst
.frc
.team3501
.robot
.commands
.shooter
.Shoot
;
10 import org
.usfirst
.frc
.team3501
.robot
.commands
.shooter
.runShooter
;
12 import edu
.wpi
.first
.wpilibj
.DigitalInput
;
13 import edu
.wpi
.first
.wpilibj
.Joystick
;
14 import edu
.wpi
.first
.wpilibj
.buttons
.Button
;
15 import edu
.wpi
.first
.wpilibj
.buttons
.JoystickButton
;
16 import edu
.wpi
.first
.wpilibj
.command
.Scheduler
;
19 public static boolean isScalingMode
= false;
20 public static boolean isCompactRobot
= false;
22 public static Joystick leftJoystick
;
23 public static Joystick rightJoystick
;
25 // first column of arcade buttons - getting past defenses
26 public static DigitalButton passPortcullis
;
27 public static DigitalButton passChevalDeFrise
;
28 public static DigitalButton passDrawbridge
;
29 public static DigitalButton passSallyPort
;
31 // second column of arcade buttons - different angles for intake arm
32 // TO DO: change position numbers to angle values (?)
33 public static DigitalButton lowerChevalDeFrise
;
34 public static DigitalButton moveToIntakeBoulder
;
35 public static DigitalButton poiseAboveChevalDeFrise
;
36 public static DigitalButton moveIntakeArmInsideRobot
;
38 // left joystick buttons
39 public static Button toggleShooter
;
40 public static Button SpinRobot180_1
; // both do the same thing, just two
41 public static Button SpinRobot180_2
; // different buttons
42 public static Button compactRobot_1
;
43 public static Button compactRobot_2
;
45 // right joystick buttons
46 public static Button intakeBoulder
;
47 public static Button shootBoulder
;
49 // button to change robot to the scaling mode
50 public static DigitalButton toggleScalingMode
;
53 leftJoystick
= new Joystick(Constants
.OI
.LEFT_STICK_PORT
);
54 rightJoystick
= new Joystick(Constants
.OI
.RIGHT_STICK_PORT
);
56 passPortcullis
= new DigitalButton(
57 new DigitalInput(Constants
.OI
.PASS_PORTCULLIS_PORT
));
58 passChevalDeFrise
= new DigitalButton(
59 new DigitalInput(Constants
.OI
.PASS_CHEVAL_DE_FRISE_PORT
));
60 passDrawbridge
= new DigitalButton(
61 new DigitalInput(Constants
.OI
.PASS_DRAWBRIDGE
));
62 passSallyPort
= new DigitalButton(
63 new DigitalInput(Constants
.OI
.PASS_SALLYPORT_PORT
));
65 lowerChevalDeFrise
= new DigitalButton(
66 new DigitalInput(Constants
.OI
.ARCADE_INTAKEARM_LEVEL_ONE_PORT
));
67 moveToIntakeBoulder
= new DigitalButton(
68 new DigitalInput(Constants
.OI
.ARCADE_INTAKEARM_LEVEL_TWO_PORT
));
69 poiseAboveChevalDeFrise
= new DigitalButton(
70 new DigitalInput(Constants
.OI
.ARCADE_INTAKEARM_LEVEL_THREE_PORT
));
71 moveIntakeArmInsideRobot
= new DigitalButton(
72 new DigitalInput(Constants
.OI
.ARCADE_INTAKEARM_LEVEL_FOUR_PORT
));
74 toggleShooter
= new JoystickButton(leftJoystick
,
75 Constants
.OI
.LEFT_JOYSTICK_TRIGGER_PORT
);
76 SpinRobot180_1
= new JoystickButton(leftJoystick
,
77 Constants
.OI
.LEFT_JOYSTICK_TOP_LEFT_PORT
);
78 SpinRobot180_2
= new JoystickButton(leftJoystick
,
79 Constants
.OI
.LEFT_JOYSTICK_TOP_RIGHT_PORT
);
80 compactRobot_1
= new JoystickButton(leftJoystick
,
81 Constants
.OI
.LEFT_JOYSTICK_TOP_CENTER_PORT
);
82 compactRobot_2
= new JoystickButton(leftJoystick
,
83 Constants
.OI
.LEFT_JOYSTICK_TOP_LOW_PORT
);
85 intakeBoulder
= new JoystickButton(rightJoystick
,
86 Constants
.OI
.RIGHT_JOYSTICK_TRIGGER_PORT
);
87 shootBoulder
= new JoystickButton(rightJoystick
,
88 Constants
.OI
.RIGHT_JOYSTICK_THUMB_PORT
);
90 toggleScalingMode
= new DigitalButton(
91 new DigitalInput(Constants
.OI
.SCALING_BUTTON_PORT
));
93 passPortcullis
.whenPressed(new PassPortcullis());
94 passChevalDeFrise
.whenPressed(new PassChevalDeFrise());
95 passDrawbridge
.whenPressed(new PassDrawBridge());
96 passSallyPort
.whenPressed(new PassSallyPort());
99 .whenPressed(/* TO DO: define this, and fill in commands */);
101 if (toggleScalingMode
.get()) {
102 if (!isScalingMode
) {
103 isScalingMode
= true;
104 if (!isCompactRobot
) {
105 Scheduler
.getInstance().add(new CompactRobot());
106 isCompactRobot
= true;
108 } else if (isScalingMode
) {
109 isScalingMode
= false;
110 Scheduler
.getInstance().add(new CompactRobot());
114 if (!isScalingMode
) {
115 toggleShooter
.toggleWhenPressed(new runShooter());
116 compactRobot_1
.whenPressed(new CompactRobot());
118 intakeBoulder
.whenPressed(new IntakeBall());
119 shootBoulder
.whenPressed(new Shoot());
121 } else if (isScalingMode
) {
122 toggleShooter
.toggleWhenPressed(new WinchIn());
123 compactRobot_1
.whenPressed(new RetractLift());
125 intakeBoulder
.toggleWhenPressed(new WinchOut());
126 shootBoulder
.whenPressed(new ExtendLift());
130 .whenPressed(/* rotate robot 180, reorient joystick controls */);