Skip to content

Preferences

James Hagborg edited this page Dec 17, 2018 · 1 revision

Preferences are a feature of WPILib. They are key-value pairs which are stored in a file on the RoboRIO, which can be modified via the Dashboard or via code. They are typically used to store constants, but unlike constants they can be changed without having to compile and deploy code, speeding up the development process.

HYPERLib provides a PreferencesSet object which groups together related preferences, such as those all related to a particular subsystem. This automatically creates the preference with a default value if it doesn't exist yet, and provides a callback to run any time the value of a preference changes. (TODO: Example)

There are two particular use cases that are so common they are built into HYPERLib: PID parameters and OpenCV Scalars. (TODO: Example)

It is also common to have several preferences define a path in an autonomous routine. HYPERLib provides a specific way to handle these which integrates nicely with the AutoViewer plugin for Shuffleboard. See the Autonomous section.

Clone this wiki locally