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 enumDifferent modes for editingstatic enumDifferent modes for ensuring keysstatic enumDifferent modes for logging -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic me.nabdev.oxconfig.ModeSelectorThe current modeSelector, used to determine which config values to use -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidEnable minification of the output json file.static voidenableProfiling(boolean nt) Enable sending profiling values in ms to NetworkTables (OxConfig/Profiling)static voidInitializes the config system, should be called in robotInit()static voidregisterClassParameter(String key, ConfigurableClassParam<?> parameter) Not for use by the user: Sets up a configurable class param automatically configured (Automatically handled by ConfigurableClassParam)static voidregisterConfigurableClass(ConfigurableClass configurableClass) Register a class to be automatically configured (should be called in configurable class constructor).static voidregisterParameter(String key, ConfigurableParameter<?> parameter) Not for use by the user: Sets up a config value to be automatically configured (Automatically handled by ConfigurableParameter)static voidreload()Updates all the configurable parameters/configurable classes (NOT FROM FILE, use reloadFromDisk() instead)static voidReloads all values from the config file and updates the configurable parameters/configurable classesstatic voidsetEditMode(OxConfig.EditMode mode) Set the edit mode of OxConfigstatic voidChange the default ensure behavoir of OxConfig.static voidSet the logging mode of OxConfigstatic voidsetModeList(String... modes) Sets the list of modes that OxConfig will store values for.static voidMissing 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
-