Class PhoenixAlert
java.lang.Object
com.ctre.phoenix6.alerts.PhoenixAlert
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.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCreates an invalid alert.PhoenixAlert(String group, String id, PhoenixAlert.Level level) Creates a new alert.PhoenixAlert(String group, String id, PhoenixAlert.Level level, String text) Creates a new alert. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisValid()voidSets the alert state to active without changing the text.voidSets the alert state to active and optionally changes the text.voidSets the alert state to inactive.withDebounce(double debounceSeconds) Sets the time debounce of this alert, default 1 second.
-
Constructor Details
-
PhoenixAlert
public PhoenixAlert()Creates an invalid alert. -
PhoenixAlert
Creates a new alert.- Parameters:
group- Group identifierid- Alert identifier, unique within the grouplevel- Alert urgency level
-
PhoenixAlert
Creates a new alert.- Parameters:
group- Group identifierid- Alert identifier, unique within the grouplevel- Alert urgency leveltext- Alert text to display when the alert is active
-
-
Method Details
-
isValid
public boolean isValid()- Returns:
- Whether this alert is valid
-
withDebounce
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
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.
-