From 8a793adaac1c13e9b91de957978ba914704bc52a Mon Sep 17 00:00:00 2001 From: Alex Resnick Date: Sun, 6 Oct 2024 16:02:08 -0500 Subject: [PATCH] remove some boiler plate stuff --- src/main/java/frc/robot/RobotContainer.java | 4 +- .../subsystems/drive/DrivetrainReal.java | 26 +++++++++++ .../subsystems/drive/DrivetrainVictorSP.java | 43 ------------------- 3 files changed, 28 insertions(+), 45 deletions(-) create mode 100644 src/main/java/frc/robot/subsystems/drive/DrivetrainReal.java delete mode 100644 src/main/java/frc/robot/subsystems/drive/DrivetrainVictorSP.java diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index c9f3a6f..2756f2f 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -11,7 +11,7 @@ import frc.robot.Robot.RobotRunType; import frc.robot.subsystems.drive.Drivetrain; import frc.robot.subsystems.drive.DrivetrainIO; -import frc.robot.subsystems.drive.DrivetrainVictorSP; +import frc.robot.subsystems.drive.DrivetrainReal; /** * This class is where the bulk of the robot should be declared. Since Command-based is a @@ -38,7 +38,7 @@ public RobotContainer(RobotRunType runtimeType) { autoChooser.setDefaultOption("Wait 1 Second", "wait"); switch (runtimeType) { case kReal: - drivetrain = new Drivetrain(new DrivetrainVictorSP()); + drivetrain = new Drivetrain(new DrivetrainReal()); break; case kSimulation: // drivetrain = new Drivetrain(new DrivetrainSim() {}); diff --git a/src/main/java/frc/robot/subsystems/drive/DrivetrainReal.java b/src/main/java/frc/robot/subsystems/drive/DrivetrainReal.java new file mode 100644 index 0000000..f8f17d1 --- /dev/null +++ b/src/main/java/frc/robot/subsystems/drive/DrivetrainReal.java @@ -0,0 +1,26 @@ +package frc.robot.subsystems.drive; + +import edu.wpi.first.math.geometry.Rotation2d; + +/** + * DrivetrainReal + */ +public class DrivetrainReal implements DrivetrainIO { + + + /** + * Drivetrain Real + */ + public DrivetrainReal() {} + + @Override + public void updateInputs(DrivetrainIOInputs inputs) { + inputs.gyroYaw = Rotation2d.fromDegrees(0); + } + + /** + * Drive Voltage + */ + public void setDriveVoltage(double lvolts, double rvolts) {} + +} diff --git a/src/main/java/frc/robot/subsystems/drive/DrivetrainVictorSP.java b/src/main/java/frc/robot/subsystems/drive/DrivetrainVictorSP.java deleted file mode 100644 index 37fd68c..0000000 --- a/src/main/java/frc/robot/subsystems/drive/DrivetrainVictorSP.java +++ /dev/null @@ -1,43 +0,0 @@ -package frc.robot.subsystems.drive; - -import com.kauailabs.navx.frc.AHRS; -import edu.wpi.first.math.geometry.Rotation2d; -import edu.wpi.first.wpilibj.SPI; -import edu.wpi.first.wpilibj.motorcontrol.VictorSP; - -/** - * Drivetrain VictorSP - */ -public class DrivetrainVictorSP implements DrivetrainIO { - private final VictorSP left1 = new VictorSP(4); - private final VictorSP left2 = new VictorSP(5); - - private final VictorSP right1 = new VictorSP(6); - private final VictorSP right2 = new VictorSP(7); - - private AHRS gyro = new AHRS(SPI.Port.kMXP); - - /** - * Drivetrain VictorSP - */ - public DrivetrainVictorSP() { - left1.addFollower(left2); - right1.addFollower(right2); - right1.setInverted(true); - right2.setInverted(true); - } - - @Override - public void updateInputs(DrivetrainIOInputs inputs) { - inputs.gyroYaw = Rotation2d.fromDegrees(gyro.getYaw()); - } - - /** - * Drive Voltage - */ - public void setDriveVoltage(double lvolts, double rvolts) { - left1.set(lvolts); - right1.set(rvolts); - } - -}