1313import edu .wpi .first .wpilibj2 .command .button .CommandXboxController ;
1414import frc .robot .commands .*;
1515import frc .robot .config .CANMappings ;
16+ import frc .robot .config .HopperConfig ;
1617import frc .robot .config .TunerConstants ;
1718import frc .robot .subsystems .*;
1819
@@ -24,18 +25,26 @@ public class RobotContainer {
2425 private Climb climb = new Climb ();
2526 private Intake intake = new Intake ();
2627 private Kicker kicker = new Kicker ();
27- private CommandXboxController controller = new CommandXboxController (0 );
28+ private CommandXboxController controller = new CommandXboxController (1 );
2829 private SwerveDriveState driveState = new SwerveDriveState ();
30+ public static boolean isExtended = false ;
2931
3032 private Command shootGroup =
3133 Commands .parallel (
3234 new KickerCommand (kicker , KickerCommand .Position .INTAKE ),
33- new HopperCommand (hopper , HopperCommand .Position .SHOOT_RETRACT ),
35+ Commands .runEnd (
36+ () -> hopper .slowMove (HopperConfig .HOPPER_RETRACT_ROTATION ),
37+ () -> hopper .stop (),
38+ hopper ).withDeadline (Commands .waitSeconds (2 )),
3439 new IntakeCommand (intake , IntakeCommand .Position .SLOW_INTAKE ))
3540 .finallyDo (
3641 interrupt ->
3742 CommandScheduler .getInstance ()
38- .schedule (new HopperCommand (hopper , HopperCommand .Position .SHOOT_EXTEND )));
43+ .schedule (
44+ Commands .runEnd (
45+ () -> hopper .move (HopperConfig .HOPPER_EXTEND_ROTATION ),
46+ () -> hopper .stop (),
47+ hopper ).withDeadline (Commands .waitSeconds (2 ))));
3948
4049 public RobotContainer () {
4150 configureBindings ();
@@ -63,12 +72,22 @@ private void configureBindings() {
6372 .x ()
6473 .and (() -> !shootGroup .isScheduled ())
6574 .toggleOnTrue (new IntakeCommand (intake , IntakeCommand .Position .INTAKE ));
75+
76+ controller
77+ .povRight ()
78+ .and (() -> !shootGroup .isScheduled ())
79+ .toggleOnTrue (new IntakeCommand (intake , IntakeCommand .Position .OUTTAKE ));
6680 // Right Stick Down = Extend/Retract Hopper
6781 controller
6882 .rightStick ()
6983 .and (() -> !shootGroup .isScheduled ())
70- .onTrue (new HopperCommand (hopper , HopperCommand .Position .EXTEND_RETRACT ));
71- // Right Trigger = Climb Retract
84+ .onTrue (
85+ Commands .runEnd (
86+ () -> hopper .move (Hopper .getRotation (isExtended )), () -> hopper .stop (), hopper )
87+ .withDeadline (Commands .waitSeconds (2 ))
88+ .andThen (Commands .runOnce (() -> isExtended = !isExtended )));
89+
90+ // // Right Trigger = Climb Retract
7291 controller
7392 .rightTrigger ()
7493 .whileTrue (new ClimbCommand (climb , ClimbCommand .Position .DIRECTIONAL_CLIMB ));
@@ -92,6 +111,7 @@ private void configureBindings() {
92111 .a ()
93112 .toggleOnTrue (
94113 new FlywheelCommand (flywheel , FlywheelCommand .Position .CALCULATED_SHOT , drivetrain ));
114+ controller .povDown ().onTrue (Commands .runOnce (() -> hopper .zero (), hopper ));
95115 }
96116
97117 public Command getAutonomousCommand () {
0 commit comments