Alert

class wpilib.Alert(*args, **kwargs)

Bases: pybind11_object

Persistent alert to be sent via NetworkTables. Alerts are tagged with a type of kError, kWarning, or kInfo to denote urgency. See Alert::AlertType for suggested usage of each type. Alerts can be displayed on supported dashboards, and are shown in a priority order based on type and recency of activation, with newly activated alerts first.

Alerts should be created once and stored persistently, then updated to “active” or “inactive” as necessary. Set(bool) can be safely called periodically.

This API is new for 2025, but is likely to change in future seasons to facilitate deeper integration with the robot control system.

class Robot {
  frc::Alert alert{"Something went wrong", frc::Alert::AlertType::kWarning};
}

Robot::periodic() {
  alert.Set(...);
}

Overloaded function.

  1. __init__(self: wpilib._wpilib.Alert, text: str, type: wpilib._wpilib.Alert.AlertType) -> None

Creates a new alert in the default group - “Alerts”. If this is the first to be instantiated, the appropriate entries will be added to NetworkTables.

Parameters:
  • text – Text to be displayed when the alert is active.

  • type – Alert urgency level.

  1. __init__(self: wpilib._wpilib.Alert, group: str, text: str, type: wpilib._wpilib.Alert.AlertType) -> None

Creates a new alert. If this is the first to be instantiated in its group, the appropriate entries will be added to NetworkTables.

Parameters:
  • group – Group identifier, used as the entry name in NetworkTables.

  • text – Text to be displayed when the alert is active.

  • type – Alert urgency level.

class AlertType(value: int)

Bases: pybind11_object

Represents an alert’s level of urgency.

Members:

kError : High priority alert - displayed first on the dashboard with a red “X”

symbol. Use this type for problems which will seriously affect the robot’s functionality and thus require immediate attention.

kWarning : Medium priority alert - displayed second on the dashboard with a yellow

“!” symbol. Use this type for problems which could affect the robot’s functionality but do not necessarily require immediate attention.

kInfo : Low priority alert - displayed last on the dashboard with a green “i”

symbol. Use this type for problems which are unlikely to affect the robot’s functionality, or any other alerts which do not fall under the other categories.

kError = <AlertType.kError: 0>
kInfo = <AlertType.kInfo: 2>
kWarning = <AlertType.kWarning: 1>
property name
property value
get() bool

Gets whether the alert is active.

Returns:

whether the alert is active.

getText() str

Gets the current alert text.

Returns:

the current text.

getType() wpilib._wpilib.Alert.AlertType

Get the type of this alert.

Returns:

the type

set(active: bool) None

Sets whether the alert should currently be displayed. This method can be safely called periodically.

Parameters:

active – Whether to display the alert.

setText(text: str) None

Updates current alert text. Use this method to dynamically change the displayed alert, such as including more details about the detected problem.

Parameters:

text – Text to be displayed when the alert is active.