]> git.taranathan.com Git - FRC2026.git/commitdiff
All subsystems (get/set for stator/supply current limits)
authorWesley28w <wesleycwong@gmail.com>
Sun, 19 Apr 2026 15:33:06 +0000 (08:33 -0700)
committerWesley28w <wesleycwong@gmail.com>
Sun, 19 Apr 2026 15:33:06 +0000 (08:33 -0700)
24 files changed:
src/main/java/frc/robot/RobotContainer.java
src/main/java/frc/robot/commands/gpm/BrownOutControl.java [deleted file]
src/main/java/frc/robot/commands/gpm/HardstopWarning.java
src/main/java/frc/robot/commands/gpm/RunSpindexer.java
src/main/java/frc/robot/constants/IntakeConstants.java [deleted file]
src/main/java/frc/robot/controls/PS5ControllerDriverConfig.java
src/main/java/frc/robot/subsystems/Intake/Intake.java
src/main/java/frc/robot/subsystems/Intake/IntakeConstants.java [new file with mode: 0644]
src/main/java/frc/robot/subsystems/Intake/IntakeIO.java
src/main/java/frc/robot/subsystems/drivetrain/Drivetrain.java
src/main/java/frc/robot/subsystems/drivetrain/Module.java
src/main/java/frc/robot/subsystems/drivetrain/ModuleIO.java
src/main/java/frc/robot/subsystems/hood/Hood.java
src/main/java/frc/robot/subsystems/hood/HoodConstants.java
src/main/java/frc/robot/subsystems/hood/HoodIO.java
src/main/java/frc/robot/subsystems/shooter/Shooter.java
src/main/java/frc/robot/subsystems/shooter/ShooterIO.java
src/main/java/frc/robot/subsystems/spindexer/Spindexer.java
src/main/java/frc/robot/subsystems/spindexer/SpindexerIO.java
src/main/java/frc/robot/subsystems/turret/Turret.java
src/main/java/frc/robot/subsystems/turret/TurretConstants.java
src/main/java/frc/robot/subsystems/turret/TurretIO.java
src/main/java/frc/robot/util/BrownOut/BrownOutConstants.java [deleted file]
src/main/java/frc/robot/util/BrownOut/BrownOutLevel.java [deleted file]

index fa920aeb0b6e867e1a4cbbbe54e5769b20b8fb94..71933a1d8c53aceee0edb563d62cc754a2268d79 100644 (file)
@@ -24,7 +24,6 @@ import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
 import frc.robot.commands.LogCommand;
 import frc.robot.commands.drive_comm.DefaultDriveCommand;
 import frc.robot.commands.gpm.AutoShootCommand;
-import frc.robot.commands.gpm.BrownOutControl;
 import frc.robot.commands.gpm.ClimbDriveCommand;
 import frc.robot.commands.gpm.IntakeMovementCommand;
 import frc.robot.commands.gpm.LockedShoot;
