Package yams.core.mechanisms


package yams.core.mechanisms
Top-level mechanism abstractions for the YAMS (Yet Another Mechanism System) library.

This package contains SmartMechanism, the abstract base class from which every YAMS mechanism inherits. It defines the shared lifecycle, sensor handling, simulation support, and WPILib command/trigger integration that all concrete mechanism types rely on.

Mechanism Lifecycle

  1. Create a configuration object choose the appropriate config class from yams.core.mechanisms.config (e.g. ArmConfig, ElevatorConfig) and populate it via the fluent with*() API.
  2. Construct the mechanism pass the finished config to the mechanism constructor (e.g. Arm, Elevator). The constructor validates the config and initialises all internal controllers.
  3. Command the mechanism call setpoint methods such as setAngle() or setHeight(). Each method returns a WPILib Command that can be bound, composed, or scheduled directly via the command scheduler.
  4. React to conditions use trigger factory methods (near(), max(), min(), between(), lte(), gte()) to obtain Trigger objects that fire when the mechanism satisfies a particular condition, enabling condition-based command scheduling without polling in periodic().

Typical Usage

// 1. Configure
ArmConfig config = new ArmConfig(motor)
    .withGearing(100.0)
    .withSoftLimits(Rotation2d.fromDegrees(-90), Rotation2d.fromDegrees(90));

// 2. Construct
Arm arm = new Arm(config);

// 3. Schedule a setpoint command
arm.setAngle(Rotation2d.fromDegrees(45));

// 4. Bind a trigger
arm.isNear(Rotation2d.fromDegrees(45), Rotation2d.fromDegrees(2))
   .onTrue(Commands.print("Arm at target"));

Sub-packages

See Also: