QFRCLib - Q-FRC/QDash GitHub Wiki
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.
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:
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);
Notifications
See the Notifications page.
Miscellaneous
You can start the web server used for Remote Layouts via startWebServer
:
QFRCLib.startWebServer();