Class SensorTransmission

  • All Implemented Interfaces:
    PositionSensor

    public class SensorTransmission
    extends java.lang.Object
    implements PositionSensor
    Composed of a single sensor, and applies a gear ratio to it.
    • Constructor Detail

      • SensorTransmission

        public SensorTransmission​(PositionSensor inputSensor,
                                  SensorTransmissionConfiguration config)
        Constructor.
        Parameters:
        inputSensor - The sensor on the input of the transmission.
        config - The config data for this sensor transmission.
    • Method Detail

      • getPosition

        public double getPosition()
        Description copied from interface: PositionSensor
        Get the position value of the sensor.
        Specified by:
        getPosition in interface PositionSensor
        Returns:
        The position value in rotations.
      • applyTransmissionForwards

        protected double applyTransmissionForwards​(double value)
        Applies the gear ratio, inversion, and offset to get from an input value to an output value.
        Parameters:
        value - The input value.
        Returns:
        The output value.
      • applyTransmissionReverse

        protected double applyTransmissionReverse​(double value)
        Applies the gear ratio, inversion, and offset to get from an output value to an input value.
        Parameters:
        value - The output value.
        Returns:
        The input value.
      • getInversionConstant

        protected double getInversionConstant()
        Returns -1. if the sensor is inverted, or 1. otherwise.
        Returns:
        The constant to multiple positions by for inversion.