Skip to content

QFRCLib

Carson Rueter edited this page Nov 21, 2024 · 2 revisions

QFRCLib is a one-file robot-side library that allows you to interact with the dashboard.

Simply add the QFRCLib.java file to your robot project.

TabAndErrors

Tab Selection

To switch tabs from the robot code side, use QFRCLib.setTab(String). For example, to have separate tabs for Autonomous and Teleop modes:

// Robot.java

public void autonomousInit() {
    QFRCLib.setTab("Autonomous");
}

public void teleopInit() {
    QFRCLib.setTab("Teleop");
}

Errors

To report errors from the robot, use QFRCLib.reportError(level, message). level can be any of: Critical, Warning, Information.

Examples:

QFRCLib.reportError(ErrorLevel.Critical, "Browned out!");
QFRCLib.reportError(ErrorLevel.Warning, "Battery Voltage is low");
QFRCLib.reportError(ErrorLevel.Information, "Robot is ready.");

To show these on the dashboard, add the QFRCDashboard -> Errors widget:

image

Then, your errors will show as such:

image

By default, a maximum of 5 errors will be shown at a given time, rotated via FIFO. You can configure this with QFRCLib.setErrorHistoryLength(int).

QFRCLib.setErrorHistoryLength(10);

image

Clone this wiki locally