Package com.revrobotics
Interface AnalogInput
-
- All Known Implementing Classes:
SparkMaxAnalogSensor
public interface AnalogInput
Get an instance of this interface by usingCANSparkMax.getAnalog(SparkMaxAnalogSensor.Mode)
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description double
getPosition()
Get the position of the sensor.double
getPositionConversionFactor()
Get the current conversion factor for the position of the analog sensor.double
getVoltage()
Get the voltage of the analog sensor.REVLibError
setPositionConversionFactor(double factor)
Set the conversion factor for the position of the analog sensor.
-
-
-
Method Detail
-
getVoltage
double getVoltage()
Get the voltage of the analog sensor.- Returns:
- Voltage of the sensor.
-
getPosition
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().- Returns:
- Position of the sensor
-
setPositionConversionFactor
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.- Parameters:
factor
- The conversion factor which will be multiplied by volts- Returns:
REVLibError.kOk
if successful
-
getPositionConversionFactor
double getPositionConversionFactor()
Get the current conversion factor for the position of the analog sensor.- Returns:
- Analog position conversion factor
-
-