Package yams.core.mechanisms.velocity
package yams.core.mechanisms.velocity
Velocity-controlled mechanism implementations for the YAMS library.
This package contains concrete mechanism classes that regulate a velocity setpoint
rather than a position. All classes extend
SmartVelocityMechanism, which provides closed-loop velocity
control, feedforward integration, simulation wiring, and WPILib command/trigger support.
Available Mechanisms
FlyWheelsingle or dual-motor flywheel configured withFlyWheelConfig. Accepts bothAngularVelocity(e.g. RPM) andLinearVelocity(e.g. surface speed in m/s) setpoints when a wheel radius is provided in the config.
Running the Mechanism
run(velocity)commands the mechanism to spin at the given velocity. Accepts eitherAngularVelocityorLinearVelocityand returns aCommandthat holds the setpoint until interrupted.runTo(velocity)likerun(), but the returnedCommanddoes not finish until the mechanism is within the configured velocity tolerance of the setpoint. Useful when downstream actions must wait for the flywheel to spin up.
FlyWheelConfig config = new FlyWheelConfig(motor)
.withWheelRadius(Inches.of(2))
.withVelocityTolerance(RotationsPerSecond.of(1));
FlyWheel flyWheel = new FlyWheel(config);
// Spin at a linear surface speed and wait until up to speed before shooting
flyWheel.runTo(MetersPerSecond.of(10))
.andThen(shooter.fireCommand())
;
// Spin at an angular velocity (does not wait for spin-up)
flyWheel.run(RotationsPerSecond.of(50));
Unsupported Operations
Because velocity mechanisms do not track an absolute position, the positional limit triggers
max() and min() are not supported and will throw
UnsupportedOperationException if called. Use the velocity-based triggers
(near(), gte(), lte()) for condition-based scheduling instead.
- See Also:
-
ClassesClassDescriptionFlyWheel mechanism.Abstract intermediate base class for all closed-loop velocity mechanisms in YAMS.