SparkMaxAlternateEncoder
- class rev.SparkMaxAlternateEncoder
Bases:
RelativeEncoderGet an instance of this class by using SparkMax::GetEncoder() or SparkMax::GetEncoder(SparkMax::EncoderType, int).
- getPosition() float
Get the position of the motor. This returns the native units of ‘rotations’ by default, and can be changed by a scale factor using AlternateEncoderConfig::PositionConversionFactor().
- Returns:
Number of rotations of the motor
- getVelocity() float
Get the velocity of the motor. This returns the native units of ‘RPM’ by default, and can be changed by a scale factor using AlternateEncoderConfig::VelocityConversionFactor().
- Returns:
Number the RPM of the motor
- setPosition(position: SupportsFloat) rev._rev.REVLibError
Set the position of the encoder.
- Parameters:
position – Number of rotations of the motor
- Returns:
REVLibError::kOk if successful