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