REVLib - C++
rev::AbsoluteEncoder Class Referenceabstract

#include <AbsoluteEncoder.h>

Inherits rev::MotorFeedbackSensor.

Inherited by rev::SparkMaxAbsoluteEncoder.

Public Member Functions

virtual ~AbsoluteEncoder ()
 
virtual double GetPosition () const =0
 
virtual double GetVelocity () const =0
 
virtual REVLibError SetPositionConversionFactor (double factor)=0
 
virtual double GetPositionConversionFactor () const =0
 
virtual REVLibError SetVelocityConversionFactor (double factor)=0
 
virtual double GetVelocityConversionFactor () const =0
 
virtual REVLibError SetInverted (bool inverted)=0
 
virtual bool GetInverted () const =0
 
virtual REVLibError SetAverageDepth (uint32_t depth)=0
 
virtual uint32_t GetAverageDepth () const =0
 
virtual REVLibError SetZeroOffset (double offset)=0
 
virtual double GetZeroOffset () const =0
 
- Public Member Functions inherited from rev::MotorFeedbackSensor
virtual ~MotorFeedbackSensor ()
 
- Public Member Functions inherited from rev::CANSensor
virtual ~CANSensor ()
 

Friends

class SparkMaxAbsoluteEncoder
 

Constructor & Destructor Documentation

◆ ~AbsoluteEncoder()

virtual rev::AbsoluteEncoder::~AbsoluteEncoder ( )
inlinevirtual

Member Function Documentation

◆ GetPosition()

virtual double rev::AbsoluteEncoder::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 setPositionConversionFactor().

Returns
Number of rotations of the motor

Implemented in rev::SparkMaxAbsoluteEncoder.

◆ GetVelocity()

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

Get the velocity of the motor. This returns the native units of 'rotations per second' by default, and can be changed by a scale factor using setVelocityConversionFactor().

Returns
Number of rotations per second of the motor

Implemented in rev::SparkMaxAbsoluteEncoder.

◆ SetPositionConversionFactor()

virtual REVLibError rev::AbsoluteEncoder::SetPositionConversionFactor ( double  factor)
pure virtual

Set the conversion factor for position of the encoder. Multiplied by the native output units to give you position

Parameters
factorThe conversion factor to multiply the native units by
Returns
REVLibError::kOk if successful

Implemented in rev::SparkMaxAbsoluteEncoder.

◆ GetPositionConversionFactor()

virtual double rev::AbsoluteEncoder::GetPositionConversionFactor ( ) const
pure virtual

Get the conversion factor for position of the encoder. Multiplied by the native output units to give you position

Returns
The conversion factor for position

Implemented in rev::SparkMaxAbsoluteEncoder.

◆ SetVelocityConversionFactor()

virtual REVLibError rev::AbsoluteEncoder::SetVelocityConversionFactor ( double  factor)
pure virtual

Set the conversion factor for velocity of the encoder. Multiplied by the native output units to give you velocity

Parameters
factorThe conversion factor to multiply the native units by
Returns
REVLibError::kOk if successful

Implemented in rev::SparkMaxAbsoluteEncoder.

◆ GetVelocityConversionFactor()

virtual double rev::AbsoluteEncoder::GetVelocityConversionFactor ( ) const
pure virtual

Get the conversion factor for velocity of the encoder. Multiplied by the native output units to give you velocity

Returns
The conversion factor for velocity

Implemented in rev::SparkMaxAbsoluteEncoder.

◆ SetInverted()

virtual REVLibError rev::AbsoluteEncoder::SetInverted ( bool  inverted)
pure virtual

Set the phase of the AbsoluteEncoder so that it is set to be in phase with the motor itself

Parameters
invertedThe phase of the encoder
Returns
REVLibError::kOk if successful

Implements rev::MotorFeedbackSensor.

Implemented in rev::SparkMaxAbsoluteEncoder.

◆ GetInverted()

virtual bool rev::AbsoluteEncoder::GetInverted ( ) const
pure virtual

Get the phase of the AbsoluteEncoder

Returns
The phase of the encoder

Implements rev::MotorFeedbackSensor.

Implemented in rev::SparkMaxAbsoluteEncoder.

◆ SetAverageDepth()

virtual REVLibError rev::AbsoluteEncoder::SetAverageDepth ( uint32_t  depth)
pure virtual

Set the average sampling depth for an absolute encoder. This is a bit size and should be either 1, 2, 4, 8, 16, 32, 64, or 128

Parameters
depthThe average sampling depth of 1, 2, 4, 8, 16, 32, 64, or 128
Returns
REVLibError::kOk if successful

Implemented in rev::SparkMaxAbsoluteEncoder.

◆ GetAverageDepth()

virtual uint32_t rev::AbsoluteEncoder::GetAverageDepth ( ) const
pure virtual

Get the average sampling depth for an absolute encoder

Returns
The average sampling depth

Implemented in rev::SparkMaxAbsoluteEncoder.

◆ SetZeroOffset()

virtual REVLibError rev::AbsoluteEncoder::SetZeroOffset ( double  offset)
pure virtual

Sets the zero offset of an absolute encoder (the position that is reported as zero).

The zero offset is specified as the reported position of the encoder in the desired zero position, if the zero offset was set to 0. It is influenced by the absolute encoder's position conversion factor, and whether it is inverted.

Always call SetPositionConversionFactor() and SetInverted() before calling this function.

Parameters
offsetThe zero offset with the position conversion factor applied
Returns
REVLibError::kOk if successful

Implemented in rev::SparkMaxAbsoluteEncoder.

◆ GetZeroOffset()

virtual double rev::AbsoluteEncoder::GetZeroOffset ( ) const
pure virtual

Gets the zero offset for an absolute encoder (the position that is reported as zero).

The zero offset is specified as the reported position of the encoder in the desired zero position, if the zero offset was set to 0. It is influenced by the absolute encoder's position conversion factor, and whether it is inverted.

Returns
The zero offset of the absolute encoder with the position conversion factor applied

Implemented in rev::SparkMaxAbsoluteEncoder.

Friends And Related Function Documentation

◆ SparkMaxAbsoluteEncoder

friend class SparkMaxAbsoluteEncoder
friend

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