Class Sprocket
java.lang.Object
yams.core.gearing.Sprocket
Sprocket class to handle calculating the conversion factor of a sprocket in your mechanism.
A Sprocket models a chain or belt drive made up of two or more sprockets/pulleys. The
ratio for each stage is expressed as driver / driven (IN/OUT). A ratio less than 1.0
indicates a reduction (the driven sprocket has more teeth than the driver).
You can construct a Sprocket in several ways:
new Sprocket(double...)provide per-stage IN/OUT ratios directlyfromStages(String...)provide stages as"IN:OUT"strings
Example
// 2:1 reduction 18-tooth driver sprocket driving a 36-tooth driven sprocket
// The ratio passed is driver/driven = 18/36 = 0.5
Sprocket twoToOne = new Sprocket(18.0 / 36.0);
// Equivalent using an "IN:OUT" stage string
Sprocket fromString = Sprocket.fromStages("18:36");
// Get the input-to-output conversion factor (< 1.0 means the output spins slower)
double factor = twoToOne.getInputToOutputConversionFactor(); // 0.5
// Get the output-to-input conversion factor (the reduction ratio)
double reduction = twoToOne.getOutputToInputConversionFactor(); // 2.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondiv(double x) Divide the sprocket reduction ratio by X.static SprocketfromStages(String... stages) Construct theSprocketwith the reduction stages given.doubleGet the conversion factor to transform the sprocket input into the sprocket output rotations.doubleGet the conversion factor to transform the sprocket output value into the sprocket input value.times(double x) Multiply the sprocket reduction ratio by X.
-
Constructor Details
-
Sprocket
public Sprocket(double... sprocketReductionStage) Create the sprocket given the teeth of each sprocket in the chain.- Parameters:
sprocketReductionStage- Sprocket teeth, in the form of "IN:OUT" => IN/OUT- Throws:
NoStagesGivenException- if no reduction stages are given.
-
Sprocket
Construct theSprocketwith the reduction stages given.- Parameters:
reductionStage- List of stages in the format of "IN:OUT".- Throws:
InvalidStageGivenException- if any stage string does not contain a':'separator.NoStagesGivenException- ifreductionStageis empty.
-
-
Method Details
-
fromStages
Construct theSprocketwith the reduction stages given.- Parameters:
stages- List of stages in the format of "IN:OUT".- Returns:
- Sprocket representation
- Throws:
InvalidStageGivenException- if any stage string does not contain a':'separator.NoStagesGivenException- if no stages are given.
-
times
-
div
-
getInputToOutputConversionFactor
public double getInputToOutputConversionFactor()Get the conversion factor to transform the sprocket input into the sprocket output rotations.- Returns:
- OUT/IN or OUT:IN
-
getOutputToInputConversionFactor
public double getOutputToInputConversionFactor()Get the conversion factor to transform the sprocket output value into the sprocket input value.- Returns:
- IN:OUT or IN/OUT
-