Dashboard Saving Values

Does anyone have an example of how to save custom dashboard values

If you mean tuning values, you may want to turn on persistence for some of the variables. You do this on a DB that is connected to the robot by double clicking to make the variable persist on the roboRIO. Shift double clicking will clear it.

Anyway, the values will be saved to the roboRIO in an ini file. with name and value pairs.

Greg McKaskle

i gave this a try but i think i am doing something wrong. How do i turn on persistence

Our solution was to set the values we wanted as default values. Here is how:

  • Enter the value you want into the control
  • Right click on the control
  • Select “Data Operations” or something similar
  • Choose “set current value as default value”

This will allow the control to remember the value you have set for it. Every time you open the dashboard after that, you will automatically have your set value.

with this method though you will need to re-build the file every time you change the value. Did you ever figure are way around this

There is a Preferences class. It stores persistent values in the RoboRio. You can load the default values for SmartDashboard variables from Preferences at startup. Then have a button on the SmartDashboard to save values. Have this update the Perferences from the SmartDashboard and save them. This will persist across different driver stations.

nevermind. didn’t even notice you are asking in a labview forum.

Does this work in Labview or is this for Java?

Also your guys robot is looking really good this year. I really like the tank swerve

Sorry, that would have worked for c++ or java. We haven’t used labview in a few years. My bad.

Looking forward to seeing your bot at CIR.

after some trial and error i did figure this out. I also found the file on the RoboRio where it is save /home/lvuser/natinst/LabVIEW Data/persistent.ini

Is there any way i can read this file using the dashboard?

We read and write our values to a text file on the driver station computer. I’ll have to look into that persistence idea.

Is there a reason you don’t want to store the files locally on the same file system as the dashboard itself?

Once i get it all figured out i will do a write up on it. It is very easy and fast. The only problem i am having with it is being able to read what is on the roborio

The way persistence works is that the value of the variable is updated to the robot file about once a second ( if changed ) so that the robot retains the last value across a reboot. Robot values show up on the DB, so this means that one way to view the persisted values is by looking at the DB – either displays or the Variable tab.

Once the robot restores and shares variables, any client can then change the value. This means that if the DB changes a variable to modify a set point, it is propagated to the robot and all other clients. And if it is persisted, it will be used on the next reboot. Extending this idea, if you have a whole recipe file full of set points, and your DB loads those and calls NT Write for each of them, they will all propagate and be setup to be used for the next run.

So the persistence feature means that you may be able to avoid a big DB feature to load from a file. You simply use the DB to tune or update, and it automatically becomes part of the startup values on the robot. But if you wish to use a DB persistence mechanism, it automatically makes it to the robot and can be used with persisted variables to lessen the need to reload the DB each time.

It may be useful to periodically pull the .ini file from the robot and put it into SCC along with code, otherwise a roboRIO replacement will not have the values to restore with. If you have a DB file, that can obviously be used instead.

Greg McKaskle