@@ -20,6 +20,7 @@ class Autos:
20
20
def __init__ (self ) -> None :
21
21
raise Exception ("This is a utility class!" )
22
22
23
+ @staticmethod
23
24
def simpleAuto (drive : subsystems .drivesubsystem .DriveSubsystem ):
24
25
"""A simple auto routine that drives forward a specified distance, and then stops."""
25
26
return commands2 .FunctionalCommand (
@@ -35,42 +36,41 @@ def simpleAuto(drive: subsystems.drivesubsystem.DriveSubsystem):
35
36
# Require the drive subsystem
36
37
)
37
38
39
+ @staticmethod
38
40
def complexAuto (
39
41
driveSubsystem : subsystems .drivesubsystem .DriveSubsystem ,
40
42
hatchSubsystem : subsystems .hatchsubsystem .HatchSubsystem ,
41
43
):
42
44
"""A complex auto routine that drives forward, drops a hatch, and then drives backward."""
43
45
return commands2 .cmd .sequence (
44
- [
45
- # Drive forward up to the front of the cargo ship
46
- commands2 .FunctionalCommand (
47
- # Reset encoders on command start
48
- driveSubsystem .resetEncoders ,
49
- # Drive forward while the command is executing
50
- lambda : driveSubsystem .arcadeDrive (constants .kAutoDriveSpeed , 0 ),
51
- # Stop driving at the end of the command
52
- lambda interrupt : driveSubsystem .arcadeDrive (0 , 0 ),
53
- # End the command when the robot's driven distance exceeds the desired value
54
- lambda : driveSubsystem .getAverageEncoderDistance ()
55
- >= constants .kAutoDriveDistanceInches ,
56
- # Require the drive subsystem
57
- [driveSubsystem ],
58
- ),
59
- # Release the hatch
60
- hatchSubsystem .releaseHatch (),
61
- # Drive backward the specified distance
62
- commands2 .FunctionalCommand (
63
- # Reset encoders on command start
64
- driveSubsystem .resetEncoders ,
65
- # Drive backwards while the command is executing
66
- lambda : driveSubsystem .arcadeDrive (- constants .kAutoDriveSpeed , 0 ),
67
- # Stop driving at the end of the command
68
- lambda interrupt : driveSubsystem .arcadeDrive (0 , 0 ),
69
- # End the command when the robot's driven distance exceeds the desired value
70
- lambda : abs (driveSubsystem .getAverageEncoderDistance ())
71
- >= constants .kAutoBackupDistanceInches ,
72
- # Require the drive subsystem
73
- [driveSubsystem ],
74
- ),
75
- ]
46
+ # Drive forward up to the front of the cargo ship
47
+ commands2 .FunctionalCommand (
48
+ # Reset encoders on command start
49
+ driveSubsystem .resetEncoders ,
50
+ # Drive forward while the command is executing
51
+ lambda : driveSubsystem .arcadeDrive (constants .kAutoDriveSpeed , 0 ),
52
+ # Stop driving at the end of the command
53
+ lambda interrupt : driveSubsystem .arcadeDrive (0 , 0 ),
54
+ # End the command when the robot's driven distance exceeds the desired value
55
+ lambda : driveSubsystem .getAverageEncoderDistance ()
56
+ >= constants .kAutoDriveDistanceInches ,
57
+ # Require the drive subsystem
58
+ driveSubsystem ,
59
+ ),
60
+ # Release the hatch
61
+ hatchSubsystem .releaseHatch (),
62
+ # Drive backward the specified distance
63
+ commands2 .FunctionalCommand (
64
+ # Reset encoders on command start
65
+ driveSubsystem .resetEncoders ,
66
+ # Drive backwards while the command is executing
67
+ lambda : driveSubsystem .arcadeDrive (- constants .kAutoDriveSpeed , 0 ),
68
+ # Stop driving at the end of the command
69
+ lambda interrupt : driveSubsystem .arcadeDrive (0 , 0 ),
70
+ # End the command when the robot's driven distance exceeds the desired value
71
+ lambda : abs (driveSubsystem .getAverageEncoderDistance ())
72
+ >= constants .kAutoBackupDistanceInches ,
73
+ # Require the drive subsystem
74
+ driveSubsystem ,
75
+ ),
76
76
)
0 commit comments