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
- Create a configuration object choose the appropriate config class from
yams.core.mechanisms.config(e.g.ArmConfig,ElevatorConfig) and populate it via the fluentwith*()API. - 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. - Command the mechanism call setpoint methods such as
setAngle()orsetHeight(). Each method returns a WPILibCommandthat can be bound, composed, or scheduled directly via the command scheduler. - React to conditions use trigger factory methods (
near(),max(),min(),between(),lte(),gte()) to obtainTriggerobjects that fire when the mechanism satisfies a particular condition, enabling condition-based command scheduling without polling inperiodic().
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
yams.core.mechanisms.positionalposition-controlled mechanisms (Arm, Elevator, Pivot, DifferentialMechanism, DoubleJointedArm)yams.core.mechanisms.velocityvelocity-controlled mechanisms (FlyWheel)yams.core.mechanisms.swerveswerve-drive mechanism and module implementationsyams.core.mechanisms.configbuilder-style configuration classes for all mechanisms
- See Also:
-
Classes