Skip to content

Configuration

nab138 edited this page Jan 25, 2024 · 2 revisions

Configuration

To use any of these, call the corresponding method before OxConfig.initialize() in your robot init method. Example:

OxConfig.setLoggingMode(LoggingMode.Info);
OxConfig.setEditMode(EditMode.Locked);
OxConfig.setEnsureMode(EnsureMode.Safe);
OxConfig.setModeList("Mode 1", "Mode 2", "Mode 3" /* ... */);
OxConfig.initialize();

EditMode

Unrestricted

(Default) Allows editng via the NT interface and using reloadFromDisk().

OxConfig.setEditMode(EditMode.Unrestricted);

FileOnly

If you do not plan to use Advantagescope-3044, this will disable the NT interface entirely.

OxConfig.setEditMode(EditMode.FileOnly);

Locked

Intended for use during competition. Disables the NT interface and blocks all calls to reloadFromDisk().

OxConfig.setEditMode(EditMode.Locked);

EnsureMode

Ensure mode changes the behavior of ensuring keys. Depending on your configuration, it can make OxConfig more resistent to damages in the file, but slower.

Startup

(Default) While considered generally safe, it is not recommended if you plan to edit the file directly. Skips ensure checks at runtime, but not startup.

OxConfig.setEnsureMode(EnsureMode.Startup); // Not required since Startup is default

Always

Always ensures keys exist, making it resistent to damages in the file at the cost of speed.

OxConfig.setFastMode(EnsureMode.Always);

Never

(NOT RECOMMENDED) Skips all ensure checks entirely, including at startup. If you add a new parameter/class while this mode is enabled, it will not be added to the config file properly and issues will occur.

OxConfig.setEnsureMode(EnsureMode.Never);

Modes

OxConfig.setModeList(modes...)

Supply a list of modes you want to use with OxConfig. Simulation will automatically be appended if not in the list already, and all modes will be converted to lowercase if not already.

LoggingMode

None

(Not recommended) OxConfig will be silent (even for errors).

OxConfig.setLoggingMode(LoggingMode.None);

Errors

Only log errors.

OxConfig.setLoggingMode(LoggingMode.Errors);

Warnings

(Default) Log errors and warnings.

OxConfig.setLoggingMode(LoggingMode.Warnings);

Info

Log everything from OxConfig. Primarily used for debugging.

OxConfig.setLoggingMode(LoggingMode.Info);

Minfication

Minify the json files so there is no unneccesary indentation

OxConfig.enableMinifyJSON();

Profiling

Enable profiling (timing certain actions, in miliseconds.)

Use NT

Sends Profiling data to /OxConfig/Profiling

OxConfig.enableProfiling(true)

Use Console

Displays profiling via System.out.println()

OxConfig.enableProfiling(false)