From d6d849389a93d9a0df76a546b98eeb72591734ec Mon Sep 17 00:00:00 2001 From: aarav18 Date: Sun, 20 Mar 2022 00:50:01 -0600 Subject: [PATCH 1/2] stop drive + turret during climb --- .../java/frc4388/robot/RobotContainer.java | 42 +++++++++++-------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/src/main/java/frc4388/robot/RobotContainer.java b/src/main/java/frc4388/robot/RobotContainer.java index fbae619..5853bfb 100644 --- a/src/main/java/frc4388/robot/RobotContainer.java +++ b/src/main/java/frc4388/robot/RobotContainer.java @@ -178,13 +178,21 @@ public class RobotContainer { // Swerve Drive with Input m_robotSwerveDrive.setDefaultCommand( - new RunCommand(() -> m_robotSwerveDrive.driveWithInput( - getDriverController().getLeftX(), - getDriverController().getLeftY(), - getDriverController().getRightX(), - getDriverController().getRightY(), - true), - m_robotSwerveDrive).withName("Swerve driveWithInput defaultCommand")); + new RunCommand(() -> { + if (this.currentControlMode.equals(ControlMode.SHOOTER)) { + m_robotSwerveDrive.driveWithInput( getDriverController().getLeftX(), + getDriverController().getLeftY(), + getDriverController().getRightX(), + getDriverController().getRightY(), + true); } + if (this.currentControlMode.equals(ControlMode.CLIMBER)) { + m_robotSwerveDrive.driveWithInput( 0, + 0, + 0, + 0, + true); + }} + , m_robotSwerveDrive).withName("Swerve driveWithInput defaultCommand")); // Intake with Triggers m_robotIntake.setDefaultCommand( @@ -209,17 +217,17 @@ public class RobotContainer { new RunCommand(() -> m_robotSerializer.setSerializer(getOperatorController().getLeftTriggerAxis() * 0.8),//m_robotSerializer.setSerializerStateWithBeam(), m_robotSerializer).withName("Serializer setSerializerStateWithBeam defaultCommand")); // Turret Manual - m_robotTurret.setDefaultCommand( - new RunCommand(() -> m_robotTurret.runTurretWithInput(getOperatorController().getLeftX()), - m_robotTurret).withName("Turret runTurretWithInput defaultCommand")); - // m_robotTurret.setDefaultCommand( - // new RunCommand(() -> { - // if (this.currentControlMode.equals(ControlMode.SHOOTER)) { - // if (this.currentTurretMode.equals(TurretMode.MANUAL)) { m_robotTurret.runTurretWithInput(getOperatorController().getLeftX()); } - // } - // if (this.currentControlMode.equals(ControlMode.CLIMBER)) { m_robotTurret.runTurretWithInput(0); } - // }, m_robotTurret)); + // new RunCommand(() -> m_robotTurret.runTurretWithInput(getOperatorController().getLeftX()), + // m_robotTurret).withName("Turret runTurretWithInput defaultCommand")); + + m_robotTurret.setDefaultCommand( + new RunCommand(() -> { + if (this.currentControlMode.equals(ControlMode.SHOOTER)) { + if (this.currentTurretMode.equals(TurretMode.MANUAL)) { m_robotTurret.runTurretWithInput(getOperatorController().getLeftX()); } + } + if (this.currentControlMode.equals(ControlMode.CLIMBER)) { m_robotTurret.runTurretWithInput(0); } + }, m_robotTurret)); m_robotHood.setDefaultCommand( new RunCommand(() -> { From 94dd0797cf07f8067370b115635c01ada84e6972 Mon Sep 17 00:00:00 2001 From: aarav18 Date: Sun, 20 Mar 2022 00:54:33 -0600 Subject: [PATCH 2/2] fix turret --- src/main/java/frc4388/robot/RobotContainer.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/frc4388/robot/RobotContainer.java b/src/main/java/frc4388/robot/RobotContainer.java index f98c824..af39f4a 100644 --- a/src/main/java/frc4388/robot/RobotContainer.java +++ b/src/main/java/frc4388/robot/RobotContainer.java @@ -223,9 +223,7 @@ public class RobotContainer { m_robotTurret.setDefaultCommand( new RunCommand(() -> { - if (this.currentControlMode.equals(ControlMode.SHOOTER)) { - if (this.currentTurretMode.equals(TurretMode.MANUAL)) { m_robotTurret.runTurretWithInput(getOperatorController().getLeftX()); } - } + if (this.currentControlMode.equals(ControlMode.SHOOTER)) { m_robotTurret.runTurretWithInput(getOperatorController().getLeftX()); } if (this.currentControlMode.equals(ControlMode.CLIMBER)) { m_robotTurret.runTurretWithInput(0); } }, m_robotTurret));