Package com.revrobotics.spark
Class SparkMaxAlternateEncoder
java.lang.Object
com.revrobotics.spark.SparkMaxAlternateEncoder
- All Implemented Interfaces:
RelativeEncoder
-
Method Summary
Modifier and TypeMethodDescriptiondouble
Get the position of the motor.double
Get the velocity of the motor.setPosition
(double position) Set the position of the encoder.
-
Method Details
-
getPosition
public double getPosition()Description copied from interface:RelativeEncoder
Get the position of the motor. This returns the native units of 'rotations' by default, and can be changed by a scale factor using setPositionConversionFactor().- Specified by:
getPosition
in interfaceRelativeEncoder
- Returns:
- Number of rotations of the motor
-
getVelocity
public double getVelocity()Description copied from interface:RelativeEncoder
Get the velocity of the motor. This returns the native units of 'RPM' by default, and can be changed by a scale factor using setVelocityConversionFactor().- Specified by:
getVelocity
in interfaceRelativeEncoder
- Returns:
- Number the RPM of the motor
-
setPosition
Description copied from interface:RelativeEncoder
Set the position of the encoder. By default the units are 'rotations' and can be changed by a scale factor using setPositionConversionFactor().- Specified by:
setPosition
in interfaceRelativeEncoder
- Parameters:
position
- Number of rotations of the motor- Returns:
REVLibError.kOk
if successful
-