@@ -173,10 +172,6 @@ public class RobotContainer {
         if (turret != null) {
           turret.setDefaultCommand(new Superstructure(turret, drive, hood, shooter, spindexer));
         }
-
-        if (shooter != null && spindexer != null && turret != null && intake != null && hood != null && drive != null) {
-          CommandScheduler.getInstance().schedule(new BrownOutControl(shooter, spindexer, turret, intake, hood, drive));
-        }
         
         drive.setDefaultCommand(new DefaultDriveCommand(drive, driver));
         break;
diff --git a/src/main/java/frc/robot/commands/gpm/BrownOutControl.java b/src/main/java/frc/robot/commands/gpm/BrownOutControl.java
deleted file mode 100644 (file)
index cfa986c..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-package frc.robot.commands.gpm;
-
-import edu.wpi.first.wpilibj.RobotController;
-import edu.wpi.first.wpilibj2.command.Command;
-import frc.robot.subsystems.Intake.Intake;
-import frc.robot.subsystems.drivetrain.Drivetrain;
-import frc.robot.subsystems.hood.Hood;
-import frc.robot.subsystems.shooter.Shooter;
-import frc.robot.subsystems.spindexer.Spindexer;
-import frc.robot.subsystems.turret.Turret;
-import frc.robot.util.BrownOut.BrownOutConstants;
-import frc.robot.util.BrownOut.BrownOutLevel;
-
-public class BrownOutControl extends Command {
-    private Shooter shooter;
-    private Spindexer spindexer;
-    private Turret turret;
-    private Intake intake;
-    private Hood hood;
-    private Drivetrain drivetrain;
-
-    public BrownOutLevel[] levels = {
-        BrownOutConstants.BROWNOUT_LVL_ONE, 
-        BrownOutConstants.BROWNOUT_LVL_TWO, 
-        BrownOutConstants.BROWNOUT_LVL_THREE, 
-        BrownOutConstants.BROWNOUT_LVL_FOUR,
-        BrownOutConstants.BROWNOUT_LVL_FIVE,
-    };
-
-    public BrownOutControl(Shooter shooter, Spindexer spindexer, Turret turret, Intake intake, Hood hood, Drivetrain drivetrain) {
-        this.shooter = shooter;
-        this.spindexer = spindexer;
-        this.turret = turret;
-        this.intake = intake;
-        this.hood = hood;
-        this.drivetrain = drivetrain;
-    }
-
-    @Override
-    public void execute() {
-        BrownOutLevel level = monitor();
-        applyLevel(level);
-    }
-
-    public BrownOutLevel monitor() {
-        // pretty sure this is where you get it. Need to check if this is same as logs. 
-        // voltage 6.3 is brownout where issues occur, but 4.75 is dead robot
-        int level = 1;
-        double batteryVoltage = RobotController.getBatteryVoltage();
-        if (batteryVoltage > BrownOutConstants.LEVEL_ONE_LIMIT) { // normal
-            level = 1;
-            return levels[0];
-        } else if (batteryVoltage > BrownOutConstants.LEVEL_TWO_LIMIT) { // if 7.5 to 6.75
-            level = 2;
-            return levels[1]; // lower drivetrain
-        } else if (batteryVoltage > BrownOutConstants.LEVEL_THREE_LIMIT) { // if 6.75 to 6.0 (browning out)
-            level = 3;
-            return levels[2];
-        } else if (batteryVoltage > BrownOutConstants.LEVEL_FOUR_LIMIT) { // if 6.0 to 5.0 (mayday)
-            level = 4;
-            return levels[3];
-        } else { // were are on life support at this point 5.25 to 4.75
-            level = 5;
-            return levels[4];
-        }
-        // Logger.recordOutput("BrownoutProtection/Level", level);
-    }
-
-    public void applyLevel(BrownOutLevel level) {
-        double shooterCurrent = level.shooterCurrent;
-        double turretCurrent = level.turretCurrent;
-        double hoodCurrent = level.hoodCurrent;
-        double spindexerCurrent = level.spindexerCurrent;
-        double intakeCurrent = level.intakeCurrent;
-        double steerCurrent = level.steerCurrent;
-        double driveCurrent = level.driveCurrent;
-
-        // apply them / set them
-        shooter.setNewCurrentLimit(shooterCurrent);
-        turret.setCurrentLimits(turretCurrent);
-        hood.setCurrentLimits(hoodCurrent);
-        spindexer.setNewCurrentLimit(spindexerCurrent);
-        intake.setCurrentLimits(intakeCurrent);
-        drivetrain.applyNewModuleCurrents(steerCurrent, driveCurrent);
-
-    }
-
-    @Override
-    public void end(boolean interrupted) {
-        // Nothing
-        applyLevel(levels[0]); // disable
-    }
-}
index a1fd2f1610f00f81336434e9a5662e14e69d174d..901e51fd584a12b362234e77bdb4b6d4167562c9 100644 (file)
@@ -3,8 +3,8 @@ package frc.robot.commands.gpm;
 import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
 import edu.wpi.first.wpilibj2.command.Command;
 import frc.robot.constants.Constants;
-import frc.robot.constants.IntakeConstants;
 import frc.robot.subsystems.Intake.Intake;
+import frc.robot.subsystems.Intake.IntakeConstants;
 import frc.robot.subsystems.hood.Hood;
 import frc.robot.subsystems.hood.HoodConstants;
 
index 7cc1090c9a2422c102a33e06c6705bfe5294542a..bac112310809dc58d0d115168bb88f21406d2dc8 100644 (file)
@@ -6,8 +6,8 @@ import edu.wpi.first.wpilibj.Timer;
 import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
 import edu.wpi.first.wpilibj2.command.Command;
 import frc.robot.constants.Constants;
-import frc.robot.constants.IntakeConstants;
 import frc.robot.subsystems.Intake.Intake;
+import frc.robot.subsystems.Intake.IntakeConstants;
 import frc.robot.subsystems.hood.Hood;
 import frc.robot.subsystems.spindexer.Spindexer;
 import frc.robot.subsystems.spindexer.SpindexerConstants;
@@ -62,7 +62,7 @@ public class RunSpindexer extends Command {
             reversing = false;
             return; // this is so the balls don't fly out when unaligned
         }
-        boolean jammed = spindexer.getStatorCurrent() > SpindexerConstants.JAM_CURRENT_THRESHOLD;
+        boolean jammed = spindexer.getSubsystemStatorCurrent() / 2 > SpindexerConstants.JAM_CURRENT_THRESHOLD;
         if (jam_debouncer.calculate(jammed)) {
             reversing = true;
             reverseTimer.reset();
diff --git a/src/main/java/frc/robot/constants/IntakeConstants.java b/src/main/java/frc/robot/constants/IntakeConstants.java
deleted file mode 100644 (file)
index 05152a6..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-package frc.robot.constants;
-
-import edu.wpi.first.math.util.Units;
-
-public class IntakeConstants {
-    /** Intake roller motor speed in range [-1, 1] */
-    public static final double SPEED = 1.0;
-    /** 12 tooth pinion driving 36 tooth driven gear */
-    public static final double GEAR_RATIO = 48.0/10.0;
-    /** radius (inches) of the rack gear which is a 10 tooth pinion at 10 DP */
-    public static final double RADIUS_RACK_PINION = 0.5;
-    /**right and left motor current limits */
-    public static final double EXTENDER_CURRENT_LIMITS = 40.0;
-    /**Current limits when calibrating */
-    public static final double CALIBRATING_CURRENT_LIMITS = 10.0;
-    public static final double CALIBRATING_CURRENT_THRESHOLD = 9.0;
-
-    /** Current limit for normal operation */
-    public static final double NORMAL_CURRENT_LIMIT = 100.0;
-
-    public static final double ROLLER_MOI_KG_M_SQ = 0.5 * 0.020 * 0.020; // 0.5kg roller, 20mm radius for now
-    public static final double ROLLER_GEARING = 2.0;
-    public static final double CARRIAGE_MASS_KG = 3.0;
-    public static final double DRUM_RADIUS_METERS = Units.inchesToMeters(1.0);
-
-
-    /** max extension in inches */
-    public static final double MAX_EXTENSION = 10.5; // inches
-
-    public static final double INTERMEDIATE_EXTENSION = 5.0; //inches
-
-    public static final double STOW_EXTENSION = 0.2; // inches
-
-    /** starting point in inches */
-    public static final double STARTING_POINT = 0;
-    /** rack pitch in teeth per inch of diameter (Diametral Pitch) DP = N teeth / Diameter in inches */
-    public static final double RACK_PITCH = 10;
-
-    // Simulation 
-
-}
index 9b578202b6efd1d84c26a6ad203d06f72f206dd8..a8ea2611e0e7ad0a6ba3f1795afe25004e2981a1 100644 (file)
@@ -150,26 +150,6 @@ public class PS5ControllerDriverConfig extends BaseDriverConfig {
                 hood.forceHoodDown(false);
             }));
         }
-
-        // shoot focus mode: reduces drive current
-        if (spindexer != null) {
-            controller.get(PS5Button.RB).onTrue(new InstantCommand(() -> shootFocus(true)))
-            .onFalse(new InstantCommand(()->  shootFocus(false)));
-        }
-    }
-
-    private void shootFocus(boolean turnOn) {
-        if (turnOn) {
-            System.out.println("Shooting is now Focused");
-            spindexer.setNewCurrentLimit(SpindexerConstants.currentLimit);
-            drive.applyNewModuleCurrents(DriveConstants.STEER_PEAK_CURRENT_LIMIT, 
-                    DriveConstants.DRIVE_PEAK_CURRENT_LIMIT * 0.25);
-        } else {
-            System.out.println("Shooting back to normal (From focus)");
-            spindexer.setNewCurrentLimit(SpindexerConstants.currentLimit);
-            drive.applyNewModuleCurrents(DriveConstants.STEER_PEAK_CURRENT_LIMIT, 
-                    DriveConstants.DRIVE_PEAK_CURRENT_LIMIT);
-        }
     }
 
     @Override
index 12d4ab33c2b05807b48e022ea29932366eb59393..7fcc1b1daa5c30c02ec0fea75f1899c581ae177d 100644 (file)
@@ -28,7 +28,6 @@ import edu.wpi.first.wpilibj2.command.InstantCommand;
 import edu.wpi.first.wpilibj2.command.SubsystemBase;
 import frc.robot.constants.Constants;
 import frc.robot.constants.IdConstants;
