1 package org
.usfirst
.frc
.team3501
.robot
;
3 import org
.usfirst
.frc
.team3501
.robot
.commands
.auton
.CompactRobot
;
4 import org
.usfirst
.frc
.team3501
.robot
.commands
.auton
.PassChevalDeFrise
;
5 import org
.usfirst
.frc
.team3501
.robot
.commands
.auton
.PassDrawBridge
;
6 import org
.usfirst
.frc
.team3501
.robot
.commands
.auton
.PassPortcullis
;
7 import org
.usfirst
.frc
.team3501
.robot
.commands
.auton
.PassSallyPort
;
8 import org
.usfirst
.frc
.team3501
.robot
.commands
.driving
.Turn180
;
9 import org
.usfirst
.frc
.team3501
.robot
.commands
.intakearm
.IntakeBall
;
10 import org
.usfirst
.frc
.team3501
.robot
.commands
.intakearm
.MoveIntakeArmToAngle
;
11 import org
.usfirst
.frc
.team3501
.robot
.commands
.scaler
.ExtendLift
;
12 import org
.usfirst
.frc
.team3501
.robot
.commands
.scaler
.RetractLift
;
13 import org
.usfirst
.frc
.team3501
.robot
.commands
.scaler
.RunWinchContinuous
;
14 import org
.usfirst
.frc
.team3501
.robot
.commands
.scaler
.StopWinch
;
15 import org
.usfirst
.frc
.team3501
.robot
.commands
.shooter
.Shoot
;
16 import org
.usfirst
.frc
.team3501
.robot
.commands
.shooter
.runShooter
;
17 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.IntakeArm
;
19 import edu
.wpi
.first
.wpilibj
.DigitalInput
;
20 import edu
.wpi
.first
.wpilibj
.Joystick
;
21 import edu
.wpi
.first
.wpilibj
.buttons
.Button
;
22 import edu
.wpi
.first
.wpilibj
.buttons
.JoystickButton
;
23 import edu
.wpi
.first
.wpilibj
.command
.Scheduler
;
26 public static boolean isScalingMode
= false;
27 public static boolean isCompactRobot
= false;
29 public static Joystick leftJoystick
;
30 public static Joystick rightJoystick
;
32 // first column of arcade buttons - getting past defenses
33 public static DigitalButton passPortcullis
;
34 public static DigitalButton passChevalDeFrise
;
35 public static DigitalButton passDrawbridge
;
36 public static DigitalButton passSallyPort
;
38 // second column of arcade buttons - different angles for intake arm
39 // TO DO: change position numbers to angle values (?)
40 public static DigitalButton lowerChevalDeFrise
;
41 public static DigitalButton moveToIntakeBoulder
;
42 public static DigitalButton poiseAboveChevalDeFrise
;
43 public static DigitalButton moveIntakeArmInsideRobot
;
45 // left joystick buttons
46 public static Button toggleShooter
;
47 public static Button SpinRobot180_1
; // both do the same thing, just two
48 public static Button SpinRobot180_2
; // different buttons
49 public static Button compactRobot_1
;
50 public static Button compactRobot_2
;
52 // right joystick buttons
53 public static Button intakeBoulder
;
54 public static Button shootBoulder
;
56 // button to change robot to the scaling mode
57 public static DigitalButton toggleScalingMode
;
60 leftJoystick
= new Joystick(Constants
.OI
.LEFT_STICK_PORT
);
61 rightJoystick
= new Joystick(Constants
.OI
.RIGHT_STICK_PORT
);
63 passPortcullis
= new DigitalButton(
64 new DigitalInput(Constants
.OI
.PASS_PORTCULLIS_PORT
));
65 passChevalDeFrise
= new DigitalButton(
66 new DigitalInput(Constants
.OI
.PASS_CHEVAL_DE_FRISE_PORT
));
67 passDrawbridge
= new DigitalButton(
68 new DigitalInput(Constants
.OI
.PASS_DRAWBRIDGE
));
69 passSallyPort
= new DigitalButton(
70 new DigitalInput(Constants
.OI
.PASS_SALLYPORT_PORT
));
72 lowerChevalDeFrise
= new DigitalButton(
73 new DigitalInput(Constants
.OI
.ARCADE_INTAKEARM_LEVEL_ONE_PORT
));
74 moveToIntakeBoulder
= new DigitalButton(
75 new DigitalInput(Constants
.OI
.ARCADE_INTAKEARM_LEVEL_TWO_PORT
));
76 poiseAboveChevalDeFrise
= new DigitalButton(
77 new DigitalInput(Constants
.OI
.ARCADE_INTAKEARM_LEVEL_THREE_PORT
));
78 moveIntakeArmInsideRobot
= new DigitalButton(
79 new DigitalInput(Constants
.OI
.ARCADE_INTAKEARM_LEVEL_FOUR_PORT
));
81 toggleShooter
= new JoystickButton(leftJoystick
,
82 Constants
.OI
.LEFT_JOYSTICK_TRIGGER_PORT
);
83 SpinRobot180_1
= new JoystickButton(leftJoystick
,
84 Constants
.OI
.LEFT_JOYSTICK_TOP_LEFT_PORT
);
85 SpinRobot180_2
= new JoystickButton(leftJoystick
,
86 Constants
.OI
.LEFT_JOYSTICK_TOP_RIGHT_PORT
);
87 compactRobot_1
= new JoystickButton(leftJoystick
,
88 Constants
.OI
.LEFT_JOYSTICK_TOP_CENTER_PORT
);
89 compactRobot_2
= new JoystickButton(leftJoystick
,
90 Constants
.OI
.LEFT_JOYSTICK_TOP_LOW_PORT
);
92 intakeBoulder
= new JoystickButton(rightJoystick
,
93 Constants
.OI
.RIGHT_JOYSTICK_TRIGGER_PORT
);
94 shootBoulder
= new JoystickButton(rightJoystick
,
95 Constants
.OI
.RIGHT_JOYSTICK_THUMB_PORT
);
97 toggleScalingMode
= new DigitalButton(
98 new DigitalInput(Constants
.OI
.SCALING_BUTTON_PORT
));
100 passPortcullis
.whenPressed(new PassPortcullis());
101 passChevalDeFrise
.whenPressed(new PassChevalDeFrise());
102 passDrawbridge
.whenPressed(new PassDrawBridge());
103 passSallyPort
.whenPressed(new PassSallyPort());
105 lowerChevalDeFrise
.whenPressed(new MoveIntakeArmToAngle(
106 IntakeArm
.potAngles
[0], IntakeArm
.moveIntakeArmSpeed
));
107 moveToIntakeBoulder
.whenPressed(new MoveIntakeArmToAngle(
108 IntakeArm
.potAngles
[1], IntakeArm
.moveIntakeArmSpeed
));
109 poiseAboveChevalDeFrise
.whenPressed(new MoveIntakeArmToAngle(
110 IntakeArm
.potAngles
[2], IntakeArm
.moveIntakeArmSpeed
));
111 moveIntakeArmInsideRobot
.whenPressed(new MoveIntakeArmToAngle(
112 IntakeArm
.potAngles
[3], IntakeArm
.moveIntakeArmSpeed
));
114 if (toggleScalingMode
.get()) {
115 if (!isScalingMode
) {
116 isScalingMode
= true;
117 if (!isCompactRobot
) {
118 Scheduler
.getInstance().add(new CompactRobot());
119 isCompactRobot
= true;
121 } else if (isScalingMode
) {
122 isScalingMode
= false;
123 Scheduler
.getInstance().add(new CompactRobot());
127 if (!isScalingMode
) {
128 toggleShooter
.toggleWhenPressed(new runShooter());
129 compactRobot_1
.whenPressed(new CompactRobot());
130 compactRobot_2
.whenPressed(new CompactRobot());
132 intakeBoulder
.whenPressed(new IntakeBall());
133 shootBoulder
.whenPressed(new Shoot());
135 } else if (isScalingMode
) {
136 toggleShooter
.whenPressed(new RunWinchContinuous(
137 Constants
.Scaler
.WINCH_IN_SPEED
));
138 compactRobot_1
.whenPressed(new RetractLift());
139 compactRobot_2
.whenPressed(new RetractLift());
141 intakeBoulder
.whenReleased(new StopWinch());
142 shootBoulder
.whenPressed(new ExtendLift());
145 SpinRobot180_1
.whenPressed(new Turn180());
146 SpinRobot180_2
.whenPressed(new Turn180());