Package me.nabdev.oxconfig
Class OxConfig
java.lang.Object
me.nabdev.oxconfig.OxConfig
A flexible, dynamic json based automatic configuration system for FRC robots
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Different modes for editingstatic enum
Different modes for ensuring keysstatic enum
Different modes for logging -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic me.nabdev.oxconfig.ModeSelector
The current modeSelector, used to determine which config values to use -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Enable minification of the output json file.static void
enableProfiling
(boolean nt) Enable sending profiling values in ms to NetworkTables (OxConfig/Profiling)static void
Initializes the config system, should be called in robotInit()static void
registerClassParameter
(String key, ConfigurableClassParam<?> parameter) Not for use by the user: Sets up a configurable class param automatically configured (Automatically handled by ConfigurableClassParam)static void
registerConfigurableClass
(ConfigurableClass configurableClass) Register a class to be automatically configured (should be called in configurable class constructor).static void
registerParameter
(String key, ConfigurableParameter<?> parameter) Not for use by the user: Sets up a config value to be automatically configured (Automatically handled by ConfigurableParameter)static void
reload()
Updates all the configurable parameters/configurable classes (NOT FROM FILE, use reloadFromDisk() instead)static void
Reloads all values from the config file and updates the configurable parameters/configurable classesstatic void
setEditMode
(OxConfig.EditMode mode) Set the edit mode of OxConfigstatic void
Change the default ensure behavoir of OxConfig.static void
Set the logging mode of OxConfigstatic void
setModeList
(String... modes) Sets the list of modes that OxConfig will store values for.static void
Missing config keys will be added to the config file automatically, this function will write out those autogenerated keys to a file
-
Field Details
-
modeSelector
public static me.nabdev.oxconfig.ModeSelector modeSelectorThe current modeSelector, used to determine which config values to use
-
-
Constructor Details
-
OxConfig
public OxConfig()
-
-
Method Details
-
setEditMode
Set the edit mode of OxConfig- Parameters:
mode
- The new edit mode
-
enableProfiling
public static void enableProfiling(boolean nt) Enable sending profiling values in ms to NetworkTables (OxConfig/Profiling)- Parameters:
nt
- Whether to send profiling values to NetworkTables
-
enableMinifyJSON
public static void enableMinifyJSON()Enable minification of the output json file. This could save a little storage or bandwidth and maybe go a little faster, but probably not much. -
setEnsureMode
Change the default ensure behavoir of OxConfig. If you are running into slowdowns or constant crashes due to missing keys, it may be worth trying this.- Parameters:
mode
- The new ensure mode
-
setLoggingMode
Set the logging mode of OxConfig- Parameters:
mode
- The new logging mode
-
initialize
public static void initialize()Initializes the config system, should be called in robotInit() -
setModeList
Sets the list of modes that OxConfig will store values for. If not called, defaults to Presentation, Competition, and Simulation. Simulation will be automatically added to the list of modes if not present. Call before OxConfig.initialize().- Parameters:
modes
- the new list of modes
-
reload
public static void reload()Updates all the configurable parameters/configurable classes (NOT FROM FILE, use reloadFromDisk() instead) -
reloadFromDisk
public static void reloadFromDisk()Reloads all values from the config file and updates the configurable parameters/configurable classes -
writeFiles
public static void writeFiles()Missing config keys will be added to the config file automatically, this function will write out those autogenerated keys to a file -
registerConfigurableClass
Register a class to be automatically configured (should be called in configurable class constructor). This is automatically handled in ConfigurablePIDController and ConfigurableSparkPIDController.- Parameters:
configurableClass
- the class to register
-
registerParameter
Not for use by the user: Sets up a config value to be automatically configured (Automatically handled by ConfigurableParameter)- Parameters:
key
- the json key the value will be found under in config.json (in deploy folder)parameter
- the parameter to update
-
registerClassParameter
Not for use by the user: Sets up a configurable class param automatically configured (Automatically handled by ConfigurableClassParam)- Parameters:
key
- the json key the value will be found under in config.json (in deploy folder)parameter
- the parameter to update
-