-import frc.robot.constants.IntakeConstants;
 
 public class Intake extends SubsystemBase implements IntakeIO{
     // Mechanism Display...
@@ -80,6 +79,7 @@ public class Intake extends SubsystemBase implements IntakeIO{
         maxVelocity = 0.75 * maxFreeSpeed;
         maxAcceleration = maxVelocity / 0.25;
 
+        // ----Rollers
         // Configure the motors
         // Build the configuration for the roller
         TalonFXConfiguration rollerConfig = new TalonFXConfiguration();
@@ -98,23 +98,18 @@ public class Intake extends SubsystemBase implements IntakeIO{
         // apply the configuration to the right motor (master)
         rollerMotor.getConfigurator().apply(rollerConfig);
 
+        // --- Extenders
+
         // Build the configuration for the left and right Motor
         TalonFXConfiguration config = new TalonFXConfiguration();
 
-        // config the current limits (low value for testing)
-        config.CurrentLimits
-        .withStatorCurrentLimit(IntakeConstants.EXTENDER_CURRENT_LIMITS)
-        .withStatorCurrentLimitEnable(true)
-        .withSupplyCurrentLimit(IntakeConstants.EXTENDER_CURRENT_LIMITS)
-        .withSupplyCurrentLimitEnable(true);
-
         // config Slot 0 PID params
-        var rollerSlot0Configs = config.Slot0;
-        rollerSlot0Configs.kP = 0.5;
-        rollerSlot0Configs.kI = 0.0;
-        rollerSlot0Configs.kD = 0.0;
-        rollerSlot0Configs.kV = 0.0;
-        rollerSlot0Configs.kA = 0.0;
+        var extenderSlot0Configs = config.Slot0;
+        extenderSlot0Configs.kP = 0.5;
+        extenderSlot0Configs.kI = 0.0;
+        extenderSlot0Configs.kD = 0.0;
+        extenderSlot0Configs.kV = 0.0;
+        extenderSlot0Configs.kA = 0.0;
 
         // configure MotionMagic
         MotionMagicConfigs motionMagicConfigs = config.MotionMagic;
@@ -134,15 +129,12 @@ public class Intake extends SubsystemBase implements IntakeIO{
             new MotorOutputConfigs().withNeutralMode(NeutralModeValue.Coast)
         );
 
-        CurrentLimitsConfigs limitConfig = new CurrentLimitsConfigs();
-        limitConfig.StatorCurrentLimit = IntakeConstants.NORMAL_CURRENT_LIMIT;
-        limitConfig.StatorCurrentLimitEnable = true;
-        leftMotor.getConfigurator().apply(limitConfig);
-        rightMotor.getConfigurator().apply(limitConfig);
 
         leftMotor.setPosition(0.0);
         rightMotor.setPosition(0.0);
 
+        setNewCurrentLimit(IntakeConstants.STATOR_CURRENT_EXTENDER_LIMIT, IntakeConstants.SUPPLY_CURRENT_EXTENDER_LIMIT, IntakeConstants.STATOR_ROLLER_CURRENT_LIMIT, IntakeConstants.SUPPLY_ROLLER_CURRENT_LIMIT);
+
         // Build the mechanism for display
         mechanism = new Mechanism2d(80, 80);
         MechanismRoot2d root = mechanism.getRoot("Root", 0, 1);
@@ -366,7 +358,7 @@ public class Intake extends SubsystemBase implements IntakeIO{
      * Starts calibrating by running it backwards
      */
     public void calibrate(){
-        setCurrentLimits(IntakeConstants.CALIBRATING_CURRENT_LIMITS);
+        setNewCurrentLimit(IntakeConstants.CALIBRATING_CURRENT_LIMITS, IntakeConstants.CALIBRATING_CURRENT_LIMITS, IntakeConstants.CALIBRATING_CURRENT_LIMITS, IntakeConstants.CALIBRATING_CURRENT_LIMITS);
         calibrating = true;
     }
 
@@ -375,34 +367,48 @@ public class Intake extends SubsystemBase implements IntakeIO{
      */
     public void stopCalibrating(){
         zeroMotors();
-        setCurrentLimits(IntakeConstants.EXTENDER_CURRENT_LIMITS);
+        setNewCurrentLimit(IntakeConstants.STATOR_CURRENT_EXTENDER_LIMIT, IntakeConstants.SUPPLY_CURRENT_EXTENDER_LIMIT, IntakeConstants.STATOR_ROLLER_CURRENT_LIMIT, IntakeConstants.SUPPLY_ROLLER_CURRENT_LIMIT);
         calibrating = false;
         retract();
     }
 
-    /**
-     * sets supply and stator current limits
-     * @param limit the current limit for stator and supply current
-     */
-    public void setCurrentLimits(double limit) {
-        CurrentLimitsConfigs limits = new CurrentLimitsConfigs()
-        .withStatorCurrentLimitEnable(true)
-        .withStatorCurrentLimit(limit)
-        .withSupplyCurrentLimitEnable(true)
-        .withSupplyCurrentLimit(limit);
-
-        leftMotor.getConfigurator().apply(limits);
-        rightMotor.getConfigurator().apply(limits);
+    public void setNewCurrentLimit(double statorExtenders, double supplyExtenders, double statorRoller, double supplyRollers) {
+        CurrentLimitsConfigs limitConfigExtender = new CurrentLimitsConfigs();
+        limitConfigExtender.StatorCurrentLimit = statorExtenders;
+        limitConfigExtender.StatorCurrentLimitEnable = true;
+        limitConfigExtender.SupplyCurrentLimit = statorExtenders;
+        limitConfigExtender.SupplyCurrentLimitEnable = true;
+        leftMotor.getConfigurator().apply(limitConfigExtender);
+        rightMotor.getConfigurator().apply(limitConfigExtender);
+
+        // roller
+        CurrentLimitsConfigs limitConfigRoller = new CurrentLimitsConfigs();
+        limitConfigRoller.StatorCurrentLimit = statorRoller;
+        limitConfigRoller.StatorCurrentLimitEnable = true;
+        limitConfigRoller.SupplyCurrentLimit = supplyRollers;
+        limitConfigRoller.SupplyCurrentLimitEnable = true;
+        rollerMotor.getConfigurator().apply(limitConfigRoller);
+    }
+
+    public double getSubsystemStatorCurrent() {
+        return inputs.leftStatorCurrent + inputs.rightStatorCurrent + inputs.rollerStatorCurrent;
+    }
+
+    public double getSubsystemSupplyCurrent() {
+        return inputs.leftSupplyCurrent + inputs.rightSupplyCurrent + inputs.rollerSupplyCurrent;
     }
 
     @Override
     public void updateInputs() {
         inputs.leftPosition = rotationsToInches(leftMotor.getPosition().getValueAsDouble());
         inputs.rightPosition = rotationsToInches(rightMotor.getPosition().getValueAsDouble());
-        inputs.leftCurrent = leftMotor.getStatorCurrent().getValueAsDouble();
-        inputs.rightCurrent = rightMotor.getStatorCurrent().getValueAsDouble();
+        inputs.leftStatorCurrent = leftMotor.getStatorCurrent().getValueAsDouble();
+        inputs.rightStatorCurrent = rightMotor.getStatorCurrent().getValueAsDouble();
+        inputs.leftSupplyCurrent = leftMotor.getSupplyCurrent().getValueAsDouble();
+        inputs.rightSupplyCurrent = rightMotor.getSupplyCurrent().getValueAsDouble();
         inputs.rollerVelocity = rollerMotor.getVelocity().getValueAsDouble();
-        inputs.rollerCurrent = rollerMotor.getStatorCurrent().getValueAsDouble();
+        inputs.rollerStatorCurrent = rollerMotor.getStatorCurrent().getValueAsDouble();
+        inputs.rollerSupplyCurrent = rollerMotor.getSupplyCurrent().getValueAsDouble();
     }
 
 }
diff --git a/src/main/java/frc/robot/subsystems/Intake/IntakeConstants.java b/src/main/java/frc/robot/subsystems/Intake/IntakeConstants.java
new file mode 100644 (file)
index 0000000..5fccbd9
--- /dev/null
@@ -0,0 +1,44 @@
+package frc.robot.subsystems.Intake;
+
+import edu.wpi.first.math.util.Units;
+
+public class IntakeConstants {
+    /** Intake roller motor speed in range [-1, 1] */
+    public static final double SPEED = 1.0;
+    /** 12 tooth pinion driving 36 tooth driven gear */
+    public static final double GEAR_RATIO = 48.0/10.0;
+    /** radius (inches) of the rack gear which is a 10 tooth pinion at 10 DP */
+    public static final double RADIUS_RACK_PINION = 0.5;
+
+    /**Current limits when calibrating */
+    public static final double CALIBRATING_CURRENT_LIMITS = 10.0;
+    public static final double CALIBRATING_CURRENT_THRESHOLD = 9.0;
+
+    /** Current limit for normal operation */
+    public static final double STATOR_CURRENT_EXTENDER_LIMIT = 100.0;
+    public static final double SUPPLY_CURRENT_EXTENDER_LIMIT = 100.0;
+    public static final double STATOR_ROLLER_CURRENT_LIMIT = 40.0;
+    public static final double SUPPLY_ROLLER_CURRENT_LIMIT = 40.0;
+    
+
+    public static final double ROLLER_MOI_KG_M_SQ = 0.5 * 0.020 * 0.020; // 0.5kg roller, 20mm radius for now
+    public static final double ROLLER_GEARING = 2.0;
+    public static final double CARRIAGE_MASS_KG = 3.0;
+    public static final double DRUM_RADIUS_METERS = Units.inchesToMeters(1.0);
+
+
+    /** max extension in inches */
+    public static final double MAX_EXTENSION = 10.5; // inches
+
+    public static final double INTERMEDIATE_EXTENSION = 5.0; //inches
+
+    public static final double STOW_EXTENSION = 0.2; // inches
+
+    /** starting point in inches */
+    public static final double STARTING_POINT = 0;
+    /** rack pitch in teeth per inch of diameter (Diametral Pitch) DP = N teeth / Diameter in inches */
+    public static final double RACK_PITCH = 10;
+
+    // Simulation 
+
+}
index 15dc34b7001ea76932a5d1aad1444937fbaa1dda..813641a695fca1c4db8b80bef0da1b89d5c7e616 100644 (file)
@@ -7,10 +7,13 @@ public interface IntakeIO {
     public static class IntakeIOInputs {
         public double leftPosition = 0.0;
         public double rightPosition = 0.0;
-        public double leftCurrent = 0.0;
-        public double rightCurrent = 0.0;
+        public double leftSupplyCurrent = 0.0;
+        public double rightSupplyCurrent = 0.0;
+        public double leftStatorCurrent = 0.0;
+        public double rightStatorCurrent = 0.0;
         public double rollerVelocity = 0.0;
-        public double rollerCurrent = 0.0;
+        public double rollerSupplyCurrent = 0.0;
+        public double rollerStatorCurrent = 0.0;
     }
 
     public void updateInputs();
index 5b1de6d65a6a0e2e3237a53e033f9893f2295065..0db0422a3dfeb472a75bc9a4a4636344c9c55fbd 100644 (file)
@@ -429,11 +429,29 @@ public class Drivetrain extends SubsystemBase {
     }
 
     // for current limit setting (brownout protection)
-    public void applyNewModuleCurrents(double steerCurrent, double driveCurrent) {
+    public void applyNewModuleCurrents(
+        double steerCurrentStator, double steerCurrentSupply, 
+        double driveCurrentStator, double driveCurrentSupply) {
         for (Module module : modules) { // iterate over our modules
-            module.setNewCurrentLimit(steerCurrent, driveCurrent);
+            module.setNewCurrentLimit(steerCurrentStator, steerCurrentSupply, driveCurrentStator, driveCurrentSupply);
         }
     }
+    
+    public double getSubsystemStatorCurrent() {
+        double sum = 0;
+        for (Module module : modules) {
+            sum += module.getModuleStatorCurrent();
+        }
+        return sum;
+    }
+
+    public double getSubsystemSupplyCurrent() {
+        double sum = 0;
+        for (Module module : modules) {
+            sum += module.getModuleSupplyCurrent();
+        }
+        return sum;
+    }
 
     /**
      * Sets the desired states for all swerve modules.
index aa81e8e9d3e5131d45e4cc60277bb7b2f9380985..5511175107d967055926c5e7ad4c133ac691e32f 100644 (file)
@@ -191,21 +191,25 @@ public class Module implements ModuleIO{
       // Update encoder inputs
       inputs.encoderOffset = Units.rotationsToDegrees(CANcoder.getAbsolutePosition().getValueAsDouble());
 
-    // Update odometry inputs
-    inputs.odometryTimestamps =
-        timestampQueue.stream().mapToDouble((Double value) -> value).toArray();
-    inputs.odometryDrivePositionsRad =
-        drivePositionQueue.stream()
-            .mapToDouble((Double value) -> Units.rotationsToRadians(value))
-            .toArray();
-    inputs.odometryTurnPositions =
-        turnPositionQueue.stream()
-            .map((Double value) -> Rotation2d.fromRotations(value))
-            .toArray(Rotation2d[]::new);
-    timestampQueue.clear();
-    drivePositionQueue.clear();
-    turnPositionQueue.clear();
-
+        // Update odometry inputs
+        inputs.odometryTimestamps =
+            timestampQueue.stream().mapToDouble((Double value) -> value).toArray();
+        inputs.odometryDrivePositionsRad =
+            drivePositionQueue.stream()
+                .mapToDouble((Double value) -> Units.rotationsToRadians(value))
+                .toArray();
+        inputs.odometryTurnPositions =
+            turnPositionQueue.stream()
+                .map((Double value) -> Rotation2d.fromRotations(value))
+                .toArray(Rotation2d[]::new);
+        timestampQueue.clear();
+        drivePositionQueue.clear();
+        turnPositionQueue.clear();
+
+        inputs.driveStator = driveMotor.getStatorCurrent().getValueAsDouble();
+        inputs.driveSupply = driveMotor.getSupplyCurrent().getValueAsDouble();
+        inputs.steerStator = angleMotor.getStatorCurrent().getValueAsDouble();
+        inputs.steerSupply = angleMotor.getSupplyCurrent().getValueAsDouble();
     }
     
     public void periodic() {
@@ -352,24 +356,32 @@ public class Module implements ModuleIO{
         return inputs.driveCurrentAmps;
     }
 
+    public double getModuleStatorCurrent() {
+        return inputs.steerStator + inputs.driveStator;
+    }
+
+    public double getModuleSupplyCurrent() {
+        return inputs.steerSupply + inputs.driveSupply;
+    }
+
     // I took the config things straight from this file
-    public void setNewCurrentLimit(double currentSteer, double currentDrive) {
+    public void setNewCurrentLimit(double currentSteerStator, double currentSteerSupply, double currentDriveStator, double currentDriveSupply) {
         CurrentLimitsConfigs steerConfig = new CurrentLimitsConfigs();
         // steer
-        steerConfig.SupplyCurrentLimitEnable = DriveConstants.STEER_ENABLE_CURRENT_LIMIT;
-        steerConfig.SupplyCurrentLimit = currentSteer;
-        steerConfig.SupplyCurrentLowerLimit = currentSteer;
+        steerConfig.SupplyCurrentLimitEnable = true;
+        steerConfig.StatorCurrentLimitEnable = true;
+        steerConfig.StatorCurrentLimit = currentSteerSupply;
+        steerConfig.SupplyCurrentLimit = currentSteerSupply;
         steerConfig.SupplyCurrentLowerTime = DriveConstants.STEER_PEAK_CURRENT_DURATION;
         angleMotor.getConfigurator().apply(steerConfig); // apply
 
         // drive
         CurrentLimitsConfigs driveConfig = new CurrentLimitsConfigs();
-        driveConfig.SupplyCurrentLimitEnable = DriveConstants.DRIVE_ENABLE_CURRENT_LIMIT;
-        driveConfig.SupplyCurrentLimit = currentDrive;
-        driveConfig.SupplyCurrentLowerLimit = currentDrive;
+        driveConfig.SupplyCurrentLimitEnable = true;
+        driveConfig.StatorCurrentLimitEnable = true;
+        driveConfig.SupplyCurrentLimit = currentDriveSupply;
+        driveConfig.StatorCurrentLimit = currentDriveStator;
         driveConfig.SupplyCurrentLowerTime = DriveConstants.DRIVE_PEAK_CURRENT_DURATION;
-        driveConfig.StatorCurrentLimit = currentDrive;
-        driveConfig.StatorCurrentLimitEnable = DriveConstants.DRIVE_ENABLE_CURRENT_LIMIT;
         driveMotor.getConfigurator().apply(driveConfig); // apply
     }
 
index 256eda1beb4efea1249106b94941ae789f049a09..c817cb9cd8efdef93f40476752c08f8c1d05aa22 100644 (file)
@@ -37,6 +37,12 @@ public interface ModuleIO {
     public Rotation2d[] odometryTurnPositions = new Rotation2d[] {};
 
     public double encoderOffset = 0.0;
+
+    // drivetrain is scary. I'm adding my own seperate logging
+    public double driveStator = 0.0;
+    public double driveSupply = 0.0;
+    public double steerStator = 0.0;
+    public double steerSupply = 0.0;
   }
 
   /** Updates the set of loggable inputs. */
index 15cfe5bb63cc82b679583bdc039b30013bd2ea5c..4bf9d345af00ddaa69c56bb1ed7f1051eda31279 100644 (file)
@@ -57,7 +57,7 @@ public class Hood extends SubsystemBase implements HoodIO {
                mm.MotionMagicJerk = 0; // Set to > 0 for "S-Curve" smoothing if needed
         motor.getConfigurator().apply(config);
 
-               setCurrentLimits(HoodConstants.NORMAL_CURRENT_LIMIT);
+               setNewCurrentLimit(HoodConstants.STATOR_CURRENT_LIMIT, HoodConstants.SUPPLY_CURRENT_LIMIT);
 
                motor.setPosition(Units.degreesToRotations(HoodConstants.MAX_ANGLE) * HoodConstants.HOOD_GEAR_RATIO);
 
@@ -169,34 +169,38 @@ public class Hood extends SubsystemBase implements HoodIO {
 
        public void calibrate(){
                calibrating = true;
-               setCurrentLimits(HoodConstants.CALIBRATING_CURRENT_LIMIT);
+               setNewCurrentLimit(HoodConstants.CALIBRATING_CURRENT_LIMIT, HoodConstants.CALIBRATING_CURRENT_LIMIT);
        }
 
        public void stopCalibrating(){
                motor.setPosition(Units.degreesToRotations(HoodConstants.MAX_ANGLE) * HoodConstants.HOOD_GEAR_RATIO);
                goalAngle = new Rotation2d(Units.degreesToRadians(HoodConstants.MAX_ANGLE));
-               setCurrentLimits(HoodConstants.NORMAL_CURRENT_LIMIT);
+               setNewCurrentLimit(HoodConstants.STATOR_CURRENT_LIMIT, HoodConstants.SUPPLY_CURRENT_LIMIT);
                calibrating = false;
        }
 
-       /**
-     * sets supply and stator current limits
-     * @param limitAmps the current limit for stator and supply current
-     */
-    public void setCurrentLimits(double limitAmps) {
-        CurrentLimitsConfigs limits = new CurrentLimitsConfigs()
-        .withStatorCurrentLimitEnable(true)
-        .withStatorCurrentLimit(limitAmps)
-        .withSupplyCurrentLimitEnable(true)
-        .withSupplyCurrentLimit(limitAmps);
-
-        motor.getConfigurator().apply(limits);
+       public void setNewCurrentLimit(double stator, double supply) {
+        CurrentLimitsConfigs limitConfig = new CurrentLimitsConfigs();
+        limitConfig.StatorCurrentLimit = stator;
+        limitConfig.StatorCurrentLimitEnable = true;
+        limitConfig.SupplyCurrentLimit = supply;
+        limitConfig.SupplyCurrentLimitEnable = true;
+        motor.getConfigurator().apply(limitConfig);
+    }
+
+    public double getSubsystemStatorCurrent() {
+        return inputs.motorStatorCurrent;
+    }
+
+    public double getSubsystemSupplyCurrent() {
+        return inputs.motorSupplyCurrent;
     }
 
     @Override
        public void updateInputs() {
                inputs.positionDeg = Units.rotationsToDegrees(motor.getPosition().getValueAsDouble()) / HoodConstants.HOOD_GEAR_RATIO;
                inputs.velocityRadPerSec = Units.rotationsToRadians(motor.getVelocity().getValueAsDouble()) / HoodConstants.HOOD_GEAR_RATIO;
-               inputs.motorCurrent = motor.getStatorCurrent().getValueAsDouble();
+               inputs.motorStatorCurrent = motor.getStatorCurrent().getValueAsDouble();
+               inputs.motorSupplyCurrent = motor.getStatorCurrent().getValueAsDouble();
        }
 }
index c170a0d7a86b7a58221f1294cdce4d8f49fd1641..9c2c037d2e98883b0918e657f25ffb0997238d11 100644 (file)
@@ -17,7 +17,8 @@ public class HoodConstants {
 
     public static final double FEEDFORWARD_KV = 0.12;
 
-    public static final double NORMAL_CURRENT_LIMIT = 40.0; // A
+    public static final double STATOR_CURRENT_LIMIT = 40.0; // A
+    public static final double SUPPLY_CURRENT_LIMIT = 40.0; // A
     public static final double CALIBRATING_CURRENT_LIMIT = 10.0; // A
     public static final double CALIBRATION_CURRENT_THRESHOLD = 9.0; // A
 }
index 42886b5b9c5464752382d9cda190fada46ab6fc8..ab4e7b3e0195a01113a437abfb005d5e5663a516 100644 (file)
@@ -7,7 +7,8 @@ public interface HoodIO {
     public static class HoodIOInputs{
         public double positionDeg = HoodConstants.MAX_ANGLE;
         public double velocityRadPerSec = 0.0;
-        public double motorCurrent = 0.0;
+        public double motorStatorCurrent = 0.0;
+        public double motorSupplyCurrent = 0.0;
     }
 
     public void updateInputs();
index 7fbb0caa9eef612178a0ee029f66ed280f8f0092..bca47d2a8e086412d2cf980fb03cd3f7f5c4cbf4 100644 (file)
@@ -124,21 +124,32 @@ public class Shooter extends SubsystemBase implements ShooterIO {
         return inputs.shooterSpeedLeft;
     }
 
-    public void setNewCurrentLimit(double newCurrentLimit) {
+    public void setNewCurrentLimit(double stator, double supply) {
         CurrentLimitsConfigs limitConfig = new CurrentLimitsConfigs();
-        limitConfig.StatorCurrentLimit = newCurrentLimit;
+        limitConfig.StatorCurrentLimit = stator;
         limitConfig.StatorCurrentLimitEnable = true;
+        limitConfig.SupplyCurrentLimit = supply;
+        limitConfig.SupplyCurrentLimitEnable = true;
         shooterMotorLeft.getConfigurator().apply(limitConfig);
         shooterMotorRight.getConfigurator().apply(limitConfig);
     }
 
+    public double getSubsystemStatorCurrent() {
+        return inputs.shooterStatorCurrentLeft + inputs.shooterStatorCurrentRight;
+    }
+
+    public double getSubsystemSupplyCurrent() {
+        return inputs.shooterSupplyCurrentLeft + inputs.shooterSupplyCurrentRight;
+    }
+
     @Override
     public void updateInputs(){
         inputs.shooterSpeedLeft = Units.rotationsToRadians(shooterMotorLeft.getVelocity().getValueAsDouble()) * ShooterConstants.SHOOTER_LAUNCH_DIAMETER/2;
         inputs.shooterSpeedRight = Units.rotationsToRadians(shooterMotorRight.getVelocity().getValueAsDouble())* ShooterConstants.SHOOTER_LAUNCH_DIAMETER/2;
-        inputs.shooterCurrentLeft = shooterMotorLeft.getStatorCurrent().getValueAsDouble();
-        inputs.shooterCurrentRight = shooterMotorRight.getStatorCurrent().getValueAsDouble();
-
+        inputs.shooterStatorCurrentLeft = shooterMotorLeft.getStatorCurrent().getValueAsDouble();
+        inputs.shooterStatorCurrentRight = shooterMotorRight.getStatorCurrent().getValueAsDouble();
+        inputs.shooterSupplyCurrentLeft = shooterMotorLeft.getSupplyCurrent().getValueAsDouble();
+        inputs.shooterSupplyCurrentRight = shooterMotorRight.getSupplyCurrent().getValueAsDouble();
 
         Logger.processInputs("Shooter", inputs);
     }
index b698a1f6e8dee2d3ac30e115b4ac8ec2bf14497a..796cf959c02ceeaf9aba0447a1ac67f7be3ce957 100644 (file)
@@ -7,8 +7,10 @@ public interface ShooterIO {
     public static class ShooterIOInputs {
         public double shooterSpeedLeft = 0.0;
         public double shooterSpeedRight = 0.0;
-        public double shooterCurrentLeft = 0.0;
-        public double shooterCurrentRight = 0.0;
+        public double shooterStatorCurrentLeft = 0.0;
+        public double shooterStatorCurrentRight = 0.0;
+        public double shooterSupplyCurrentLeft = 0.0;
+        public double shooterSupplyCurrentRight = 0.0;
     }
 
     public void updateInputs();
index 9b2c40e81555f7bfcc165df9c0d8d9a9510a8a99..f3e5b7cc7eaeddd5328665b1f9541b9cab47f058 100644 (file)
@@ -101,25 +101,31 @@ public class Spindexer extends SubsystemBase implements SpindexerIO {
         state = SpindexerState.CUSTOM;
     }
 
-    public double getStatorCurrent() {
-        return inputs.spindexerOneCurrent + inputs.spindexerTwoCurrent;
-    }
-
-    public void setNewCurrentLimit(double newCurrentLimit) {
+    public void setNewCurrentLimit(double stator, double supply) {
         CurrentLimitsConfigs limitConfig = new CurrentLimitsConfigs();
-        limitConfig.StatorCurrentLimit = newCurrentLimit;
+        limitConfig.StatorCurrentLimit = stator;
         limitConfig.StatorCurrentLimitEnable = true;
-        limitConfig.SupplyCurrentLowerLimit = newCurrentLimit;
-        limitConfig.SupplyCurrentLowerTime = 1.5;
+        limitConfig.SupplyCurrentLimit = supply;
+        limitConfig.SupplyCurrentLimitEnable = true;
         motorOne.getConfigurator().apply(limitConfig);
         motorTwo.getConfigurator().apply(limitConfig);
     }
 
+    public double getSubsystemStatorCurrent() {
+        return inputs.spindexerOneStatorCurrent + inputs.spindexerTwoStatorCurrent;
+    }
+
+    public double getSubsystemSupplyCurrent() {
+        return inputs.spindexerOneSupplyCurrent + inputs.spindexerTwoSupplyCurrent;
+    }
+
     @Override
     public void updateInputs() {
         inputs.spindexerOneVelocity = motorOne.getVelocity().getValueAsDouble();
-        inputs.spindexerOneCurrent = motorOne.getStatorCurrent().getValueAsDouble();
+        inputs.spindexerOneStatorCurrent = motorOne.getStatorCurrent().getValueAsDouble();
+        inputs.spindexerOneSupplyCurrent = motorOne.getSupplyCurrent().getValueAsDouble();
         inputs.spindexerTwoVelocity = motorTwo.getVelocity().getValueAsDouble();
-        inputs.spindexerTwoCurrent = motorTwo.getStatorCurrent().getValueAsDouble();
+        inputs.spindexerTwoStatorCurrent = motorTwo.getStatorCurrent().getValueAsDouble();
+        inputs.spindexerTwoSupplyCurrent = motorTwo.getSupplyCurrent().getValueAsDouble();
     }
 }
index e1a154f6fe6f38d2e47a0e744b20393a58335842..b1b5b89a8c41b16949a233be0f4ba04cec1e916b 100644 (file)
@@ -6,9 +6,11 @@ public interface SpindexerIO {
     @AutoLog
     public static class SpindexerIOInputs {
         public double spindexerOneVelocity = 0.0;
-        public double spindexerOneCurrent = 0.0;
+        public double spindexerOneSupplyCurrent = 0.0;
+        public double spindexerOneStatorCurrent = 0.0;
         public double spindexerTwoVelocity = 0.0;
-        public double spindexerTwoCurrent = 0.0;
+        public double spindexerTwoStatorCurrent = 0.0;
+        public double spindexerTwoSupplyCurrent = 0.0;
     }
 
     public void updateInputs();
index 6b05330f677c863fec0b15606cf01d34cb00e57c..33210e88b28695aa70b46d30f617d67964db5e17 100644 (file)
@@ -55,8 +55,6 @@ public class Turret extends SubsystemBase implements TurretIO{
        private double lastFilteredRad = 0.0;
        private double lastRawSetpoint = 0.0;
 
-
-
        /* ---------------- Visualization ---------------- */
 
        private final Mechanism2d mech = new Mechanism2d(100, 100);
@@ -65,8 +63,6 @@ public class Turret extends SubsystemBase implements TurretIO{
 
        private final MotionMagicVoltage mmVoltageRequest = new MotionMagicVoltage(0);
 
-       ModifiedCRT crt;
-
        /* ---------------- Constructor ---------------- */
 
        public Turret() {
@@ -86,7 +82,7 @@ public class Turret extends SubsystemBase implements TurretIO{
                mm.MotionMagicJerk = 0; // Set to > 0 for "S-Curve" smoothing if needed
         motor.getConfigurator().apply(config);
 
-               setCurrentLimits(TurretConstants.NORMAL_CURRENT_LIMIT);
+               setNewCurrentLimit(TurretConstants.STATOR_CURRENT_LIMIT, TurretConstants.SUPPLY_CURRENT_LIMIT);
 
                lastGoalRad = 0.0;
 
@@ -105,8 +101,6 @@ public class Turret extends SubsystemBase implements TurretIO{
 
                if (!Constants.DISABLE_SMART_DASHBOARD) {
                        SmartDashboard.putData("Turret Mech", mech);
-                       SmartDashboard.putData("Start turret calibration", new InstantCommand(()-> calibrate()));
-                       SmartDashboard.putData("Stop turret calibration", new InstantCommand(()-> stopCalibrating()));
                        SmartDashboard.putData("Reset Turret Position to Zero", new InstantCommand(() -> resetTurretPosition()));
 
                        SendableChooser<InstantCommand> turretTestChooser = new SendableChooser<>();
@@ -210,19 +204,11 @@ public class Turret extends SubsystemBase implements TurretIO{
                // Multiply goal velocity by kV
                double robotTurnCompensation = goalVelocityRadPerSec * TurretConstants.FEEDFORWARD_KV * TurretConstants.GEAR_RATIO;
 
-               if(calibrating){
-                       motor.set(0.05);
-                       boolean calibrated = Math.abs(motor.getStatorCurrent().getValueAsDouble()) >= TurretConstants.CALIBRATION_CURRENT_THRESHOLD;
-                       if(calibrationDebouncer.calculate(calibrated)){
-                               stopCalibrating();
-                       }
-               } else {
-                       // Sets motor control with feedforward
-                       motor.setControl(mmVoltageRequest
-                       .withPosition(motorGoalRotations)
-                       .withFeedForward(robotTurnCompensation)
-                       .withEnableFOC(true));
-               }
+               // Sets motor control with feedforward
+               motor.setControl(mmVoltageRequest
+               .withPosition(motorGoalRotations)
+               .withFeedForward(robotTurnCompensation)
+               .withEnableFOC(true));
 
         if (!Constants.DISABLE_LOGGING) {
             Logger.recordOutput("Turret/Voltage", motor.getMotorVoltage().getValue());
@@ -237,7 +223,6 @@ public class Turret extends SubsystemBase implements TurretIO{
                        SmartDashboard.putBoolean("Turret Calibrated", !calibrating);
                        SmartDashboard.putBoolean("Turret At Setpoint", atSetpoint());
                }
-               
        }
 
        /* ---------------- Simulation ---------------- */
@@ -258,45 +243,25 @@ public class Turret extends SubsystemBase implements TurretIO{
        public void updateInputs() {
                inputs.positionDeg = Units.rotationsToDegrees(motor.getPosition().getValueAsDouble()) / TurretConstants.GEAR_RATIO;
                inputs.velocityRadPerSec = Units.rotationsToRadians(motor.getVelocity().getValueAsDouble()) / TurretConstants.GEAR_RATIO;
-               inputs.motorCurrent = motor.getStatorCurrent().getValueAsDouble();
+               inputs.motorStatorCurrent = motor.getStatorCurrent().getValueAsDouble();
+               inputs.motorSupplyCurrent = motor.getSupplyCurrent().getValueAsDouble();
                inputs.motorVoltage = motor.getMotorVoltage().getValueAsDouble();
        }
 
-       /**
-     * sets supply and stator current limits
-     * @param limit the current limit for stator and supply current
-     */
-    public void setCurrentLimits(double limit) {
-        CurrentLimitsConfigs limits = new CurrentLimitsConfigs()
-        .withStatorCurrentLimitEnable(true)
-        .withStatorCurrentLimit(limit)
-        .withSupplyCurrentLimitEnable(true)
-        .withSupplyCurrentLimit(limit);
-
-               if(limit == TurretConstants.NORMAL_CURRENT_LIMIT){
-                       limits.SupplyCurrentLowerLimit = TurretConstants.CALIBRATION_CURRENT_LIMIT;
-                       limits.SupplyCurrentLowerTime = 1.0; // Set to lower limit if over 1 second
-               }
-
-        motor.getConfigurator().apply(limits);
+       public void setNewCurrentLimit(double stator, double supply) {
+        CurrentLimitsConfigs limitConfig = new CurrentLimitsConfigs();
+        limitConfig.StatorCurrentLimit = stator;
+        limitConfig.StatorCurrentLimitEnable = true;
+        limitConfig.SupplyCurrentLimit = supply;
+        limitConfig.SupplyCurrentLimitEnable = true;
+        motor.getConfigurator().apply(limitConfig);
     }
 
-       // Also ignore this for now
-       private double wrapUnit(double value) {
-               value %= 1.0;
-               if (value < 0) value += 1.0;
-               return value;
-       }
-
-       private void calibrate(){
-               setCurrentLimits(TurretConstants.CALIBRATION_CURRENT_LIMIT);
-               calibrating = true;
-       }
+    public double getSubsystemStatorCurrent() {
+        return inputs.motorStatorCurrent;
+    }
 
-       private void stopCalibrating(){
-               motor.set(Units.degreesToRotations(TurretConstants.CALIBRATION_OFFSET) * TurretConstants.GEAR_RATIO);
-               setCurrentLimits(TurretConstants.NORMAL_CURRENT_LIMIT);
-               calibrating = false;
-               setFieldRelativeTarget(new Rotation2d(Units.degreesToRadians(TurretConstants.CALIBRATION_OFFSET)), 0.0);
-       }
+    public double getSubsystemSupplyCurrent() {
+        return inputs.motorSupplyCurrent;
+    }
 }
index f08df03e128da2304647e6d58b8f522ec95b60fd..366a215f52a4fb01d71e853ac2c6c8603868b532 100644 (file)
@@ -26,8 +26,7 @@ public class TurretConstants {
 
        public static final double FEEDFORWARD_KV = 0.06;
 
-    public static final double NORMAL_CURRENT_LIMIT = 40.0; // A
-    public static final double CALIBRATION_CURRENT_LIMIT = 10.0; // A
-    public static final double CALIBRATION_CURRENT_THRESHOLD = 9.0; // A
+    public static final double STATOR_CURRENT_LIMIT = 40.0; // A
+    public static final double SUPPLY_CURRENT_LIMIT = 40.0; // A
 
 }
index a7bd928366220e9cd9d7600234c91516ebd04cc9..385cf19578021cdfc5f05bf6cfbab4206d8fb0ff 100644 (file)
@@ -7,7 +7,8 @@ public interface TurretIO {
     public static class TurretIOInputs{
         public double positionDeg = 0;
         public double velocityRadPerSec = 0;
-        public double motorCurrent = 0;
+        public double motorStatorCurrent = 0;
+        public double motorSupplyCurrent = 0;
         public double encoderLeftRot = 0;
         public double encoderRightRot = 0;
         public double motorVoltage = 0;
diff --git a/src/main/java/frc/robot/util/BrownOut/BrownOutConstants.java b/src/main/java/frc/robot/util/BrownOut/BrownOutConstants.java
deleted file mode 100644 (file)
index f9dc0c6..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-package frc.robot.util.BrownOut;
-
-import frc.robot.constants.IntakeConstants;
-import frc.robot.constants.swerve.DriveConstants;
-import frc.robot.subsystems.hood.HoodConstants;
-import frc.robot.subsystems.shooter.ShooterConstants;
-import frc.robot.subsystems.spindexer.SpindexerConstants;
-import frc.robot.subsystems.turret.TurretConstants;
-
-public class BrownOutConstants {
-    /* level one should be less protected that level two and so on. So the current limits will be higher at lvl one.
-        Order is:
-        Shooter, (applied to both motors)
-        Hood,
-        Spindexer,
-        Turret,
-        Intake,
-        Steer (main power draw) (is applied to continous and peak)
-        Drive (main power draw) (is applied to continous and peak)
-    */
-
-    // currently for show. I would imagine u would decrease movement: drivetrain, then bps impacters: intake/indexing speed, and then a bit on aiming: turret/hood. 
-    // I don't see a world where you would decrease shooter current, but we need to do some testing to see how much current we are at when shooting
-    
-    // level numbers
-    public static final double LEVEL_ONE_LIMIT = 7.5;
-    public static final double LEVEL_TWO_LIMIT = 6.75;
-    public static final double LEVEL_THREE_LIMIT = 6.0;
-    public static final double LEVEL_FOUR_LIMIT = 5.25;
-
-    // normal
-    public static final BrownOutLevel BROWNOUT_LVL_ONE = new BrownOutLevel(
-        ShooterConstants.SHOOTER_CURRENT_LIMIT, 
-        HoodConstants.NORMAL_CURRENT_LIMIT, 
-        SpindexerConstants.currentLimit, 
-        TurretConstants.NORMAL_CURRENT_LIMIT, 
-        IntakeConstants.NORMAL_CURRENT_LIMIT, 
-        DriveConstants.STEER_PEAK_CURRENT_LIMIT, 
-        DriveConstants.DRIVE_PEAK_CURRENT_LIMIT
-    );
-
-    // should deplete drivetrain a bit and lower everything else slightly. Preserve Shooter.
-    public static final BrownOutLevel BROWNOUT_LVL_TWO = new BrownOutLevel(
-        ShooterConstants.SHOOTER_CURRENT_LIMIT * 1.0, // keep as same 
-        HoodConstants.NORMAL_CURRENT_LIMIT * 1.0, // preserve aiming speed
-        SpindexerConstants.currentLimit * 1.0, // preserve indexing speed
-        TurretConstants.NORMAL_CURRENT_LIMIT * 1.0, // preserve aiming speed
-        IntakeConstants.NORMAL_CURRENT_LIMIT * 1.0, // preserve indexing speed
-        DriveConstants.STEER_PEAK_CURRENT_LIMIT * 0.8, // lower drive rotation
-        DriveConstants.DRIVE_PEAK_CURRENT_LIMIT * 0.8  // lower drive movement
-    );
-
-    // lower bps systems: intake & spindexer. Preserve Shooter. Slight lower on evertthing else
-    public static final BrownOutLevel BROWNOUT_LVL_THREE = new BrownOutLevel(
-        ShooterConstants.SHOOTER_CURRENT_LIMIT * 1.0, // keep as same 
-        HoodConstants.NORMAL_CURRENT_LIMIT * 1.0, // preserve aiming speed
-        SpindexerConstants.currentLimit * 0.8, // preserve indexing speed
-        TurretConstants.NORMAL_CURRENT_LIMIT * 1.0, // preserve aiming speed
-        IntakeConstants.NORMAL_CURRENT_LIMIT * 0.8, // preserve indexing speed
-        DriveConstants.STEER_PEAK_CURRENT_LIMIT * 0.7, // lower drive rotation
-        DriveConstants.DRIVE_PEAK_CURRENT_LIMIT * 0.7  // lower drive movement
-    );
-
-    // lower aiming systems: turret & hood. Preserve Shooter. Slight lower on everything else
-    public static final BrownOutLevel BROWNOUT_LVL_FOUR = new BrownOutLevel(
-        ShooterConstants.SHOOTER_CURRENT_LIMIT * 1.0, // keep as same 
-        HoodConstants.NORMAL_CURRENT_LIMIT * 0.8, // preserve aiming speed
-        SpindexerConstants.currentLimit * 0.6, // preserve indexing speed
-        TurretConstants.NORMAL_CURRENT_LIMIT * 0.8, // preserve aiming speed
-        IntakeConstants.NORMAL_CURRENT_LIMIT * 0.6, // preserve indexing speed
-        DriveConstants.STEER_PEAK_CURRENT_LIMIT * 0.5, // lower drive rotation
-        DriveConstants.DRIVE_PEAK_CURRENT_LIMIT * 0.5  // lower drive movement
-    );
-
-    // now we have to deplete shooter... THIS IS REALLY BAD IS IT COMES TO THIS.
-    public static final BrownOutLevel BROWNOUT_LVL_FIVE = new BrownOutLevel(
-        ShooterConstants.SHOOTER_CURRENT_LIMIT * 0.8, // keep as same 
-        HoodConstants.NORMAL_CURRENT_LIMIT * 0.7, // preserve aiming speed
-        SpindexerConstants.currentLimit * 0.5, // preserve indexing speed
-        TurretConstants.NORMAL_CURRENT_LIMIT * 0.7, // preserve aiming speed
-        IntakeConstants.NORMAL_CURRENT_LIMIT * 0.5, // preserve indexing speed
-        DriveConstants.STEER_PEAK_CURRENT_LIMIT * 0.45, // lower drive rotation
-        DriveConstants.DRIVE_PEAK_CURRENT_LIMIT * 0.45  // lower drive movement
-    );
-
-}
diff --git a/src/main/java/frc/robot/util/BrownOut/BrownOutLevel.java b/src/main/java/frc/robot/util/BrownOut/BrownOutLevel.java
deleted file mode 100644 (file)
index 4a7ff2e..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-package frc.robot.util.BrownOut;
-
-public class BrownOutLevel {
-    // in percentage values (0.0-1.0)
-    public double shooterCurrent; // A  -> priority one
-    public double hoodCurrent; // A -> priority two
-    public double turretCurrent; // A -> priority two
-    public double spindexerCurrent; // A -> priority three
-    public double intakeCurrent; // A -> priority three
-    public double steerCurrent; // A -> priority four? (idk)
-    public double driveCurrent; // A -> priority four? (idk)
-
-    public BrownOutLevel(
-        double shooterCurrent, 
-        double hoodCurrent,
-        double spindexerCurrent,
-        double turretCurrent,
-        double intakeCurrent,
-        double steerCurrent,
-        double driveCurrent
-    ) {
-        this.shooterCurrent = shooterCurrent;
-        this.hoodCurrent = hoodCurrent;
-        this.spindexerCurrent = spindexerCurrent;
-        this.turretCurrent = turretCurrent;
-        this.intakeCurrent = intakeCurrent;
-        this.steerCurrent = steerCurrent;
-        this.driveCurrent = driveCurrent;
-    }
-
-}
-