Configuration
Configuration is a value, not a sequence of setter calls. Build the object you want, apply it, and the device takes all of it or none of it.
var config = new RotemConfiguration();config.mountPose.yawDegrees = 90.0;config.features.magnetometerFusionEnabled = false;config.features.hostTimeoutSeconds = 2.0;
var status = imu.getConfigurator().apply(config);A freshly constructed RotemConfiguration is exactly the factory default, so applying an empty one
resets the device. There is no separate “factory reset” verb to remember.
Where to put it
Section titled “Where to put it”public class DrivetrainSubsystem extends SubsystemBase { private final CoreRotem imu = new CoreRotem(0, transport);
public DrivetrainSubsystem() { var config = new RotemConfiguration(); config.mountPose.yawDegrees = 90.0; imu.getConfigurator().apply(config); // constructor — once }
@Override public void periodic() { // never configure here }}Validation happens before the bus
Section titled “Validation happens before the bus”Every field is range-checked locally against the range in its javadoc. An out-of-range value costs nothing and reports precisely, instead of spending a round trip to be rejected by firmware.
config.mountPose.yawDegrees = 200.0; // permitted range is -180 to 180imu.getConfigurator().apply(config); // INVALID_PARAMETER, nothing sentCommits are atomic
Section titled “Commits are atomic”An apply stages every value, range-checks it, then commits once to wear-levelled flash with a schema version, a monotonic revision counter and a CRC. A brown-out mid-commit leaves the previous configuration intact. There is no state in which a device is half configured.