Shared Config
Shared Configuration
Handles loading, deserializing, and live-tuning of subsystem configuration from JSON deploy files. Every subsystem's config class extends one of the abstract bases in this package, inheriting the tunable-value system and the enabled flag.
How configuration loading works
ConfigurationLoader.load(filename, class)reads a JSON file fromsrc/main/deploy/using Jackson and returns a deserialized config object.- After deserialization, the loader records a read-only snapshot of every field
to AdvantageKit under
Config/<className>/...for replay debugging. - Tunable values (numbers, booleans, strings) are managed separately by
AbstractConfig. Each getter (e.g.,getkP()) reads the live value from an AdvantageKit-backedLoggedNetworkNumberon SmartDashboard so operators can tweak gains on-robot without redeploying. - When FMS is attached, tunable values are not created to reduce NetworkTables noise.
Config hierarchy
AbstractConfig
├── AbstractMotorConfig
├── AbstractMotorSubsystemConfig
│ ├── AbstractSetAndSeekSubsystemConfig
│ └── AbstractVelocitySubsystemConfig
├── FieldLayoutConfig
└── (concrete subsystem configs)
Key classes
| File | Role |
|---|---|
AbstractConfig.java |
Base config with enabled, verbose, and tunable helpers |
AbstractMotorConfig.java |
Motor CAN ID, gearing, current limits, and soft limits |
AbstractMotorSubsystemConfig.java |
PID and feedforward gains shared by motor subsystems |
AbstractSetAndSeekSubsystemConfig.java |
Trapezoidal profile constraints, setpoint limits, tolerances |
AbstractVelocitySubsystemConfig.java |
Max RPM, acceleration, idle RPM, and velocity tolerance |
ConfigurationLoader.java |
Loads JSON configs from deploy and records to AdvantageKit |
FieldLayoutConfig.java |
Selects the AprilTag field layout (welded, AndyMark, shop) |
Pose2dDeserializer.java |
Jackson deserializer for Pose2d (x, y meters; rotation degrees) |
RobotEnvironment.java |
Cached per-cycle DriverStation state (alliance, mode, FMS) |
SubsystemsConfig.java |
Root config bundle with one field per subsystem config |
Adding a new config
- Create a config class extending the appropriate abstract base (e.g.,
AbstractSetAndSeekSubsystemConfigfor a profiled mechanism). - Add public fields for mechanism-specific values with human-friendly default values.
- Expose tunable getters using
readTunableNumber,readTunableDegrees, etc. - Add the config as a public field in
SubsystemsConfig. - Add a matching JSON block in
subsystems.json,subsystems-sim.json, andsubsystems-test.json.