REVLib - C++
rev::RelativeEncoder Class Referenceabstract

#include <RelativeEncoder.h>

Inherited by rev::detached::DetachedEncoder, rev::spark::SparkFlexExternalEncoder, rev::spark::SparkMaxAlternateEncoder, and rev::spark::SparkRelativeEncoder.

Public Member Functions

virtual ~RelativeEncoder ()=default
 
virtual double GetPosition () const =0
 
virtual double GetVelocity () const =0
 
virtual REVLibError SetPosition (double position)=0
 

Constructor & Destructor Documentation

◆ ~RelativeEncoder()

virtual rev::RelativeEncoder::~RelativeEncoder ( )
virtualdefault

Member Function Documentation

◆ GetPosition()

virtual double rev::RelativeEncoder::GetPosition ( ) const
pure virtual

Get the position of the motor. This returns the native units of 'rotations' by default, and can be changed by a scale factor using EncoderConfig::PositionConversionFactor(), or AlternateEncoderConfig::PositionConversionFactor(), or ExternalEncoderConfig::PositionConversionFactor().

Returns
Number of rotations of the motor

Implemented in rev::detached::DetachedEncoder, rev::spark::SparkFlexExternalEncoder, rev::spark::SparkMaxAlternateEncoder, and rev::spark::SparkRelativeEncoder.

◆ GetVelocity()

virtual double rev::RelativeEncoder::GetVelocity ( ) const
pure virtual

Get the velocity of the motor. This returns the native units of 'RPM' by default, and can be changed by a scale factor using EncoderConfig::VelocityConversionFactor(), or AlternateEncoderConfig::VelocityConversionFactor(), or ExternalEncoderConfig::VelocityConversionFactor().

Returns
The RPM of the motor

Implemented in rev::detached::DetachedEncoder, rev::spark::SparkFlexExternalEncoder, rev::spark::SparkMaxAlternateEncoder, and rev::spark::SparkRelativeEncoder.

◆ SetPosition()

virtual REVLibError rev::RelativeEncoder::SetPosition ( double  position)
pure virtual

Set the position of the encoder.

Parameters
positionNumber of rotations of the motor
Returns
REVLibError::kOk if successful

Implemented in rev::detached::DetachedEncoder, rev::spark::SparkFlexExternalEncoder, rev::spark::SparkMaxAlternateEncoder, and rev::spark::SparkRelativeEncoder.


The documentation for this class was generated from the following file: