19
19
20
20
import org .mayheminc .robot2020 .autonomousroutines .*;
21
21
import org .mayheminc .robot2020 .commands .*;
22
+ import org .mayheminc .robot2020 .commands .DriveStraightOnHeading .DistanceUnits ;
22
23
import org .mayheminc .robot2020 .subsystems .*;
23
24
24
25
/**
@@ -32,8 +33,11 @@ public class RobotContainer {
32
33
// The robot's subsystems and commands are defined here...
33
34
34
35
public static final Climber climber = new Climber ();
35
- public static final Magazine magazine = new Magazine ();
36
- public static final Shooter shooter = new Shooter ();
36
+ public static final Revolver revolver = new Revolver ();
37
+ public static final ShooterWheel shooterWheel = new ShooterWheel ();
38
+ public static final Hood hood = new Hood ();
39
+ public static final Turret turret = new Turret ();
40
+ public static final Feeder feeder = new Feeder ();
37
41
public static final Drive drive = new Drive ();
38
42
public static final Intake intake = new Intake ();
39
43
public static final Autonomous autonomous = new Autonomous ();
@@ -62,40 +66,55 @@ public RobotContainer() {
62
66
pidtuner = new PidTuner (RobotContainer .DRIVER_STICK .DRIVER_STICK_ENA_BUTTON_SIX ,
63
67
RobotContainer .DRIVER_STICK .DRIVER_STICK_ENA_BUTTON_SEVEN ,
64
68
RobotContainer .DRIVER_STICK .DRIVER_STICK_ENA_BUTTON_ELEVEN ,
65
- RobotContainer .DRIVER_STICK .DRIVER_STICK_ENA_BUTTON_TEN , shooter );
69
+ RobotContainer .DRIVER_STICK .DRIVER_STICK_ENA_BUTTON_TEN , drive );
66
70
67
71
cameraLights .set (true );
68
72
}
69
73
70
74
public static void init () {
71
- shooter .init ();
75
+ shooterWheel .init ();
76
+ }
77
+
78
+ public static void safetyInit () {
79
+ hood .setVBus (0.0 );
80
+ turret .setVBus (0.0 );
81
+ climber .setPistons (false );
72
82
}
73
83
74
84
private void configureDefaultCommands () {
75
85
drive .setDefaultCommand (new DriveDefault ());
76
86
// intake.setDefaultCommand(new IntakeExtenderVBus());
77
- magazine .setDefaultCommand (new MagazineDefault ());
78
-
79
- // TODO: Figure out if the current approach of "AirCompressorDefault()" is the way to go for compressor control.
80
- // KBS doesn't think the below is the right way to have the compressor be on "by default" because
81
- // it would require there to always be a command running to keep the compressor off. However, that
82
- // is a good way to ensure it doesn't get left off by accident. Not quite sure how to handle this;
83
- // would really rather that other commands which need the compressor off (such as a high-power command
84
- // which wants all the battery power available) would turn the compressor off when the command starts
85
- // and off when the command ends.) Then again, maybe the "defaultCommand" is a good way to do this
87
+ revolver .setDefaultCommand (new RevolverDefault ());
88
+
89
+ // KBS doesn't think the below is the right way to have the compressor be on "by
90
+ // default" because it would require there to always be a command running to
91
+ // keep the compressor off.
92
+ // However, that is a good way to ensure it doesn't get left off by accident.
93
+ // Not quite sure how to handle this;
94
+ // would really rather that other commands which need the compressor off (such
95
+ // as a high-power command which wants all the battery power available) would
96
+ // turn the compressor off when the command starts and off when the command
97
+ // ends.) Then again, maybe the "defaultCommand" is a good way to do this
86
98
// and I just don't understand the style yet.
87
- compressor .setDefaultCommand (new AirCompressorDefault ());
99
+ // compressor.setDefaultCommand(new AirCompressorDefault());
88
100
}
89
101
90
102
private void configureAutonomousPrograms () {
91
103
LinkedList <Command > autonomousPrograms = new LinkedList <Command >();
92
- // TODO: fix "wierdness" with auto program selection - sometimes doesn't seem to work
93
- // TODO: fix so that auto program is shown not just when changed (as shows old setting sometimes)
94
-
95
- // autonomousPrograms.push(/* 01 */ new StayStill());
96
- autonomousPrograms .push (/* 00 */ new TrenchAuto ());
97
- // autonomousPrograms.push( new ShooterReadyAimFire());
98
- // autonomousPrograms.push(new TestTurret());
104
+
105
+ autonomousPrograms .push (/* 12 */ new StayStill ());
106
+ autonomousPrograms .push (/* 11 */ new StartBWDriveOnlyToRP ());
107
+ autonomousPrograms .push (/* 10 */ new StartBWDriveOnlyToWall ());
108
+ autonomousPrograms .push (/* 09 */ new StartFWDriveOnlyToRP ());
109
+ autonomousPrograms .push (/* 08 */ new StartFWDriveOnlyToWall ());
110
+ autonomousPrograms .push (/* 07 */ new StartBWShoot3ThenToRP ());
111
+ autonomousPrograms .push (/* 06 */ new StartBWShoot3ThenToWall ());
112
+ autonomousPrograms .push (/* 05 */ new StartFWShoot3ThenToRP ());
113
+ autonomousPrograms .push (/* 04 */ new StartFWShoot3ThenToWall ());
114
+ autonomousPrograms .push (/* 03 */ new StartFWRendezvous ());
115
+ autonomousPrograms .push (/* 02 */ new StartBWOppTrench ());
116
+ autonomousPrograms .push (/* 01 */ new StartBWTrench3 ());
117
+ autonomousPrograms .push (/* 00 */ new StartBWTrench5 ());
99
118
100
119
autonomous .setAutonomousPrograms (autonomousPrograms );
101
120
@@ -155,8 +174,8 @@ private void configureDriverPadButtons() {
155
174
// about -30 degrees
156
175
// DRIVER_PAD.DRIVER_PAD_D_PAD_RIGHT.whileHeld(new
157
176
// ShooterSetTurretVBus(+0.2));// about +30 degrees
158
- DRIVER_PAD .DRIVER_PAD_D_PAD_UP .whenPressed (new ShooterSetHoodAbs ( Shooter . HOOD_INITIATION_LINE_POSITION ));
159
- DRIVER_PAD .DRIVER_PAD_D_PAD_DOWN .whenPressed (new ShooterSetHoodAbs ( Shooter . HOOD_TARGET_ZONE_POSITION ));
177
+ DRIVER_PAD .DRIVER_PAD_D_PAD_UP .whenPressed (new HoodSetAbsWhileHeld ( Hood . INITIATION_LINE_POSITION ));
178
+ DRIVER_PAD .DRIVER_PAD_D_PAD_DOWN .whenPressed (new HoodSetAbsWhileHeld ( Hood . STARTING_POSITION ));
160
179
161
180
// DRIVER_PAD.DRIVER_PAD_D_PAD_LEFT.whenPressed(new
162
181
// ShooterSetTurretRel(-200.0));
@@ -173,52 +192,59 @@ private void configureDriverPadButtons() {
173
192
// DRIVER_PAD.DRIVER_PAD_D_PAD_DOWN.whileHeld(new ShooterSetHoodVBus(-1.0));
174
193
175
194
// Debug shooter pid velocity
176
- DRIVER_PAD .DRIVER_PAD_BLUE_BUTTON .whenPressed (new ShooterAdjustWheel (100.0 ));
177
- DRIVER_PAD .DRIVER_PAD_GREEN_BUTTON .whenPressed (new ShooterAdjustWheel (-100.0 ));
178
- DRIVER_PAD .DRIVER_PAD_RED_BUTTON .whenPressed (new ShooterSetWheelVBus (0.0 ));
179
- DRIVER_PAD .DRIVER_PAD_YELLOW_BUTTON .whenPressed (new ShooterSetWheel (3000 ));
180
- // TODO: above hard-coded constant (3000) should be a named constant from Shooter.java
195
+ DRIVER_PAD .DRIVER_PAD_BLUE_BUTTON .whenPressed (new ShooterWheelAdjust (50.0 ));
196
+ DRIVER_PAD .DRIVER_PAD_GREEN_BUTTON .whenPressed (new ShooterWheelAdjust (-50.0 ));
197
+ DRIVER_PAD .DRIVER_PAD_RED_BUTTON .whenPressed (new ShooterWheelSetVBus (0.0 ));
198
+ DRIVER_PAD .DRIVER_PAD_YELLOW_BUTTON .whenPressed (new ShooterWheelSet (ShooterWheel .INITIATION_LINE_SPEED ));
199
+
200
+ DRIVER_PAD .DRIVER_PAD_LEFT_UPPER_TRIGGER_BUTTON .whenHeld (new ShooterFiringSequence (60.0 ));
201
+ DRIVER_PAD .DRIVER_PAD_LEFT_UPPER_TRIGGER_BUTTON .whenReleased (new ShooterCeaseFire ());
181
202
182
- DRIVER_PAD .DRIVER_PAD_LEFT_UPPER_TRIGGER_BUTTON .whileHeld (new ShooterSetFeeder (1.0 ));
203
+ DRIVER_PAD .DRIVER_PAD_LEFT_LOWER_TRIGGER_BUTTON .whileHeld (new ShooterCloseFiringSequence (60.0 ));
204
+ DRIVER_PAD .DRIVER_PAD_LEFT_LOWER_TRIGGER_BUTTON .whenReleased (new ShooterCeaseFire ());
205
+
206
+ DRIVER_PAD .DRIVER_PAD_BACK_BUTTON .whenPressed (new DriveStraightOnHeading (-0.3 , DistanceUnits .INCHES , 240 , 0 ));
207
+ DRIVER_PAD .DRIVER_PAD_START_BUTTON .whenPressed (new DriveStraightOnHeading (0.3 , DistanceUnits .INCHES , 240 , 0 ));
208
+
209
+ // DRIVER_PAD.DRIVER_PAD_LEFT_LOWER_TRIGGER_BUTTON.whileHeld(new
210
+ // FeederSet(1.0));
183
211
184
212
}
185
213
186
214
private void configureOperatorStickButtons () {
187
215
}
188
216
189
217
private void configureOperatorPadButtons () {
190
- OPERATOR_PAD .OPERATOR_PAD_BUTTON_ONE .whileHeld (new MagazineSetTurntable (0.2 ));
191
- OPERATOR_PAD .OPERATOR_PAD_BUTTON_TWO .whenPressed (new IntakeSetPosition (RobotContainer . intake .PIVOT_DOWN ));
192
- OPERATOR_PAD .OPERATOR_PAD_BUTTON_THREE .whileHeld (new MagazineSetTurntable ( 0.5 ));
193
- OPERATOR_PAD .OPERATOR_PAD_BUTTON_FOUR .whenPressed (new IntakeSetPosition (RobotContainer . intake .PIVOT_UP ));
218
+ OPERATOR_PAD .OPERATOR_PAD_BUTTON_ONE .whileHeld (new RevolverSetTurntable (0.2 ));
219
+ OPERATOR_PAD .OPERATOR_PAD_BUTTON_TWO .whenPressed (new IntakeSetPosition (Intake .PIVOT_DOWN ));
220
+ OPERATOR_PAD .OPERATOR_PAD_BUTTON_THREE .whileHeld (new RevolverSetTurntable ( 1.0 ));
221
+ OPERATOR_PAD .OPERATOR_PAD_BUTTON_FOUR .whenPressed (new IntakeSetPosition (Intake .PIVOT_UP ));
194
222
195
223
// new ShooterSetWheel(1000));
196
- OPERATOR_PAD .OPERATOR_PAD_BUTTON_FIVE .whileHeld (new ChimneySetChimney (1.0 ));
197
- OPERATOR_PAD .OPERATOR_PAD_BUTTON_SIX .whileHeld (new IntakeSetRollers (-1.0 ));
224
+ OPERATOR_PAD .OPERATOR_PAD_BUTTON_FIVE .whileHeld (new ChimneySet (1.0 ));
225
+ OPERATOR_PAD .OPERATOR_PAD_BUTTON_SIX .whileHeld (new IntakeSetRollersWhileHeld (-1.0 ));
226
+
227
+ OPERATOR_PAD .OPERATOR_PAD_BUTTON_SEVEN .whenPressed (new ShooterAimToTarget ());
228
+ OPERATOR_PAD .OPERATOR_PAD_BUTTON_EIGHT .whileHeld (new IntakeSetRollersWhileHeld (1.0 ));
198
229
199
- OPERATOR_PAD .OPERATOR_PAD_BUTTON_SEVEN .whileHeld (new TurretAimToTarget ());
200
- OPERATOR_PAD .OPERATOR_PAD_BUTTON_EIGHT .whileHeld (new IntakeSetRollers (1.0 ));
201
-
202
230
OPERATOR_PAD .OPERATOR_PAD_BUTTON_NINE .whenPressed (new ClimberSetPistons (true ));
203
231
OPERATOR_PAD .OPERATOR_PAD_BUTTON_TEN .whenPressed (new ClimberSetPistons (false ));
204
232
205
-
206
233
// OPERATOR_PAD.OPERATOR_PAD_D_PAD_UP.whenPressed(new
207
234
// IntakeSetPosition(RobotContainer.intake.PIVOT_UP));
208
235
// OPERATOR_PAD.OPERATOR_PAD_D_PAD_DOWN.whenPressed(new
209
236
// IntakeSetPosition(RobotContainer.intake.PIVOT_DOWN));
210
- OPERATOR_PAD .OPERATOR_PAD_D_PAD_LEFT .whileHeld (new ShooterSetTurretVBus (-0.2 ));
211
- OPERATOR_PAD .OPERATOR_PAD_D_PAD_RIGHT .whileHeld (new ShooterSetTurretVBus (+0.2 ));
212
- OPERATOR_PAD .OPERATOR_PAD_D_PAD_UP .whileHeld (new ShooterAdjustHood (+1000.0 ));
213
- OPERATOR_PAD .OPERATOR_PAD_D_PAD_DOWN .whileHeld (new ShooterAdjustHood (-1000.0 ));
237
+ OPERATOR_PAD .OPERATOR_PAD_D_PAD_LEFT .whileHeld (new TurretSetVBus (-0.4 ));
238
+ OPERATOR_PAD .OPERATOR_PAD_D_PAD_RIGHT .whileHeld (new TurretSetVBus (+0.4 ));
239
+ OPERATOR_PAD .OPERATOR_PAD_D_PAD_UP .whileHeld (new HoodAdjust (+1000.0 ));
240
+ OPERATOR_PAD .OPERATOR_PAD_D_PAD_DOWN .whileHeld (new HoodAdjust (-1000.0 ));
214
241
215
- // TODO: Consider if below should use "variable power" for climber or just always full speed?
216
242
OPERATOR_PAD .OPERATOR_PAD_RIGHT_Y_AXIS_UP .whileHeld (new ClimberSetWinchesPower (1.0 ));
217
243
OPERATOR_PAD .OPERATOR_PAD_RIGHT_Y_AXIS_DOWN .whileHeld (new ClimberSetWinchesPower (-1.0 ));
218
244
219
245
// OPERATOR_PAD.OPERATOR_PAD_LEFT_Y_AXIS_UP.whenPressed(new
220
- // MagazineSetTurntable ());
221
- OPERATOR_PAD .OPERATOR_PAD_LEFT_Y_AXIS_DOWN .whileHeld (new ChimneySetChimney (-1.0 ));
246
+ // RevolverSetTurntable ());
247
+ OPERATOR_PAD .OPERATOR_PAD_LEFT_Y_AXIS_DOWN .whileHeld (new ChimneySet (-1.0 ));
222
248
}
223
249
224
250
/**
0 commit comments