-
Notifications
You must be signed in to change notification settings - Fork 1
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.
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");
}
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:
Then, your errors will show as such:
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);