I’m trying to get a bit of a start on updating our code base to WPILib 2018, and I’m trying to replace SmartDashboard with Shuffleboard, but I don’t see example code or a how-to guide here, on the github repo, or from googling. Could someone point me in the right direction or share their code that uses Shuffleboard? I’m looking for Java specifically but I can probably figure it out from seeing the API in other non-LabView languages.
I’m not sure there is any specific docs for shuffleboard, but since shuffleboard relies on NetworkTables, it’s the same code you’d use for publishing data to NetworkTables. In its simplest form, it looks something like this:
(C++)
auto table = nt::NetworkTableInstance::GetDefault().GetTable("myTable");
table->GetEntry("myValue").SetDouble(6.28);
(Java)
NetworkTable table = NetworkTableInstance.getDefault().getTable("myTable");
table.getEntry("myEntry").setDouble(6.28);
Shuffleboard supports SmartDashboard and LiveWindow functionality out of the box. Old user programs are (mostly*) still compatible.
The old WPILib APIs still apply and have not changed. This will still display a command in the SmartDashboard tab:
SmartDashboard.putData("Drive Forward", new DriveForwardCommand());
WPILib’s IterativeRobot base class has also been changed this year to automatically log almost everything to LiveWindow while your robot program is running so you can always see real data coming from the robot.
Documentation will be available on ScreenSteps at kickoff.
- I say “mostly” because changes have been made to WPILib for 2018 to how components report their types and metadata
If you’re asking about how to use the shuffleboard API for plugin or widget development, there are pages on the wiki that cover that.