浏览Shuffleboard

Shuffleboard is a dashboard for FRC® based on newer technologies such as JavaFX that are available to Java programs. It is designed to be used for creating dashboards for C++, Java, and Python programs. If you’ve used SmartDashboard in the past then you are already familiar with many of the features of Shuffleboard since they fundamentally work the same way. But Shuffleboard has many features that aren’t in SmartDashboard. Here are some of the highlights:

  • 图形基于Java图形标准** JavaFX **。每个组件都有一个关联的样式表,因此有可能为Shuffleboard使用不同的“皮肤”或“主题”。我们提供默认的浅色和深色主题。

  • Shuffleboard支持**多页显示数据**。实际上,您可以创建一个新工作表(在Shuffleboard窗口中显示为选项卡),并指示是否以及应该在哪些上自动填充哪些数据。默认情况下,有一个“测试”选项卡和一个“智能仪表板”选项卡,它们会在数据到达时自动填充。其他选项卡可能用于机器人调试与驾驶。

  • 图形化的 display elements (widgets) are laid out on a grid,以保持界面清洁并易于阅读。 您可以更改网格大小以在布局中获得或多或少的分辨率,并且提供了视觉提示来帮助您使用拖放来更改布局。 或者,即使保留了网格布局,也可以选择关闭网格线。

  • 当您再次运行 shuffleboard 时,默认情况下会保存布局并实例化先前的布局。

  • 有一项 record and playback 功能,可让您在机器人程序完成后查看其发送的数据。 这样,如果出现问题,您可以仔细检查机器人的动作。

  • Graph widgets are available for numeric data,您可以将数据拖动到图形上,以同时查看相同大小的多个点。

  • You can extend Shuffleboard by writing your own widgets that are specific to your team’s requirements. Documentation on extending it can be found in Custom Widgets.

  1. **Sources area:**这是数据源,您可以从NetworkTables或其他源中选择值,方法是将值拖到选项卡之一中以显示

  2. Tab panes:.这是您从机器人或其他来源显示数据的地方。 在本示例中,此处显示在LiveWindow选项卡中的是测试模式子系统。 该区域可以显示任意数量的选项卡式窗口,并且每个窗口都有其自己的属性集,例如网格大小和自动填充。

  3. **Record/playback controls:**一组类似媒体的控件,您可以在其中播放当前会话以查看历史数据

启动沙狐球

您可以通过以下四种方式之一启动Shuffleboard:

  1. 您可以通过在设置标签中将”Dashboard Type”设置为Shuffleboard来在Driver Station启动时自动启动它,如上图所示。

  2. You can run it by double-clicking the Shuffleboard icon in the YEAR WPILib tools folder on the Windows Desktop.

  3. You can start from with Visual Studio Code by pressing Ctrl+Shift+P and type “WPILib” or click the WPILib logo in the top right to launch the WPILib Command Palette. Select Start Tool, then select Shuffleboard.

  4. 您可以通过双击〜/ WPILib / YYYY / tools /中的shuffleboard.XXX文件(Windows上的XXX是.vbs,Linux或macOS上的.py)来运行它。 `(其中YYYY是年份,在Windows上〜是``C:Users Public’’)。 这对于未安装Driver Station的开发系统例如macOS或Linux系统很有用。

  5. You can start it from the command line by typing the command: shuffleboard on Windows or python shuffleboard.py on macOS or Linux from ~/WPILib/YYYY/tools directory (where YYYY is the year and ~ is C:\Users\Public on Windows). This is often easiest on a development system that doesn’t have the Driver Station installed.

备注

.vbs(Windows)和.py(macOS / Linux)脚本有助于使用正确的JDK启动工具。

将机器人数据放到仪表板上

The easiest way to get data displayed on the dashboard is simply to use methods in the SmartDashboard class. For example to write a number to Shuffleboard write:

SmartDashboard.putNumber("Joystick X value", joystick1.getX());
frc::SmartDashboard::PutNumber("Joystick X value", joystick1.getX());
from wpilib import SmartDashboard

SmartDashboard.putNumber("Joystick X value", joystick1.getX())

看到带有标签“操纵杆X值”和操纵杆X值的显示的字段。每次执行此行代码时,都会将一个新的操纵杆值发送到Shuffleboard。请记住:每当要查看更新的值时,都必须写入操纵杆值。在程序开始时执行该行一次将仅在执行代码行时显示一次该值。