Class AllianceUtil

java.lang.Object
com.marslib.util.AllianceUtil

public final class AllianceUtil extends Object
Utility class providing cached, GC-friendly alliance queries.

This eliminates repeated DriverStation.getAlliance() calls that each return a new Optional allocation. Use isRed() and isBlue() throughout the codebase instead of calling the DriverStation directly.

  • Method Details

    • isRed

      public static boolean isRed()
      Returns true if the robot is on the Red alliance.
      Returns:
      true if alliance is present and is Red; false otherwise.
    • isBlue

      public static boolean isBlue()
      Returns true if the robot is on the Blue alliance.
      Returns:
      true if alliance is present and is Blue; false otherwise.