Class OxConfig

java.lang.Object
me.nabdev.oxconfig.OxConfig

public class OxConfig extends Object
A flexible, dynamic json based automatic configuration system for FRC robots
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Different modes for editing
    static enum 
    Different modes for ensuring keys
    static enum 
    Different modes for logging
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static me.nabdev.oxconfig.ModeSelector
    The current modeSelector, used to determine which config values to use
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static 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
    Not for use by the user: Sets up a configurable class param automatically configured (Automatically handled by ConfigurableClassParam)
    static void
    Register a class to be automatically configured (should be called in configurable class constructor).
    static void
    Not for use by the user: Sets up a config value to be automatically configured (Automatically handled by ConfigurableParameter)
    static void
    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 classes
    static void
    Set the edit mode of OxConfig
    static void
    Change the default ensure behavoir of OxConfig.
    static void
    Set the logging mode of OxConfig
    static 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • modeSelector

      public static me.nabdev.oxconfig.ModeSelector modeSelector
      The current modeSelector, used to determine which config values to use
  • Constructor Details

    • OxConfig

      public OxConfig()
  • Method Details

    • setEditMode

      public static void setEditMode(OxConfig.EditMode mode)
      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

      public static void setEnsureMode(OxConfig.EnsureMode mode)
      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

      public static void setLoggingMode(OxConfig.LoggingMode mode)
      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

      public static void setModeList(String... modes)
      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

      public static void registerConfigurableClass(ConfigurableClass configurableClass)
      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

      public 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)
      Parameters:
      key - the json key the value will be found under in config.json (in deploy folder)
      parameter - the parameter to update
    • registerClassParameter

      public 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)
      Parameters:
      key - the json key the value will be found under in config.json (in deploy folder)
      parameter - the parameter to update