WPI Preferences PSA

Just a quick PSA on using Preferences…

We make extensive use of the WPI Preferences. We use them to tune control loops, autonomous parameters, and store robot specific things (practice vs. comp). We’ve found them to be super useful.

However, we hit a snag at our last competition. The preferences file was either missing or corrupt, so all the preferences rolled back to the defaults. This effectively eliminated us from the match/competition.

We’ve posted this issue to the WPI github, but there doesn’t appear to be an effective workaround or fix. The only real possibility I’ve found is saving the file to your driver’s station every time a change is made and reloading that file prior to every match. That’s only as good as the people remembering to do those things, and you’ll need to make sure all your reads from the file come after the code has booted (not robot init).

We’ll be moving to hard coded parameters now that most things are tuned and finding a different solution for the robot-specific values.

I hope other teams can find workable solutions.

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