Package yams.core.mechanisms.positional


package yams.core.mechanisms.positional
Position-controlled mechanism implementations for the YAMS library.

This package contains concrete mechanism classes that track and control a position setpoint (angle, height, or displacement) using closed-loop feedback. All classes extend SmartPositionalMechanism, which provides the shared closed-loop position logic, soft-limit enforcement, simulation wiring, and WPILib command/trigger integration.

Available Mechanisms

Setpoint Commands

Setpoint methods return WPILib Command objects rather than setting the target synchronously. This means they compose naturally with other commands and can be cancelled, interrupted, or sequenced using the standard WPILib command scheduler:

// Move the arm to 45 degrees and then print a message
arm.setAngle(Rotation2d.fromDegrees(45))
   .andThen(Commands.print("Arm at target"));

// Move the elevator to 0.8 m, waiting until it arrives
elevator.setHeight(Meters.of(0.8));

Trigger Factory Methods

Each positional mechanism exposes factory methods that return Trigger objects. These allow condition-based command scheduling without manual polling in periodic():

  • isNear(setpoint, tolerance) fires while the mechanism is within tolerance of setpoint
  • max() fires while the mechanism is at or beyond its configured maximum limit
  • min() fires while the mechanism is at or below its configured minimum limit
  • between(lower, upper) fires while the mechanism position is within the specified range
  • lte(position) fires while the mechanism position is less than or equal to position
  • gte(position) fires while the mechanism position is greater than or equal to position
// Extend intake when arm clears 30 degrees
arm.gte(Rotation2d.fromDegrees(30))
   .onTrue(intakeSubsystem.extend());

// Retract intake if arm drops below 30 degrees
arm.lte(Rotation2d.fromDegrees(30))
   .onTrue(intakeSubsystem.retract());
See Also: