Package yams.core.mechanisms.config


package yams.core.mechanisms.config
Builder-style configuration classes for every mechanism in the YAMS library.

Every YAMS mechanism requires a corresponding config object to be constructed before the mechanism itself is instantiated. Config classes follow a fluent builder pattern: each with*() setter mutates the config and returns this, allowing calls to be chained in a single expression.

Available Configuration Classes

Motor Controller Requirement

A SmartMotorController must be provided before most mechanisms can be constructed. It may be supplied either through the config constructor or via the withSmartMotorController() setter:

SmartMotorController motor = new TalonFXController(new TalonFX(1));

// Option A: pass in the constructor
ElevatorConfig config = new ElevatorConfig(motor)
    .withMaxHeight(Meters.of(1.5))
    .withGearing(9.0);

// Option B: set via fluent API
ElevatorConfig config = new ElevatorConfig()
    .withSmartMotorController(motor)
    .withMaxHeight(Meters.of(1.5))
    .withGearing(9.0);

Fluent Chaining Example

ArmConfig armConfig = new ArmConfig(motor)
    .withGearing(100.0)
    .withSoftLimits(Rotation2d.fromDegrees(-90), Rotation2d.fromDegrees(90))
    .withFeedforward(new ArmFeedforward(0.1, 0.5, 1.2))
    .withSensor(new SensorConfig(encoder).withOffset(Rotation2d.fromDegrees(15)));
See Also: