User Tools

Site Tools


training:software:publishing_robot_data

Publishing Robot Data

WPILib provides different ways to send out the values of data in the robot while it is operating. One of the simplest methods is to print text that can be read on a console or the driver station. We could just use the standard Java System.out.println() function to print information to the console, but there are better ways that allow us to see the information on the drive station and in data logs.

  • DriverStation.reportError() and DriverStation.reportWarning() can be used to display text and optionally a trace showing the code location.
  • DataLogManager.log() displays text that is also saved in the data log file. (See Data Logging)

For data is rapidly changing, printing text is not the best way to monitor the values. WPILib provides the NetworkTable class which allows publishing data on the network such that other software can read those values for display or storage. There are multiple ways to use the NetworkTable functionality, and some provide a simpler interface to avoid some of the details.

  • SmartDashboard - Along with the SmartDashboard tool for viewing data, the WPILib SmartDashboard class provides functions to publish data so it can be read by any of the available Dashboards.
  • Shuffleboard - The Shuffleboard tool also came with a new class for displaying data. It also publishes to the NetworkTable, but add features to control the format of the display.
  • NetworkTable - In some cases it may be necessary to work directly with the NetworkTable class to have complete control of how the data is managed.
  • Sendable - The subsystem class includes an interface to publish some data from your subsystem. This can be extended in your code to add other data you want to capture.

References:
WPILib Displaying data from Your Robot
https://docs.wpilib.org/en/stable/docs/software/dashboards/shuffleboard/getting-started/shuffleboard-displaying-data.html

WPILib NetworkTables
https://docs.wpilib.org/en/stable/docs/software/networktables/networktables-intro.html#what-is-networktables

WPILib Writing Your Own Sendable Classes
https://docs.wpilib.org/en/stable/docs/software/telemetry/writing-sendable-classes.html

Discussion

Enter your comment:
L O Y L E
 
training/software/publishing_robot_data.txt · Last modified: by Jay Tarbotton

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki