@@ -157,35 +157,10 @@ public RobotContainer() {
157
157
}
158
158
});
159
159
160
- // Set up reservoir tank
161
- reservoirTank .setPressureThresholds (15 , 20 );
162
- new Trigger (
163
- () ->
164
- NormUtil .norm (drive .getRobotSpeeds ()) > drive .getMaxLinearSpeedMetersPerSec () * 0.75
165
- || Math .abs (drive .getRobotSpeeds ().omegaRadiansPerSecond )
166
- > drive .getMaxAngularSpeedRadPerSec () * 0.75 )
167
- .debounce (0.3 , DebounceType .kBoth )
168
- .whileTrue (
169
- reservoirTank
170
- .startEnd (reservoirTank ::pause , reservoirTank ::unpause )
171
- .withName ("Pause: Drive Speed" ));
172
-
160
+ // Pneumatics sim
173
161
reservoirTank .setSimDrain (gatewayTank ::isFilling );
174
-
175
- // Set up gateway tank
176
- gatewayTank .setDesiredPSI (20 );
177
- new Trigger (firingTube ::isOpen )
178
- .or (firingTube ::isWaitingToFire )
179
- .debounce (0.5 , DebounceType .kBoth )
180
- .whileTrue (
181
- gatewayTank
182
- .startEnd (gatewayTank ::pause , gatewayTank ::unpause )
183
- .withName ("Pause: Firing Tube Open" ));
184
162
gatewayTank .setSimDrain (firingTube ::isOpen );
185
163
186
- // Set up firing tube
187
- firingTube .setFireRequirements (() -> !gatewayTank .isFilling ());
188
-
189
164
// Alerts for constants to avoid using them in competition
190
165
if (Constants .TUNING_MODE ) {
191
166
new Alert ("Tuning mode active, do not use in competition." , AlertType .INFO ).set (true );
@@ -324,11 +299,13 @@ private void configureDriverControllerBindings() {
324
299
boolean includeDiagonalPOV = true ;
325
300
for (int pov = 0 ; pov < 360 ; pov += includeDiagonalPOV ? 45 : 90 ) {
326
301
327
- // POV angles are in Clock Wise degrees, needs to be flipped to get correct rotation2d
302
+ // POV angles are in Clock Wise degrees, needs to be flipped to get correct
303
+ // rotation2d
328
304
final Rotation2d angle = Rotation2d .fromDegrees (-pov );
329
305
final String name = String .format ("%d\u00B0 " , pov );
330
306
331
- // While the POV is being pressed and we are not in angle control mode, set the chassis
307
+ // While the POV is being pressed and we are not in angle control mode, set the
308
+ // chassis
332
309
// speeds to the Cos and Sin of the angle
333
310
driverXbox
334
311
.pov (pov )
@@ -343,7 +320,8 @@ private void configureDriverControllerBindings() {
343
320
drive ::stop )
344
321
.withName (String .format ("DriveRobotRelative %s" , name )));
345
322
346
- // While the POV is being pressed and we are angle control mode. Start by resetting the
323
+ // While the POV is being pressed and we are angle control mode. Start by
324
+ // resetting the
347
325
// controller and setting the goal angle to the pov angle
348
326
driverXbox
349
327
.pov (pov )
@@ -357,7 +335,8 @@ private void configureDriverControllerBindings() {
357
335
})
358
336
.withName (String .format ("PrepareLockedHeading %s" , name )));
359
337
360
- // Then if the button is held for more than 0.2 seconds, drive forward at the angle once the
338
+ // Then if the button is held for more than 0.2 seconds, drive forward at the
339
+ // angle once the
361
340
// chassis reaches it
362
341
driverXbox
363
342
.pov (pov )
@@ -377,7 +356,8 @@ private void configureDriverControllerBindings() {
377
356
})
378
357
.withName (String .format ("ForwardLockedHeading %s" , name )));
379
358
380
- // Then once the pov is let go, if we are not at the angle continue turn to it, while also
359
+ // Then once the pov is let go, if we are not at the angle continue turn to it,
360
+ // while also
381
361
// accepting x and y input to drive. Cancel once we get turn request
382
362
driverXbox
383
363
.pov (pov )
@@ -400,7 +380,8 @@ private void configureDriverControllerBindings() {
400
380
.withName (String .format ("DriveLockedHeading %s" , name )));
401
381
}
402
382
403
- // While X is held down go into stop and go into the cross position to resistent movement,
383
+ // While X is held down go into stop and go into the cross position to resistent
384
+ // movement,
404
385
// then once X button is let go put modules forward
405
386
driverXbox
406
387
.x ()
@@ -409,7 +390,8 @@ private void configureDriverControllerBindings() {
409
390
.startEnd (drive ::stopUsingBrakeArrangement , drive ::stopUsingForwardArrangement )
410
391
.withName ("StopWithX" ));
411
392
412
- // When be is pressed stop the drivetrain then idle it, cancelling all incoming commands. Also
393
+ // When be is pressed stop the drivetrain then idle it, cancelling all incoming
394
+ // commands. Also
413
395
// do this when robot is disabled
414
396
driverXbox
415
397
.b ()
@@ -464,20 +446,53 @@ private void configureOperatorControllerBindings() {
464
446
if (operatorController instanceof CommandXboxController ) {
465
447
final CommandXboxController operatorXbox = (CommandXboxController ) operatorController ;
466
448
449
+ // TODO set up rest of control code in here. use default command to fill it 20, then have
450
+ // another command that idles it till it reaches 15
451
+ // Just display default command (fill to 20) and current command (pauses, etc) using subsystem
452
+
453
+ // Set up reservoir tank
454
+
455
+ reservoirTank .setPressureThresholds (15 , 20 );
456
+ new Trigger (
457
+ () ->
458
+ NormUtil .norm (drive .getRobotSpeeds ())
459
+ > drive .getMaxLinearSpeedMetersPerSec () * 0.75
460
+ || Math .abs (drive .getRobotSpeeds ().omegaRadiansPerSecond )
461
+ > drive .getMaxAngularSpeedRadPerSec () * 0.75 )
462
+ .debounce (0.3 , DebounceType .kBoth )
463
+ .whileTrue (
464
+ reservoirTank
465
+ .startEnd (reservoirTank ::pause , reservoirTank ::unpause )
466
+ .withName ("Pause: Drive Speed" ));
467
+
467
468
operatorXbox
468
469
.y ()
469
470
.whileTrue (
470
471
reservoirTank
471
472
.startEnd (reservoirTank ::pause , reservoirTank ::unpause )
472
473
.withName ("Pause: Operator Y Button" ));
473
474
475
+ // Set up gateway tank
476
+ gatewayTank .setDesiredPSI (20 );
477
+
478
+ new Trigger (firingTube ::isOpen )
479
+ .or (firingTube ::isWaitingToFire )
480
+ .debounce (0.1 , DebounceType .kBoth )
481
+ .whileTrue (
482
+ gatewayTank
483
+ .startEnd (gatewayTank ::pause , gatewayTank ::unpause )
484
+ .withName ("Pause: Firing Tube Open" ));
485
+
474
486
operatorXbox
475
487
.leftTrigger ()
476
488
.whileTrue (
477
489
gatewayTank
478
490
.startEnd (gatewayTank ::pause , gatewayTank ::unpause )
479
491
.withName ("Pause: Operator Prepare Fire" ));
480
492
493
+ // Set up firing tube
494
+ firingTube .setFireRequirements (() -> !gatewayTank .isFilling ());
495
+
481
496
operatorXbox .rightTrigger ().onTrue (firingTube .runOnce (firingTube ::fire ).withName ("Fire" ));
482
497
483
498
// gatewayTank.setDefaultCommand(
0 commit comments