Displaying data from your robot

Your robot can display data in regular operating modes like Teleop and Autonomous modes but you can also display the status and operate all the robot subsystems when the robot is switched to Test mode. By default you'll see two tabs when you start Shuffleboard, one for Teleop/Autonomous and another for Test mode. The currently selected tab is underlined as can be seen in the picture below.

Often debugging or monitoring the status of a robot envolves writing a number of values to the console and watching them stream by. With Shuffleboard you can put values to a GUI that is automatically constructed based on your program. As values are updated, the corresponding GUI element changes value - there is no need to try to catch numbers streaming by on the screen.

Displaying values in normal operating mode (autonomous or teleop)

You can write Boolean, Numeric, or String values to Shuffleboard by simply calling the correct method for the type and including the name and the value of the data, no additional code is required.

  • Numeric types such as char, int, long, float or double call SmartDashboard.putNumber("dashboard-name", value).
  • String types call SmartDashboard.putString("dashboard-name", value) and
  • Boolean types call SmartDashboard.putBoolean("dashboard-name", value)

Note: the methods are all part of the SmartDashboard class. The values will be displayed automatically in both Shuffleboard or SmartDashboard. You can even have an instance of Shuffleboard and SmartDashboard running and the values will be written to both of them.

Each time your program calls SmartDashboard.put<type>() a new value is written to that widget in the dashboard, so to keep changing values up to date, be sure to call the put<type>() function whenever the value changes. As you can imagine this is a great way of debugging and getting status of your robot as it is operating.

The SmartDashboard class is just shorthand for writing to the SmartDashboard subtable in NetworkTables.

Changing the display type of data

Depending on the data type of the values being sent to Shuffleboard you can often change the display format. In the previous example you can see that number values were displayed as either decimal numbers, a dial to better represent angles, and as a voltage view for the turret potentiometer. To set the display type right-click on the tile and select "Show as...". You can choose display types from the list in the popup menu.

Displaying data in Test mode

You may add code to your program to display values for your sensors and actuators while the robot is in Test mode. This can be selected from the Driver Station whenever the robot is not on the field. The code to display these values is automatically generated by RobotBuilder or manually added to your program and is described in the next article. Test mode is designed to verify the correct operation of the sensors and actuators on a robot. In addition it can be used for obtaining setpoints from sensors such as potentiometers and for tuning PID loops in your code.

Setting test mode

Enable Test Mode in the Driver Station by clicking on the "Test" button and setting "Enable" on the robot. When doing this,  Shuffleboard will display the status of any actuators and sensors used by your program organized by subsystem.

 

Getting data from the Sources view

Normally network table data automatically appears on one of the tabs and you just rearrange and use that data. Sometimes you might want to recover a value that was accidentally deleted from the tab or display a value that is not part of the SmartDashboard/ NetworkTable key. For these cases the values can be dragged onto a pane from NetworkTable view under Sources on the left side of the window. Choose the value that you want to display and just drag it to the pane and it will be automatically created with the default type of widget for the data type.

Note: sometimes the Sources view is not visible on the left - it is possible to drag the divider between the tabbed panes and the Sources so the sources is not visible. If this happens move the cursor over the left edge and look for a divider resizing cursor, then left click and drag out the view. In the two images below you can see where to click and drag, and when finished the divider is as shown in the second image.

0 Report Errors

Use this form to report any errors with the documentation. For help with WPILib, please use the FIRST Forums at http://forums.usfirst.org For reporting WPILib bugs, please submit an issue on GitHub at https://github.com/wpilibsuite/allwpilib/issues/new

Ignore