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.
Go to shuffleboard. Create a tab. Using preferences, set autopopulate to true, and prefix to “debug”.
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?