Class MechanismGearing
java.lang.Object
yams.core.gearing.MechanismGearing
Mechanism gearing for conversions from the motor output to the mechanism output.
MechanismGearing combines a GearBox (and an optional Sprocket) into a
single object that describes the complete power-transmission path between the motor and the
mechanism. It is the primary object passed to motor-controller configuration helpers (such as
SmartMotorControllerConfig) so that encoder readings can be automatically scaled to
real-world mechanism positions or velocities.
Constructors available:
new MechanismGearing(double)single overall reduction rationew MechanismGearing(double...)one ratio per gearbox stagenew MechanismGearing(GearBox)pre-builtGearBoxnew MechanismGearing(GearBox, Sprocket)gearbox followed by a chain/belt stage
Example
// Simple 10:1 gearbox attached directly to the mechanism
MechanismGearing simple = new MechanismGearing(10.0);
// Two-stage gearbox (5:1 then 3:1 = 15:1 overall)
MechanismGearing twoStage = new MechanismGearing(5.0, 3.0);
// Gearbox followed by a 2:1 chain-drive sprocket stage
GearBox gearBox = GearBox.fromTeeth(12, 60); // 5:1
Sprocket sprocket = Sprocket.fromStages("18:36"); // 2:1
MechanismGearing combined = new MechanismGearing(gearBox, sprocket); // 10:1 overall
// Query the ratios
double rotorToMech = combined.getRotorToMechanismRatio(); // motor rotations per mechanism
rotation double mechToRotor = combined.getMechanismToRotorRatio(); // mechanism rotations per
motor rotation
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMechanismGearing(double reductionRatio) Construct aMechanismGearingwith a reduction ratio.MechanismGearing(double... reductionRatios) Construct aMechanismGearingwith a reduction ratios.MechanismGearing(GearBox gearBox) Initialize theMechanismGearingwith only aGearBoxattached to the mechanism motor.MechanismGearing(GearBox gearBox, Sprocket sprockets) -
Method Summary
Modifier and TypeMethodDescriptiondiv(double i) Divide the gearbox reduction ratio by i.doubleGet the mechanism rotation to sensor rotation ratio for the mechanism.doubleGet the sensor to the mechanism ratio for the motor to the mechanism.
-
Field Details
-
kOne
1:1 Mechanism Gearing.
-
-
Constructor Details
-
MechanismGearing
public MechanismGearing(double reductionRatio) Construct aMechanismGearingwith a reduction ratio.- Parameters:
reductionRatio- Reduction ratio. For example, a reduction of "3:1" is 3.0; a reduction of "1:2" is 0.5.
-
MechanismGearing
public MechanismGearing(double... reductionRatios) Construct aMechanismGearingwith a reduction ratios.- Parameters:
reductionRatios- Reduction ratio. For example, a reduction of "3:1" is 3.0; a reduction of "1:2" is 0.5.- Throws:
NoStagesGivenException- if no reduction ratios are given.
-
MechanismGearing
Initialize theMechanismGearingwith only aGearBoxattached to the mechanism motor.- Parameters:
gearBox-GearBoxof the Mechanism.
-
MechanismGearing
-
-
Method Details
-
getRotorToMechanismRatio
public double getRotorToMechanismRatio()Get the sensor to the mechanism ratio for the motor to the mechanism.- Returns:
- OUT:IN or OUT/IN ratio to use for sensor to mechanism calculations.
-
getMechanismToRotorRatio
public double getMechanismToRotorRatio()Get the mechanism rotation to sensor rotation ratio for the mechanism. AKA THE REDUCTION!- Returns:
- IN:OUT or IN/OUT to use for mechanism to sensor calculations.
-
div
Divide the gearbox reduction ratio by i.- Parameters:
i- Numerator.- Returns:
MechanismGearing
-