Interface RelativeEncoder

All Known Implementing Classes:
SparkFlexExternalEncoder, SparkMaxAlternateEncoder, SparkRelativeEncoder

public interface RelativeEncoder
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    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

      double getPosition()
      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().
      Returns:
      Number of rotations of the motor
    • getVelocity

      double getVelocity()
      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().
      Returns:
      Number the RPM of the motor
    • setPosition

      REVLibError setPosition(double position)
      Set the position of the encoder. By default the units are 'rotations' and can be changed by a scale factor using setPositionConversionFactor().
      Parameters:
      position - Number of rotations of the motor
      Returns:
      REVLibError.kOk if successful