@@ -26,36 +26,30 @@ def __init__(self):
2626 self .robotDrive = subsystems .drivesubsystem .DriveSubsystem ()
2727 self .shooter = subsystems .shootersubsystem .ShooterSubsystem ()
2828
29- self .spinUpShooter = commands2 .cmd .runOnce (self .shooter .enable , [ self .shooter ] )
30- self .stopShooter = commands2 .cmd .runOnce (self .shooter .disable , [ self .shooter ] )
29+ self .spinUpShooter = commands2 .cmd .runOnce (self .shooter .enable , self .shooter )
30+ self .stopShooter = commands2 .cmd .runOnce (self .shooter .disable , self .shooter )
3131
3232 # An autonomous routine that shoots the loaded frisbees
3333 self .autonomousCommand = commands2 .cmd .sequence (
34- [
35- # Start the command by spinning up the shooter...
36- commands2 .cmd .runOnce (self .shooter .enable , [self .shooter ]),
37- # Wait until the shooter is at speed before feeding the frisbees
38- commands2 .cmd .waitUntil (
39- lambda : self .shooter .getController ().atSetpoint ()
40- ),
41- # Start running the feeder
42- commands2 .cmd .runOnce (self .shooter .runFeeder , [self .shooter ]),
43- # Shoot for the specified time
44- commands2 .cmd .wait (constants .AutoConstants .kAutoShootTimeSeconds )
45- # Add a timeout (will end the command if, for instance, the shooter
46- # never gets up to speed)
47- .withTimeout (constants .AutoConstants .kAutoTimeoutSeconds )
48- # When the command ends, turn off the shooter and the feeder
49- .andThen (
50- commands2 .cmd .runOnce (
51- lambda : self .shooter .disable , [self .shooter ]
52- ).andThen (
53- commands2 .cmd .runOnce (
54- lambda : self .shooter .stopFeeder , [self .shooter ]
55- )
56- )
57- ),
58- ]
34+ # Start the command by spinning up the shooter...
35+ commands2 .cmd .runOnce (self .shooter .enable , self .shooter ),
36+ # Wait until the shooter is at speed before feeding the frisbees
37+ commands2 .cmd .waitUntil (lambda : self .shooter .getController ().atSetpoint ()),
38+ # Start running the feeder
39+ commands2 .cmd .runOnce (self .shooter .runFeeder , self .shooter ),
40+ # Shoot for the specified time
41+ commands2 .cmd .waitSeconds (constants .AutoConstants .kAutoShootTimeSeconds )
42+ # Add a timeout (will end the command if, for instance, the shooter
43+ # never gets up to speed)
44+ .withTimeout (constants .AutoConstants .kAutoTimeoutSeconds )
45+ # When the command ends, turn off the shooter and the feeder
46+ .andThen (
47+ commands2 .cmd .runOnce (
48+ lambda : self .shooter .disable , self .shooter
49+ ).andThen (
50+ commands2 .cmd .runOnce (lambda : self .shooter .stopFeeder , self .shooter )
51+ )
52+ ),
5953 )
6054
6155 # The driver's controller
@@ -76,7 +70,7 @@ def __init__(self):
7670 - self .driverController .getLeftY (),
7771 - self .driverController .getRightX (),
7872 ),
79- [ self .robotDrive ] ,
73+ self .robotDrive ,
8074 )
8175 )
8276
@@ -92,39 +86,39 @@ def configureButtonBindings(self):
9286 # We can bind commands while retaining references to them in RobotContainer
9387
9488 # Spin up the shooter when the 'A' button is pressed
95- self .driverController .A ().onTrue (self .spinUpShooter )
89+ self .driverController .a ().onTrue (self .spinUpShooter )
9690
9791 # Turn off the shooter when the 'B' button is pressed
98- self .driverController .B ().onTrue (self .stopShooter )
92+ self .driverController .b ().onTrue (self .stopShooter )
9993
10094 # We can also write them as temporary variables outside the bindings
10195
10296 # Shoots if the shooter wheel has reached the target speed
10397 shoot = commands2 .cmd .either (
10498 # Run the feeder
105- commands2 .cmd .runOnce (self .shooter .runFeeder , [ self .shooter ] ),
99+ commands2 .cmd .runOnce (self .shooter .runFeeder , self .shooter ),
106100 # Do nothing
107- commands2 .cmd .nothing (),
101+ commands2 .cmd .none (),
108102 # Determine which of the above to do based on whether the shooter has reached the
109103 # desired speed
110104 lambda : self .shooter .getController ().atSetpoint (),
111105 )
112106
113- stopFeeder = commands2 .cmd .runOnce (self .shooter .stopFeeder , [ self .shooter ] )
107+ stopFeeder = commands2 .cmd .runOnce (self .shooter .stopFeeder , self .shooter )
114108
115109 # Shoot when the 'X' button is pressed
116- self .driverController .X ().onTrue (shoot ).onFalse (stopFeeder )
110+ self .driverController .x ().onTrue (shoot ).onFalse (stopFeeder )
117111
118112 # We can also define commands inline at the binding!
119113
120114 # While holding the shoulder button, drive at half speed
121115 self .driverController .rightBumper ().onTrue (
122116 commands2 .cmd .runOnce (
123- lambda : self .robotDrive .setMaxOutput (0.5 ), [ self .robotDrive ]
117+ lambda : self .robotDrive .setMaxOutput (0.5 ), self .robotDrive
124118 )
125119 ).onFalse (
126120 commands2 .cmd .runOnce (
127- lambda : self .robotDrive .setMaxOutput (1 ), [ self .robotDrive ]
121+ lambda : self .robotDrive .setMaxOutput (1 ), self .robotDrive
128122 )
129123 )
130124
0 commit comments