From 6d501b6bb985580f29210db36dc8869dbc85fc83 Mon Sep 17 00:00:00 2001 From: "Keenan D. Buckley" Date: Mon, 2 Mar 2020 23:08:15 -0700 Subject: [PATCH] Update Buttons --- .../java/frc4388/robot/RobotContainer.java | 62 ++++++++++--------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/src/main/java/frc4388/robot/RobotContainer.java b/src/main/java/frc4388/robot/RobotContainer.java index 5bda228..02032f9 100644 --- a/src/main/java/frc4388/robot/RobotContainer.java +++ b/src/main/java/frc4388/robot/RobotContainer.java @@ -37,7 +37,10 @@ import frc4388.robot.commands.drive.TurnDegrees; import frc4388.robot.commands.intake.RunIntakeWithTriggers; import frc4388.robot.commands.shooter.CalibrateShooter; import frc4388.robot.commands.shooter.HoldTarget; +import frc4388.robot.commands.shooter.ShootFullGroup; +import frc4388.robot.commands.shooter.ShootPrepGroup; import frc4388.robot.commands.shooter.TrimShooter; +import frc4388.robot.commands.storage.StoragePrepIntake; import frc4388.robot.subsystems.Camera; import frc4388.robot.subsystems.Climber; import frc4388.robot.subsystems.Drive; @@ -51,6 +54,7 @@ import frc4388.robot.subsystems.ShooterAim; import frc4388.robot.subsystems.Storage; import frc4388.utility.controller.IHandController; import frc4388.utility.controller.XboxController; +import frc4388.utility.controller.XboxTriggerButton; /** * This class is where the bulk of the robot should be declared. Since @@ -138,6 +142,8 @@ public class RobotContainer { new JoystickButton(getDriverJoystick(), XboxController.X_BUTTON) .whenPressed(new InstantCommand()); + + /* Driver Buttons */ // sets solenoids into high gear new JoystickButton(getDriverJoystick(), XboxController.RIGHT_BUMPER_BUTTON) @@ -149,29 +155,26 @@ public class RobotContainer { - /* Operator Buttons */ - // shoots until released new JoystickButton(getOperatorJoystick(), XboxController.RIGHT_BUMPER_BUTTON) - //.whileHeld(new ShootFullGroup(m_robotShooter, m_robotShooterAim, m_robotStorage), false) - //.whenReleased(new RunCommand(() -> m_robotLime.limeOff())); - .whileHeld(new RunCommand(() -> m_robotStorage.runStorage(0.8))); + .whileHeld(new ShootFullGroup(m_robotShooter, m_robotShooterAim, m_robotStorage), false) + .whenReleased(new RunCommand(() -> m_robotLime.limeOff())); + //.whileHeld(new RunCommand(() -> m_robotStorage.runStorage(0.8))); // shoots one ball new JoystickButton(getOperatorJoystick(), XboxController.LEFT_BUMPER_BUTTON) - //.whenPressed(new ShootFullGroup(m_robotShooter, m_robotShooterAim, m_robotStorage), false) - //.whenReleased(new RunCommand(() -> m_robotLime.limeOff())); - .whileHeld(new RunCommand(() -> m_robotStorage.runStorage(-0.8))); + .whenPressed(new ShootFullGroup(m_robotShooter, m_robotShooterAim, m_robotStorage), false) + .whenReleased(new RunCommand(() -> m_robotLime.limeOff())); + //.whileHeld(new RunCommand(() -> m_robotStorage.runStorage(-0.8))); // extends or retracts the extender new JoystickButton(getOperatorJoystick(), XboxController.X_BUTTON) .whileHeld(new RunCommand(() -> m_robotIntake.runExtender(0.5))) - .whenReleased(new RunCommand(() -> m_robotIntake.runExtender(0))); - + .whenReleased(new InstantCommand(() -> m_robotIntake.runExtender(0))); new JoystickButton(getOperatorJoystick(), XboxController.Y_BUTTON) .whileHeld(new RunCommand(() -> m_robotIntake.runExtender(-0.5))) - .whenReleased(new RunCommand(() -> m_robotIntake.runExtender(0))); + .whenReleased(new InstantCommand(() -> m_robotIntake.runExtender(0))); // safety for climber and leveler new JoystickButton(getOperatorJoystick(), XboxController.BACK_BUTTON) @@ -180,24 +183,11 @@ public class RobotContainer { // starts tracking target new JoystickButton(getOperatorJoystick(), XboxController.A_BUTTON) - //.whileHeld(new ShootPrepGroup(m_robotShooter, m_robotShooterAim, m_robotStorage)) - //.whenReleased(new StoragePrepIntake(m_robotIntake, m_robotStorage)); + .whileHeld(new ShootPrepGroup(m_robotShooter, m_robotShooterAim, m_robotStorage)) + .whenReleased(new StoragePrepIntake(m_robotIntake, m_robotStorage)); //.whileHeld(new RunCommand(() -> m_robotShooter.runDrumShooterVelocityPID(13000))); - .whileHeld(new HoldTarget(m_robotShooter, m_robotShooterAim)) - .whileHeld(new RunCommand(() -> m_robotShooter.runAngleAdjustPID(30))); - //Prepares storage for intaking - //new JoystickButton(getOperatorJoystick(), XboxController.LEFT_TRIGGER_AXIS) - // .whileHeld(new StorageIntake(m_robotIntake, m_robotStorage)); - - //Runs storage to outtake - //new JoystickButton(getOperatorJoystick(), XboxController.RIGHT_TRIGGER_AXIS) - // .whileHeld(new StorageOutake(m_robotStorage)); - - //Run drum - new JoystickButton(getOperatorJoystick(), XboxController.B_BUTTON) - //.whenPressed(new ShootPrepGroup(m_robotShooter, m_robotShooterAim, m_robotStorage)); - .whenPressed(new RunCommand(() -> m_robotShooter.runDrumShooterVelocityPID(13000))); - //.whenReleased(new RunCommand(() -> m_robotShooter.runDrumShooterVelocityPID(0))); + //.whileHeld(new HoldTarget(m_robotShooter, m_robotShooterAim)) + //.whileHeld(new RunCommand(() -> m_robotShooter.runAngleAdjustPID(30))); //Trims shooter new JoystickButton(getOperatorJoystick(), XboxController.TOP_BOTTOM_DPAD_AXIS) @@ -206,6 +196,22 @@ public class RobotContainer { //Calibrates turret and hood new JoystickButton(getOperatorJoystick(), XboxController.START_BUTTON) .whileHeld(new CalibrateShooter(m_robotShooter, m_robotShooterAim)); + + //Prepares storage for intaking + new XboxTriggerButton(m_operatorXbox, XboxTriggerButton.LEFT_TRIGGER) + .whileHeld(new RunCommand(() -> m_robotStorage.runStorage(-0.8))) + .whenReleased(new RunCommand(() -> m_robotStorage.runStorage(0.0))); + + //Runs storage to outtake + new XboxTriggerButton(m_operatorXbox, XboxTriggerButton.RIGHT_TRIGGER) + .whileHeld(new RunCommand(() -> m_robotStorage.runStorage(0.8))) + .whenReleased(new RunCommand(() -> m_robotStorage.runStorage(0.0))); + + //Run drum + //new JoystickButton(getOperatorJoystick(), XboxController.B_BUTTON) + //.whenPressed(new ShootPrepGroup(m_robotShooter, m_robotShooterAim, m_robotStorage)); + //.whenPressed(new RunCommand(() -> m_robotShooter.runDrumShooterVelocityPID(13000))); + //.whenReleased(new RunCommand(() -> m_robotShooter.runDrumShooterVelocityPID(0))); } /**