Class PhoenixAlert

java.lang.Object
com.ctre.phoenix6.alerts.PhoenixAlert

public final class PhoenixAlert extends Object
Persistent alert with debouncing.

On a FIRST robot controller, this shows up as a persistent alert in the Driver Station and compatible NetworkTables dashboards. Otherwise, this is a no-op.

  • Constructor Details

    • PhoenixAlert

      public PhoenixAlert()
      Creates an invalid alert.
    • PhoenixAlert

      public PhoenixAlert(String group, String id, PhoenixAlert.Level level)
      Creates a new alert.
      Parameters:
      group - Group identifier
      id - Alert identifier, unique within the group
      level - Alert urgency level
    • PhoenixAlert

      public PhoenixAlert(String group, String id, PhoenixAlert.Level level, String text)
      Creates a new alert.
      Parameters:
      group - Group identifier
      id - Alert identifier, unique within the group
      level - Alert urgency level
      text - Alert text to display when the alert is active
  • Method Details

    • isValid

      public boolean isValid()
      Returns:
      Whether this alert is valid
    • withDebounce

      public PhoenixAlert withDebounce(double debounceSeconds)
      Sets the time debounce of this alert, default 1 second.
      Parameters:
      debounceSeconds - Debounce time in seconds
      Returns:
      This alert
    • setActive

      public void setActive()
      Sets the alert state to active without changing the text. This should be called periodically, even if the active state does not change.
    • setActive

      public void setActive(String text)
      Sets the alert state to active and optionally changes the text. This should be called periodically, even if the active state does not change.
      Parameters:
      text - New text to display, or null to leave it unchanged
    • setInactive

      public void setInactive()
      Sets the alert state to inactive.