Package yams.core.gearing
package yams.core.gearing
Yet Another Mechanism System gearing classes for easier calculations.
This package provides gear-ratio math helpers that let teams express mechanism gearing in terms of physical hardware (tooth counts, sprocket sizes, output dimensions) instead of manually computing reduction fractions. All classes are immutable value types designed to be constructed once at robot initialization and reused throughout the match.
Core Classes
GearBoxchains one or more gear stages together and computes the overall reduction ratio. Each stage is expressed as a pair of tooth counts (driver : driven). Multiple stages are multiplied automatically.Sprocketmodels a chain or belt drive between two sprockets, computing the linear or rotational ratio from sprocket tooth counts and, for linear drives, the pitch diameter.MechanismGearingties aGearBoxto the physical output dimensions of a mechanism (e.g., spool radius for an elevator, arm length for a rotary mechanism) so that motor-side units can be converted directly to real-world position and velocity.
Example Single-Stage 5:1 Reduction
Pass the driver tooth count first, then the driven tooth count. The ratio is
driven / driver, so 12 driver teeth and 60 driven teeth produces a 5:1 reduction:
// Represents a single 12T-to-60T gear stage (5:1 overall reduction).
GearBox gearbox = new GearBox(12.0, 60.0);
double ratio = gearbox.getRatio(); // 5.0
Example Multi-Stage Gearbox
// Two stages: 12:60 then 14:50 → overall ratio = 5.0 × 3.571... ≈ 17.857:1
GearBox gearbox = new GearBox(12.0, 60.0, 14.0, 50.0);
- See Also:
-
ClassesClassDescriptionGearBox class to calculate input and output conversion factors and check if the current configuration is supported.Mechanism gearing for conversions from the motor output to the mechanism output.Sprocket class to handle calculating the conversion factor of a sprocket in your mechanism.