Utilizing the Smart Dashboard

  1. How to put a button on the dash? (like putting up a command puts the button to run the command)

  2. It seems as though the “Save” function only saves the layout of the values and not their value. When you load the robot, SmartDashboard.getNumber() throws a TableNoKeyAtIndex error (meaning that it has no data). Is it possible to make a setup where you open an xml setup and it will automatically send all of the values to the cRIO?

  3. What exactly does the “Robot Preferences” widget do? I thought it could be used for #2 but it seems their keys cannot contain strings spaces //E: the [s] BBCode isnt in this vBulletin?

  4. How would i convert a BinaryImage to a Sendable so I can show the BinaryImage on the dash?

  5. So… on the dashboard… I can convert an integer into a progress bar. Is there a way to make it a slider bar so i can input data without converting to plain text?

Check out the doc named “Testing Commands” from here:
and also here:

  1. What exactly does the “Robot Preferences” widget do? I thought it could be used for #2 but it seems their keys cannot contain strings spaces //E: the [s] BBCode isnt in this vBulletin?

It’s a way of sending persistent values to the robot, as you were talking about in #2. The values are saved to the cRIO’s flash memory and should remain there across reboots. I’ve never used it, so I don’t know about the string limitation.

  1. So… on the dashboard… I can convert an integer into a progress bar. Is there a way to make it a slider bar so i can input data without converting to plain text?

Yes, I believe you can do that using live window mode, or else you can create a new extension to do so (possibly using some source code from live window).

Not hooked up to a bot ATM, so cant test #2-3. Any documentation on #5 would be good… cant find anything good in live window mode. For #1, so is there no way to do it without Commands? I do not like the Command-based robot system

I haven’t tried it, but it looks like NetworkButton will do what you want.

Sure, but you’d have to emulate commands some how, so you’d end up using a similar structure anyway. It would take a whole lot more effort than it’s worth when the ability is already built in.

Just out of curiosity, why don’t you like Command-Based?

A command button only works with commands. You would have to modify the SmartDashboard to be able to do what it seems like you want.

If you don’t like command-based programming, I highly recommend that you use RobotBuilder to take care of the code’s structure. It will be much simpler to use and understand.

Mainly just because i’m more familiar with the iterative format than the event-driven format and my mentors are much more familar with iterative so they know about as much as i do.

why? RobotBuilder seems like all you do is just input a few values to move jags and it builds the code for you, which is not my style of coding… ive been coding for three years im familiar with the layout but its just that Smartdashboard is restrictive with its methods

Update: I don’t understand this!! Robot preferences does not save. At all. Hitting the save button does nothing!

none answered. shameless bump

Anything extending WPILib’s Trigger class will show up on the dashboard as a button – including all of WPILib’s Button types.

SmartDashboard’s “save” stores what widgets are loaded and their properties (size, color, etc.). SmartDashboard widgets aren’t supposed to provide values to the robot; they’re supposed to display them and allow them to be tweaked at runtime. If you want a value to stick around, change the value you give to put() on the robot or use Preferences.

The Robot Preferences widget puts a bunch of values into a network table so that the robot can read them. When you hit save, it sends another network table value telling the robot to save. The robot then saves the preference values (assuming you have a Preferences object on the robot) to the file wpilib-preferences.ini on the cRio, to be loaded again at a later time.

I don’t even know if this is possible, but I know it would be a really bad idea. While binary images are much smaller than full-color ones, this will still result in a lot of network traffic. You’d have at least two video streams across the network – one to the cRio from the camera, one to the laptop from the cRio. If you also have a feed to your dashboard, you now have three streams, two of which are full-color, and this becomes quite a load, possibly running over the network traffic limitations. If you want to be able to display different steps of the process live, I recommend doing your image processing on the laptop through a SmartDashboard widget – for inspiration, you might want to look at Miss Daisy’s vision system available here.

I believe you would have to make a custom widget using swing’s NumberSlider object. That’s what the LiveWindow speed controller widget does.

You are probably saving the SmartDashboard preferences. Add the RobotPreferences widget to SmartDashboard (Edit>Add>RobotPreferences) and click the save button there.

  1. extending Trigger? Seems legit… ill look into it

  2. see 3

  3. I actually found documentation for the Preferences widget in the cookbook and it tells me to use the object Preferences. I got it kinda working (except for some stuff i gotta flush out) except when i try to load all of my stored preferences on robotInit, it will load (kinda) than give me an Out of Memory error (Not exception) than the dashboard will tell me No Robot Code and i have to re-deploy and get the same error

  4. True… ill look into it

  5. I dont really follow you on this one…

joelg) read #3 on the Preferences object

What… i posted and it said a moderator has to approve the thread and its still not there…

anyway, if it finally does show up, heres the exact error whenever i try to use the Preferences class

[cRIO] Done Reading
[cRIO] task 0x111b458 (FRC_cameraTask) deleted: errno=0 (0) status=0 (0U)
[cRIO] ncaught out of memory error on thread  - aborting isolate Server Connection Reader Thread
[cRIO] Tried to execute callbacks in the context of an isolate that is no longer alive: isolate 1 "edu.wpi.first.wpilibj.templates.RobotTemplate" (EXITED)
[cRIO] Skipping that set of callbacks
[cRIO] task 0x1126ed8 (cached TaskExecutor 1) deleted: errno=0 (0) status=0 (0)
[cRIO] --------------------------------------------------------------------
[cRIO] GCs: 1 full, 4 partial
[cRIO] ** VM stopped: exit code = 999 ** 
[cRIO] task 0xd1f738 (SquawkRobotTask) deleted: errno=0 (0) status=999 (0x3e7)
BUILD STOPPED (total time: 59 seconds)

e/ i guess santas not coming.

I get the above error when trying to use the Prefrences class… other stuff was just blabble

 * To change this template, choose Tools | Templates
 * and open the template in the editor.
package edu.wpi.first.wpilibj.templates.buttons;
import edu.wpi.first.wpilibj.buttons.Trigger;
import edu.wpi.first.wpilibj.command.Command;

 * @author Arhowk
public class t1684_SD_TakeImage extends Trigger{
    public boolean get(){return true;}
    public void whenActive(Command command){
    public void whileActive(Command command){
    public void whenInactive(Command command){

this displays the button on the dash but wont do anything when clicked…

still getting above error

My team’s idea for #4 was to save the processed image to the computer and have the smart dashboard read that file, but I don’t know how to get the SmartDashboard to read an image.

i dont know how to get an image D:

btw i fixed the preferences issue… it turned out that i had 10 preferences windows stacked ontop of eachother -_-

That’s not how you use it.

Trigger doThingyTrigger;
doThingyTrigger.whenActive(new DoThingy()); // DoThingy is some class extending Command
SmartDashboard.putData("Do Thingy",trigger);

I’d put this in robotInit, but it can be almost anywhere.

Just found the error that you are showing here. It is a bug in the Preferences class in WPILib. There is a fixed version of it in Stable (not Release) release of WPILibJ. Can you try updating your plugins to the Stable version by editing the plugin location and changing “Release” to “Stable” in the URL? Let me know if it work for you.

Also, there is an example of using the Preferences class here: