Class GearRatioHelper


  • public class GearRatioHelper
    extends java.lang.Object
    Simple utility representing a gear ratio.
    • Constructor Summary

      Constructors 
      Constructor Description
      GearRatioHelper​(double ratioInputToOutput)
      Creates a gear ratio helper from a double ratio of input to output.
      GearRatioHelper​(double inputRatio, double outputRatio)
      Constructs a GearRatioHelper.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double inputFromOutput​(double outputSide)
      Returns how far the "input" side of the mechanism will have travelled if the "output" has travelled the indicated angular distance.
      double outputFromInput​(double inputSide)
      Returns how far the "output" side of the mechanism will have travelled if the "input" has travelled the indicated angular distance.
      double toDoubleRatioInputToOutput()
      Returns the gear ratio as input/output.
      double toDoubleRatioOutputToInput()
      Returns the gear ratio as output/input.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GearRatioHelper

        public GearRatioHelper​(double inputRatio,
                               double outputRatio)
                        throws java.security.InvalidParameterException
        Constructs a GearRatioHelper.

        The parameters indicate the "input" and "output" sides of the mechanism. The input is typically where the motor is.

        The measurements of the parameters can be of many types that relate the motion of one side to the other, as long as they're consistent. For example, radius, circumference, number of gear teeth, angular distance per angular distance of the other, and more, are all valid parameters.

        A higher output ratio than input ratio is a reduction (lower speed, higher torque).

        A higher input ratio than output ratio is a step-up (higher speed, lower torque).

        Parameters:
        inputRatio - The measurement of the "input" side (usually where the motor is)
        outputRatio - The measurement of the "output" side (usually on the other side of a gearbox or series of pulleys from the motor)
        Throws:
        java.security.InvalidParameterException - If the input or output ratio(s) are less than zero.
      • GearRatioHelper

        public GearRatioHelper​(double ratioInputToOutput)
        Creates a gear ratio helper from a double ratio of input to output.
        Parameters:
        ratioInputToOutput - The ratio as input/output.
    • Method Detail

      • toDoubleRatioInputToOutput

        public double toDoubleRatioInputToOutput()
        Returns the gear ratio as input/output.
        Returns:
        The double ratio as input/output.
      • toDoubleRatioOutputToInput

        public double toDoubleRatioOutputToInput()
        Returns the gear ratio as output/input.
        Returns:
        The double ratio as output/input.
      • outputFromInput

        public double outputFromInput​(double inputSide)
        Returns how far the "output" side of the mechanism will have travelled if the "input" has travelled the indicated angular distance.
        Parameters:
        inputSide - The angular distance travelled by the *input* side.
        Returns:
        The angular distance travelled by the *output* side.
      • inputFromOutput

        public double inputFromOutput​(double outputSide)
        Returns how far the "input" side of the mechanism will have travelled if the "output" has travelled the indicated angular distance.
        Parameters:
        outputSide - The angular distance travelled by the *output* side.
        Returns:
        The angular distance travelled by the *output* side.