From 727ad8401114289ac64ba54ad0eaac54a0a26d69 Mon Sep 17 00:00:00 2001 From: Hayden Heroux Date: Tue, 2 Apr 2024 22:34:21 -0400 Subject: [PATCH] chore: Remove climber subsystem. --- src/main/java/frc/robot/RobotContainer.java | 5 +- src/main/java/frc/robot/climber/Climber.java | 110 ------------------ .../frc/robot/climber/ClimberConstants.java | 22 ---- .../frc/robot/climber/ClimberFactory.java | 16 --- .../java/frc/robot/climber/ElevatorIO.java | 35 ------ .../java/frc/robot/climber/ElevatorIOSim.java | 23 ---- 6 files changed, 1 insertion(+), 210 deletions(-) delete mode 100644 src/main/java/frc/robot/climber/Climber.java delete mode 100644 src/main/java/frc/robot/climber/ClimberConstants.java delete mode 100644 src/main/java/frc/robot/climber/ClimberFactory.java delete mode 100644 src/main/java/frc/robot/climber/ElevatorIO.java delete mode 100644 src/main/java/frc/robot/climber/ElevatorIOSim.java diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 59d90b2..8630a06 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -7,7 +7,6 @@ import frc.lib.Telemetry; import frc.robot.arm.Arm; import frc.robot.auto.Auto; -import frc.robot.climber.Climber; import frc.robot.intake.Intake; import frc.robot.odometry.Odometry; import frc.robot.shooter.Shooter; @@ -23,7 +22,6 @@ public class RobotContainer { private final Arm arm; private final Auto auto; - private final Climber climber; private final Intake intake; private final Odometry odometry; private final Shooter shooter; @@ -36,7 +34,6 @@ public class RobotContainer { private RobotContainer() { arm = Arm.getInstance(); auto = Auto.getInstance(); - climber = Climber.getInstance(); intake = Intake.getInstance(); odometry = Odometry.getInstance(); shooter = Shooter.getInstance(); @@ -66,7 +63,7 @@ public static RobotContainer getInstance() { /** Initializes subsystem telemetry. */ private void initializeTelemetry() { - Telemetry.initializeTabs(arm, auto, climber, intake, odometry, shooter, superstructure, swerve); + Telemetry.initializeTabs(arm, auto, intake, odometry, shooter, superstructure, swerve); SmartDashboard.putData("Superstructure", SuperstructureMechanism.getInstance().getMechanism()); } diff --git a/src/main/java/frc/robot/climber/Climber.java b/src/main/java/frc/robot/climber/Climber.java deleted file mode 100644 index dc007a4..0000000 --- a/src/main/java/frc/robot/climber/Climber.java +++ /dev/null @@ -1,110 +0,0 @@ -package frc.robot.climber; - -import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout; -import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; -import edu.wpi.first.wpilibj2.command.Command; -import edu.wpi.first.wpilibj2.command.Commands; -import frc.lib.Subsystem; -import frc.lib.Telemetry; -import frc.robot.climber.ClimberConstants.ElevatorConstants; -import frc.robot.climber.ElevatorIO.ElevatorIOValues; - -/** Subsystem class for the climber subsystem. */ -public class Climber extends Subsystem { - - /** Instance variable for the climber subsystem singleton. */ - private static Climber instance = null; - - /** Elevator. */ - private final ElevatorIO eastElevator; - - /** Elevator values. */ - private final ElevatorIOValues eastElevatorValues = new ElevatorIOValues(); - - /** Elevator. */ - private final ElevatorIO westElevator; - - /** Elevator values. */ - private final ElevatorIOValues westElevatorValues = new ElevatorIOValues(); - - /** Creates a new instance of the climber subsystem. */ - private Climber() { - westElevator = new ElevatorIOSim(); - eastElevator = new ElevatorIOSim(); - - westElevator.configure(); - eastElevator.configure(); - - westElevator.setPosition(ElevatorConstants.MIN_HEIGHT); - eastElevator.setPosition(ElevatorConstants.MIN_HEIGHT); - } - - /** - * Gets the instance of the climber subsystem. - * - * @return the instance of the climber subsystem. - */ - public static Climber getInstance() { - if (instance == null) { - instance = new Climber(); - } - - return instance; - } - - @Override - public void periodic() { - westElevator.update(westElevatorValues); - eastElevator.update(eastElevatorValues); - } - - @Override - public void addToShuffleboard(ShuffleboardTab tab) { - ShuffleboardLayout west = Telemetry.addColumn(tab, "West"); - - west.addDouble("Position (m)", () -> westElevatorValues.positionMeters); - - ShuffleboardLayout east = Telemetry.addColumn(tab, "East"); - - east.addDouble("Position (m)", () -> eastElevatorValues.positionMeters); - } - - public boolean westAtTop() { - return westElevatorValues.positionMeters >= ElevatorConstants.MAX_HEIGHT; - } - - public boolean westAtBottom() { - return westElevatorValues.positionMeters <= ElevatorConstants.MIN_HEIGHT; - } - - public boolean eastAtTop() { - return eastElevatorValues.positionMeters >= ElevatorConstants.MAX_HEIGHT; - } - - public boolean eastAtBottom() { - return eastElevatorValues.positionMeters <= ElevatorConstants.MIN_HEIGHT; - } - - public void stop() { - westElevator.setVoltage(0); - eastElevator.setVoltage(0); - } - - public Command up() { - return Commands.parallel( - Commands.run(() -> westElevator.setVoltage(ElevatorConstants.UP_VOLTAGE)) - .until(this::westAtTop), - Commands.run(() -> eastElevator.setVoltage(ElevatorConstants.UP_VOLTAGE)) - .until(this::eastAtTop)) - .finallyDo(this::stop); - } - - public Command down() { - return Commands.parallel( - Commands.run(() -> westElevator.setVoltage(ElevatorConstants.DOWN_VOLTAGE)) - .until(this::westAtBottom), - Commands.run(() -> eastElevator.setVoltage(ElevatorConstants.DOWN_VOLTAGE)) - .until(this::eastAtBottom)) - .finallyDo(this::stop); - } -} diff --git a/src/main/java/frc/robot/climber/ClimberConstants.java b/src/main/java/frc/robot/climber/ClimberConstants.java deleted file mode 100644 index afbcce0..0000000 --- a/src/main/java/frc/robot/climber/ClimberConstants.java +++ /dev/null @@ -1,22 +0,0 @@ -package frc.robot.climber; - -import edu.wpi.first.math.util.Units; - -/** Constants for the climber subsystem. */ -public class ClimberConstants { - - /** Constants for the elevator. */ - public static class ElevatorConstants { - /** Minimum height of the elevator in meters. */ - public static final double MIN_HEIGHT = 0.0; - - /** Maximum height of the elevator in meters. */ - public static final double MAX_HEIGHT = Units.inchesToMeters(28); - - /** Voltage to be applied while going up. */ - public static final double UP_VOLTAGE = 2; - - /** Voltage to be applied wihle going down. */ - public static final double DOWN_VOLTAGE = 1; - } -} diff --git a/src/main/java/frc/robot/climber/ClimberFactory.java b/src/main/java/frc/robot/climber/ClimberFactory.java deleted file mode 100644 index 7dc8163..0000000 --- a/src/main/java/frc/robot/climber/ClimberFactory.java +++ /dev/null @@ -1,16 +0,0 @@ -package frc.robot.climber; - -import frc.lib.CAN; - -/** Helper class for creating hardware for the climber subsystem. */ -public class ClimberFactory { - - /** - * Creates an elevator. - * - * @return an elevator. - */ - public static ElevatorIO createElevator(CAN can, boolean inverted) { - return new ElevatorIOSim(); - } -} diff --git a/src/main/java/frc/robot/climber/ElevatorIO.java b/src/main/java/frc/robot/climber/ElevatorIO.java deleted file mode 100644 index c7d1967..0000000 --- a/src/main/java/frc/robot/climber/ElevatorIO.java +++ /dev/null @@ -1,35 +0,0 @@ -package frc.robot.climber; - -/** Elevator hardware interface. */ -public interface ElevatorIO { - - /** Values for the elevator hardware interface. */ - public static class ElevatorIOValues { - /** Position of the elevator in meters. */ - public double positionMeters; - } - - /** Configures the elevator. */ - public void configure(); - - /** - * Updates the elevator's values. - * - * @param values - */ - public void update(ElevatorIOValues values); - - /** - * Sets the elevator's position. - * - * @param positionMeters the elevator's position. - */ - public void setPosition(double positionMeters); - - /** - * Sets the elevator's voltage. - * - * @param volts the elevator's voltage. - */ - public void setVoltage(double volts); -} diff --git a/src/main/java/frc/robot/climber/ElevatorIOSim.java b/src/main/java/frc/robot/climber/ElevatorIOSim.java deleted file mode 100644 index 2a17266..0000000 --- a/src/main/java/frc/robot/climber/ElevatorIOSim.java +++ /dev/null @@ -1,23 +0,0 @@ -package frc.robot.climber; - -/** Simulated elevator. */ -public class ElevatorIOSim implements ElevatorIO { - - private double positionMeters; - - @Override - public void configure() {} - - @Override - public void update(ElevatorIOValues values) { - values.positionMeters = positionMeters; - } - - @Override - public void setPosition(double positionMeters) { - this.positionMeters = positionMeters; - } - - @Override - public void setVoltage(double volts) {} -}