Using tabs on Shuffleboard, writing values to a specific tab

This ought to be easy, I think, but students tried for a long time, and then three of us stood around programming one night trying every variation we could think of, and they all failed.

We want to create a SmartDashboard entry on a tab. We’re using shuffleboard.

Starting on this page, Creating and manipulating tabs — FIRST Robotics Competition documentation (wpilib.org)

“Any values that are written using the SmartDashboard class that specifies a sub-key of Shooter will automatically appear on that tab.”

So…how do I specify a subkey of Shooter. (or whatever else)?

I thought the following would work.

  1. Go to shuffleboard. Create a tab. Using preferences, set autopopulate to true, and prefix to “debug”.

  2. Now, use SmartDashboard class to write a value
    SmartDashboard.putNumber(“debug/Encoder value”, myEncoder.getPosition());

What we expected is that it would autopopulate a new widget called “Encoder Value” on the debug tab, and display the encoder position.

Instead, it autopopulated a new widget on the SmartDashboard tab called “debug/Encoder Value”, and it didn’t create anything on the debug tab. (I thought that one possibility was that it would create widgets in both places. That would have been acceptable, even if not ideal.)

We tried a lot of variations on this, including adding the item using the getTab and add functions, but two hours later, we still didn’t have an updating widget on the debug tab.

Can you use SmartDashboard,putNumber to write to a subkey (and hence, to a specified tab)? If so, what’s the syntax for doing so?

Since you’re using SmartDashboard to set the values, the prefix needs to be “SmartDashboard/debug”.

1 Like

Ahhh…many thanks.

(I haven’t tested it yet, but it’s a variation that I haven’t tried, and it makes sense.)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.