Class SparkMaxAnalogSensor

    • Method Detail

      • getVoltage

        public double getVoltage()
        Get the voltage of the analog sensor.
        Specified by:
        getVoltage in interface AnalogInput
        Specified by:
        getVoltage in interface CANAnalog
        Returns:
        Voltage of the sensor.
      • getPosition

        public double getPosition()
        Get the position of the sensor. Returns value in the native unit of 'volt' by default, and can be changed by a scale factor using setPositionConversionFactor().
        Specified by:
        getPosition in interface AnalogInput
        Specified by:
        getPosition in interface CANAnalog
        Returns:
        Position of the sensor
      • getVelocity

        public double getVelocity()
        Get the velocity of the sensor. Returns value in the native units of 'volts per second' by default, and can be changed by a scale factor using setVelocityConversionFactor().
        Specified by:
        getVelocity in interface CANAnalog
        Returns:
        Velocity of the sensor in volts per second
      • setPositionConversionFactor

        public REVLibError setPositionConversionFactor​(double factor)
        Set the conversion factor for the position of the analog sensor. By default, revolutions per volt is 1. Changing the position conversion factor will also change the position units.
        Specified by:
        setPositionConversionFactor in interface AnalogInput
        Specified by:
        setPositionConversionFactor in interface CANAnalog
        Parameters:
        factor - The conversion factor which will be multiplied by volts
        Returns:
        REVLibError.kOk if successful
      • setVelocityConversionFactor

        public REVLibError setVelocityConversionFactor​(double factor)
        Set the conversion factor for the velocity of the analog sensor. By default, revolutions per volt second is 1. Changing the velocity conversion factor will also change the velocity units.
        Specified by:
        setVelocityConversionFactor in interface CANAnalog
        Parameters:
        factor - The conversion factor which will be multiplied by volts per second
        Returns:
        REVLibError.kOk if successful
      • getVelocityConversionFactor

        public double getVelocityConversionFactor()
        Get the current conversion factor for the velocity of the analog sensor.
        Specified by:
        getVelocityConversionFactor in interface CANAnalog
        Returns:
        Analog velocity conversion factor