]> git.taranathan.com Git - FRC2026.git/commitdiff
quick format
authoriefomit <timofei.stem@gmail.com>
Mon, 20 Apr 2026 14:47:30 +0000 (07:47 -0700)
committeriefomit <timofei.stem@gmail.com>
Mon, 20 Apr 2026 14:47:30 +0000 (07:47 -0700)
src/main/java/frc/robot/subsystems/PowerControl/Battery.java
src/main/java/frc/robot/subsystems/PowerControl/BatteryConstants.java
src/main/java/frc/robot/subsystems/PowerControl/BreakerConstants.java
src/main/java/frc/robot/subsystems/PowerControl/EMABreaker.java

index e6dda68cc9bc70f20dd27d84348dd5cd2f533d5e..78af8538480426e47e83b5dbfbcc8ed95928c794 100644 (file)
@@ -5,17 +5,24 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase;
 
 public class Battery extends SubsystemBase {
     private double voltage;
+
     public Battery() {
         updateVoltageFromBattery();
     }
 
-    private void updateVoltageFromBattery() { 
+    private void updateVoltageFromBattery() {
         voltage = RobotController.getBatteryVoltage();
     }
-    public double getVoltage() { return voltage; }
 
-    public double voltsTillBrownOut() { return voltage - RobotController.getBrownoutVoltage(); }
-    public double toBrownOut() { 
+    public double getVoltage() {
+        return voltage;
+    }
+
+    public double voltsTillBrownOut() {
+        return voltage - RobotController.getBrownoutVoltage();
+    }
+
+    public double toBrownOut() {
         // percent of volts we've got left over what we had to start with
         return voltsTillBrownOut() / (BatteryConstants.MAX_STARTING_VOLTS - RobotController.getBrownoutVoltage());
     }
index 0f83c59d6d3ddc5540dc1823aa7283e4e5e35041..cad6d869ed86a87fbd76dc15370ac0182f8149fa 100644 (file)
@@ -1,5 +1,5 @@
 package frc.robot.subsystems.PowerControl;
 
 public class BatteryConstants {
-    public static final double MAX_STARTING_VOLTS = 12.5; // V 
+    public static final double MAX_STARTING_VOLTS = 12.5; // V
 }
index 8d57e4512efd134c1dcd996c278c8e30a0494f09..d7f183bca936177676c857dcd6fb538f9d987046 100644 (file)
@@ -16,10 +16,10 @@ public class BreakerConstants {
     public static final double WARNING_PERCENTAGE = 0.6; // percent that the system reacts to approaching thresholds
 
     // ports
-    public static int[] DRIVETRAIN_PORTS = {8,9,10,11,18,19,0,1}; // bls, bld, fld, fls, frs, frd, brd, brs
-    public static int[] TURRET_PORTS = {2};
-    public static int[] INTAKE_PORTS = {15,14,13}; // right, left, roller
-    public static int[] SHOOTER_PORTS = {3,4}; // left, right
-    public static int[] HOOD_PORTS = {5}; // shooter
-    public static int[] SPINDEXER_PORTS = {12}; // spindexer (unupdated on sheets) 
+    public static int[] DRIVETRAIN_PORTS = { 8, 9, 10, 11, 18, 19, 0, 1 }; // bls, bld, fld, fls, frs, frd, brd, brs
+    public static int[] TURRET_PORTS = { 2 };
+    public static int[] INTAKE_PORTS = { 15, 14, 13 }; // right, left, roller
+    public static int[] SHOOTER_PORTS = { 3, 4 }; // left, right
+    public static int[] HOOD_PORTS = { 5 }; // shooter
+    public static int[] SPINDEXER_PORTS = { 12 }; // spindexer (unupdated on sheets)
 }
index 39770fb87c76c6ec46e0270620230c42acb00331..2ee9e95c172c97edb3ebe525dcd8949fac48b775 100644 (file)
@@ -34,13 +34,13 @@ public class EMABreaker extends SubsystemBase {
             Current w = new Current(); // create a filter for the threshold
             w.tau = tau;
             w.threshold = threshold;
-            w.alpha = 1 - Math.exp(-Constants.LOOP_TIME / tau); // 1 - e^(-0.02/1) = 0.0198, 1 - e^(-0.02/2) = 0.00995 
+            w.alpha = 1 - Math.exp(-Constants.LOOP_TIME / tau); // 1 - e^(-0.02/1) = 0.0198, 1 - e^(-0.02/2) = 0.00995
 
             filters.add(w);
         }
 
         // subsystems
-        for (int i=0; i<pDis.getNumChannels(); i++) {
+        for (int i = 0; i < pDis.getNumChannels(); i++) {
             double tau = 1.0;
             double threshold = i;
             Current w = new Current();
@@ -62,15 +62,17 @@ public class EMABreaker extends SubsystemBase {
             Logger.recordOutput("Breaker/IntervalAverage/" + f.tau, f.average);
         }
 
-        // this is getting currents coming out of all the ports from PDH (big thing under robot all the wires come out of)
+        // this is getting currents coming out of all the ports from PDH (big thing
+        // under robot all the wires come out of)
         subsystemCurrents = getAllCurrentFromPowerDistribution();
-        
+
         // this should average out all ports
         for (Current s : subsystems) {
             s.average += s.alpha * (subsystemCurrents[(int) s.threshold] - s.average);
         }
 
-        // this should use updated port averages and sum them to get drivetrain average draw for 1 tau (can add more later)
+        // this should use updated port averages and sum them to get drivetrain average
+        // draw for 1 tau (can add more later)
         Logger.recordOutput("Breaker/DrivetrainAverageDraw", getAverageCurrentDraw(BreakerConstants.DRIVETRAIN_PORTS));
         Logger.recordOutput("Breaker/SpindexerDraw", getAverageCurrentDraw(BreakerConstants.SPINDEXER_PORTS));
         Logger.recordOutput("Breaker/ShooterDraw", getAverageCurrentDraw(BreakerConstants.SHOOTER_PORTS));
@@ -92,7 +94,8 @@ public class EMABreaker extends SubsystemBase {
     }
 
     public double getCurrentFromPowerDistribution() {
-        return pDis.getTotalCurrent(); // not using .getCurrent() and then an arguement for the port you can get just one port
+        return pDis.getTotalCurrent(); // not using .getCurrent() and then an arguement for the port you can get just
+                                       // one port
     }
 
     public double[] getAllCurrentFromPowerDistribution() {
@@ -125,7 +128,7 @@ public class EMABreaker extends SubsystemBase {
                 worst = f;
             }
         }
-        double[] returnValue = {worst.average/worst.threshold, worst.tau};
+        double[] returnValue = { worst.average / worst.threshold, worst.tau };
         return returnValue;
     }
 }