]> git.taranathan.com Git - FRC2026.git/commitdiff
Revert "changed to robot.getalliance"
authormoo <moogoesmeow123@gmail.com>
Fri, 6 Mar 2026 20:38:43 +0000 (12:38 -0800)
committermoo <moogoesmeow123@gmail.com>
Fri, 6 Mar 2026 20:38:43 +0000 (12:38 -0800)
This reverts commit eb577a64115a39b84b7234a3d56333b165ed7ea1.
robot.getalliance doesn't actually better or worse than
driverstation.getalliance, it only doesn't return an optional,
robot.getalliance defaults to red

src/main/java/frc/robot/util/HubActive.java

index 05e0b43bbe8783171fab9b544b85d3e6eb03db21..dd5b76255f936d63aca9e89ebcfd1531491a9ccd 100644 (file)
@@ -4,16 +4,15 @@ import java.util.Optional;
 
 import edu.wpi.first.wpilibj.DriverStation;
 import edu.wpi.first.wpilibj.DriverStation.Alliance;
-import frc.robot.Robot;
 
 public class HubActive {
 
   static public boolean isHubActive() {
-    Alliance alliance = Robot.getAlliance();
+    Optional<Alliance> alliance = DriverStation.getAlliance();
     // If we have no alliance, we cannot be enabled, therefore no hub.
-    // if (alliance.isEmpty()) {
-    //   return false;
-    // }
+    if (alliance.isEmpty()) {
+      return false;
+    }
     // Hub is always enabled in autonomous.
     if (DriverStation.isAutonomousEnabled()) {
       return true;
@@ -42,7 +41,7 @@ public class HubActive {
     }
 
     // Shift was is active for blue if red won auto, or red if blue won auto.
-    boolean shift1Active = switch (alliance) {
+    boolean shift1Active = switch (alliance.get()) {
       case Red -> !redInactiveFirst;
       case Blue -> redInactiveFirst;
     };
@@ -70,11 +69,11 @@ public class HubActive {
 
   static public Optional<Double> timeToActive() {
 
-    Alliance alliance = Robot.getAlliance();
+    Optional<Alliance> alliance = DriverStation.getAlliance();
     // If we have no alliance, we cannot be enabled, therefore no hub.
-    // if (alliance.isEmpty()) {
-    //   return Optional.empty();
-    // }
+    if (alliance.isEmpty()) {
+      return Optional.empty();
+    }
     // Hub is always enabled in autonomous.
     if (DriverStation.isAutonomousEnabled()) {
       return Optional.of(0.0);
@@ -103,7 +102,7 @@ public class HubActive {
     }
 
     // Shift was is active for blue if red won auto, or red if blue won auto.
-    boolean shift1Active = switch (alliance) {
+    boolean shift1Active = switch (alliance.get()) {
       case Red -> !redInactiveFirst;
       case Blue -> redInactiveFirst;
     };