Package frc.lib.util

Class FaultUtil

java.lang.Object
frc.lib.util.FaultUtil

public class FaultUtil extends Object
Utility class for parsing raw fault bitfields from REV hardware into readable strings. Ideal for logging faults via AdvantageKit or SmartDashboard.
  • Method Details

    • appendSparkFaults

      public static void appendSparkFaults(StringBuilder sb, int faults)
      Appends Spark Max faults to a StringBuilder based on bitfields.
      Parameters:
      sb - The StringBuilder to append faults to.
      faults - The integer representing the fault flags.
    • appendSparkWarnings

      public static void appendSparkWarnings(StringBuilder sb, int warnings)
      Appends Spark Max warnings to a StringBuilder based on bitfields.
      Parameters:
      sb - The StringBuilder to append warnings to.
      warnings - The integer representing the warning flags.
    • appendPdhFaults

      public static void appendPdhFaults(StringBuilder sb, int faults, boolean isSticky)
      Appends PDH faults to a StringBuilder based on bitfields.
      Parameters:
      sb - The StringBuilder to append faults to.
      faults - The integer representing the fault flags.
      isSticky - Whether to append sticky faults.
    • appendCanandgyroFaults

      public static void appendCanandgyroFaults(StringBuilder sb, int faults)
      Appends Canandgyro faults to a StringBuilder based on bitfields.
      Parameters:
      sb - The StringBuilder to append faults to.
      faults - The 8-bit integer representing the fault flags.
    • appendNavXFaults

      public static void appendNavXFaults(StringBuilder sb, int faults)
      Appends NavX faults to a StringBuilder based on bitfields.
      Parameters:
      sb - The StringBuilder to append faults to.
      faults - The integer representing the fault flags.
    • appendGyroFaults

      public static void appendGyroFaults(StringBuilder sb, GyroType type, int faults)
      Appends gyro faults to a StringBuilder based on the gyro type and fault flags.
      Parameters:
      sb - The StringBuilder to append faults to.
      type - The type of the gyro.
      faults - The integer representing the fault flags.