WPILibC++ 2024.3.2
frc::Shuffleboard Class Referencefinal

The Shuffleboard class provides a mechanism with which data can be added and laid out in the Shuffleboard dashboard application from a robot program. More...

#include <frc/shuffleboard/Shuffleboard.h>

Static Public Member Functions

static void Update ()
 Updates all the values in Shuffleboard. More...
 
static ShuffleboardTabGetTab (std::string_view title)
 Gets the Shuffleboard tab with the given title, creating it if it does not already exist. More...
 
static void SelectTab (int index)
 Selects the tab in the dashboard with the given index in the range [0..n-1], where n is the number of tabs in the dashboard at the time this method is called. More...
 
static void SelectTab (std::string_view title)
 Selects the tab in the dashboard with the given title. More...
 
static void EnableActuatorWidgets ()
 Enables user control of widgets containing actuators: motor controllers, relays, etc. More...
 
static void DisableActuatorWidgets ()
 Disables user control of widgets containing actuators. More...
 
static void StartRecording ()
 Starts data recording on the dashboard. More...
 
static void StopRecording ()
 Stops data recording on the dashboard. More...
 
static void SetRecordingFileNameFormat (std::string_view format)
 Sets the file name format for new recording files to use. More...
 
static void ClearRecordingFileNameFormat ()
 Clears the custom name format for recording files. More...
 
static void AddEventMarker (std::string_view name, std::string_view description, ShuffleboardEventImportance importance)
 Notifies Shuffleboard of an event. More...
 
static void AddEventMarker (std::string_view name, ShuffleboardEventImportance importance)
 Notifies Shuffleboard of an event. More...
 

Static Public Attributes

static constexpr const char * kBaseTableName = "/Shuffleboard"
 The name of the base NetworkTable into which all Shuffleboard data will be added. More...
 

Detailed Description

The Shuffleboard class provides a mechanism with which data can be added and laid out in the Shuffleboard dashboard application from a robot program.

Tabs and layouts can be specified, as well as choosing which widgets to display with and setting properties of these widgets; for example, programmers can specify a specific boolean value to be displayed with a toggle button instead of the default colored box, or set custom colors for that box.

For example, displaying a boolean entry with a toggle button:


NetworkTableEntry myBoolean = Shuffleboard.getTab("Example Tab")
.add("My Boolean", false)
.withWidget("Toggle Button")
.getEntry();

Changing the colors of the boolean box:


NetworkTableEntry myBoolean = Shuffleboard.getTab("Example Tab")
.add("My Boolean", false)
.withWidget("Boolean Box")
.withProperties(Map.of("colorWhenTrue", "green", "colorWhenFalse",
"maroon")) .getEntry();

Specifying a parent layout. Note that the layout type must always be specified, even if the layout has already been generated by a previously defined entry.


NetworkTableEntry myBoolean = Shuffleboard.getTab("Example Tab")
.getLayout("List", "Example List")
.add("My Boolean", false)
.withWidget("Toggle Button")
.getEntry();

Teams are encouraged to set up shuffleboard layouts at the start of the robot program.

Member Function Documentation

◆ AddEventMarker() [1/2]

static void frc::Shuffleboard::AddEventMarker ( std::string_view  name,
ShuffleboardEventImportance  importance 
)
static

Notifies Shuffleboard of an event.

Events can range from as trivial as a change in a command state to as critical as a total power loss or component failure. If Shuffleboard is recording, the event will also be recorded.

If name is null or empty, no event will be sent and an error will be printed to the driver station.

Parameters
namethe name of the event
importancethe importance of the event

◆ AddEventMarker() [2/2]

static void frc::Shuffleboard::AddEventMarker ( std::string_view  name,
std::string_view  description,
ShuffleboardEventImportance  importance 
)
static

Notifies Shuffleboard of an event.

Events can range from as trivial as a change in a command state to as critical as a total power loss or component failure. If Shuffleboard is recording, the event will also be recorded.

If name is null or empty, no event will be sent and an error will be printed to the driver station.

Parameters
namethe name of the event
descriptiona description of the event
importancethe importance of the event

◆ ClearRecordingFileNameFormat()

static void frc::Shuffleboard::ClearRecordingFileNameFormat ( )
static

Clears the custom name format for recording files.

New recordings will use the default format.

See also
SetRecordingFileNameFormat(std::string_view)

◆ DisableActuatorWidgets()

static void frc::Shuffleboard::DisableActuatorWidgets ( )
static

Disables user control of widgets containing actuators.

For safety reasons, actuators should only be controlled while in test mode. IterativeRobotBase and SampleRobot are both configured to call this method when exiting in test mode; most users should not need to use this method directly.

◆ EnableActuatorWidgets()

static void frc::Shuffleboard::EnableActuatorWidgets ( )
static

Enables user control of widgets containing actuators: motor controllers, relays, etc.

This should only be used when the robot is in test mode. IterativeRobotBase and SampleRobot are both configured to call this method when entering test mode; most users should not need to use this method directly.

◆ GetTab()

static ShuffleboardTab & frc::Shuffleboard::GetTab ( std::string_view  title)
static

Gets the Shuffleboard tab with the given title, creating it if it does not already exist.

Parameters
titlethe title of the tab
Returns
the tab with the given title

◆ SelectTab() [1/2]

static void frc::Shuffleboard::SelectTab ( int  index)
static

Selects the tab in the dashboard with the given index in the range [0..n-1], where n is the number of tabs in the dashboard at the time this method is called.

Parameters
indexthe index of the tab to select

◆ SelectTab() [2/2]

static void frc::Shuffleboard::SelectTab ( std::string_view  title)
static

Selects the tab in the dashboard with the given title.

Parameters
titlethe title of the tab to select

◆ SetRecordingFileNameFormat()

static void frc::Shuffleboard::SetRecordingFileNameFormat ( std::string_view  format)
static

Sets the file name format for new recording files to use.

If recording is in progress when this method is called, it will continue to use the same file. New recordings will use the format.

To avoid recording files overwriting each other, make sure to use unique recording file names. File name formats accept templates for inserting the date and time when the recording started with the ${date} and ${time} templates, respectively. For example, the default format is "recording-${time}" and recording files created with it will have names like "recording-2018.01.15.sbr". Users are strongly recommended to use the ${time} template to ensure unique file names.

Parameters
formatthe format for the

◆ StartRecording()

static void frc::Shuffleboard::StartRecording ( )
static

Starts data recording on the dashboard.

Has no effect if recording is already in progress.

◆ StopRecording()

static void frc::Shuffleboard::StopRecording ( )
static

Stops data recording on the dashboard.

Has no effect if no recording is in progress.

◆ Update()

static void frc::Shuffleboard::Update ( )
static

Updates all the values in Shuffleboard.

Iterative and timed robots are pre-configured to call this method in the main robot loop; teams using custom robot base classes, or subclass SampleRobot, should make sure to call this repeatedly to keep data on the dashboard up to date.

Member Data Documentation

◆ kBaseTableName

constexpr const char* frc::Shuffleboard::kBaseTableName = "/Shuffleboard"
staticconstexpr

The name of the base NetworkTable into which all Shuffleboard data will be added.


The documentation for this class was generated from the following file: