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
Armsingle-jointed arm rotating about a fixed pivot, configured withArmConfig-
Elevatorlinear-travel elevator stage, configured withElevatorConfig -
Pivotgeneric pivot that may rotate continuously or within bounded limits, configured withPivotConfig -
DifferentialMechanismmechanism driven by two motors in a differential arrangement (e.g. differential wrist), configured withDifferentialMechanismConfig DoubleJointedArmtwo-segment arm whose second joint is kinematically dependent on the first, using two underlyingArminstances
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 withintoleranceofsetpointmax()fires while the mechanism is at or beyond its configured maximum limitmin()fires while the mechanism is at or below its configured minimum limitbetween(lower, upper)fires while the mechanism position is within the specified rangelte(position)fires while the mechanism position is less than or equal topositiongte(position)fires while the mechanism position is greater than or equal toposition
// 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:
-
ClassesClassDescriptionArm mechanism.A differential mechanism for FRC robots driven by two coordinated motors whose combined motion produces two distinct and independent outputs.A two-segment arm where each joint has its own independent motor controller.Elevator mechanism.Pivot mechanism.Abstract intermediate base class for all closed-loop positional mechanisms in YAMS.