githubEdit

Settings

package com.skeletonarmy.marrow.settings

Overview

Settings provide a simple way to store, change, and persist configuration values on the robot - even after the robot gets restarted. This is useful for things like enabling a debug mode, adjusting teleop or autonomous behavior, or saving preferences across sessions.

You can configure these options inside a SettingsOpMode, which lets you edit values directly from the Driver Hub - no code changes or redeploys required.

A GIF showing Settings in action
circle-exclamation

Usage

Defining Settings

To define settings, extend SettingsOpMode and implement defineSettings():

Each setting requires:

  1. Key - a unique, case-insensitive identifier.

  2. Display Name - shown in the menu on the driver station.

  3. Prompt - an instance of a Prompt<T> which determines how the value is entered.

Interacting With Settings

When the OpMode runs:

  • Navigate options using the D-PAD.

  • Press A to modify a setting.

  • Press B to exit a prompt without saving changes.

Settings are automatically saved to a JSON file on the Control Hub (FIRST/marrow/settings.json).

Accessing Settings in Code

Use the Settings API to read or write settings programmatically:

  • get(key, defaultValue) retrieves a value, returning the default if missing.

  • set(key, value, (optional) save) - Stores a value under the given key. If save is true (default), the settings are immediately written to file.

circle-info

You can use Settings even without any SettingsOpMode. It can serve simply as a central hub for saving variables between OpModes and restarts.

Last updated