FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

NT Persistence and Begin.vi

Our team started testing some auton routines, and noticed that the auton selector was not adding the new auton variations that we added to the 'Auto List' NT array. When we looked directly at the variables table on the dashboard we noticed that there was a 'log' icon next to it and it was also being saved into the 'persistence.ini' file.

 

Looking a little closer it looks like anything set before the persistence is loaded by the NT server (i.e. Begin.vi) is overwritten, including calls to 'update persistence'. So once our persistence is set we can no longer add auton routines. 

 

So we tried disabling the code that loads the persistence file in the NT Server.vi, but the values were still overwritten. We tried to disable the persistence by deleting the persistence.ini file or by removing entries. None of this worked, in fact the only way we were able to actually update our auto list NT variable was by writing to it again in Disabled.vi.

 

My question is how can we properly disable or completely prevent the persistence from being set on the auto list, and is it possible to disable the feature entirely?

0 Kudos
Message 1 of 5
(3,312 Views)

You'll likely enjoy one of the other threads near this one: https://forums.ni.com/t5/FIRST-Robotics-Competition/Using-Network-Tables-for-Configuration-Parameter...

 

In that, Greg shared the following:

Double clicking a variable sets the persistence flag. Shift double-clicking clears the flag.

 

Persistent variables are saved to an ini file on the robot about once a second. I think the file is located in /home/lvuser/LabVIEW\ Data/persistent.ini But I don't have a controller with me, so the file could be saved somewhere else. When the robot code starts its NT server, it loads the values from the ini file to create and initialize the variables.

Note that any client and the robot can still write to a variable or even change the persistence. Persistence is primarily for initialization.

 

I'd go with the shift double-click option for what you're doing.  I wouldn't attempt to disable the entire persistence feature as that would eliminate ALL of your persistent values and not just the one you're trying to write once and having issues with writing it too quickly.

0 Kudos
Message 2 of 5
(3,276 Views)

Hi BoKnows,

 

Thanks for the info, the Shift-Click should resolve this, I knew there was some shortcut but I wasn't sure what that was.

 

I do still think that the variables being overwritten from after Begin.vi is still a concerning issue. It means that accidentally double click something on the variables tab could have adverse effects on your code.

 

I also am not sure why persistence remained after I completely deleted the persistence.ini file (/home/lvuser/LabVIEW Data/persistence.ini)

 

We also have no use for the persistence feature so that is why we would be happy to disable it entirely.

 

-Will

0 Kudos
Message 3 of 5
(3,274 Views)

I'd have to dig through the code.  But, I suspect it'll create the file if one doesn't already exist and fill it based on the values that are set to persist.

0 Kudos
Message 4 of 5
(3,270 Views)

Here's a simple test:

 

1) Create an empty project and run it with the simulator as-is

2) Load the dashboard and 'accidentally' double click the Auto List variable on the variables tab

3) Press 'Finish' on the Robot Main.vi

4) Add an additional auton to the Auto List in Begin.vi

5) Run again and try any method you can to get that variable to show up (Including shift double click to remove the logging between tries)

0 Kudos
Message 5 of 5
(3,268 Views)