REVLib - C++
rev::detached::DetachedEncoder Class Reference

#include <DetachedEncoder.h>

Inherits rev::RelativeEncoder, and rev::detached::DetachedEncoderLowLevel.

Inherited by rev::detached::SplineEncoder.

Classes

struct  Faults
 

Public Member Functions

 DetachedEncoder (DetachedEncoder &&rhs)=default
 
DetachedEncoderoperator= (DetachedEncoder &&rhs)=default
 
 DetachedEncoder (const DetachedEncoder &rhs)=default
 
 ~DetachedEncoder () override=default
 
double GetPosition () const override
 
double GetVelocity () const override
 
double GetAngle () const
 
double GetRawAngle () const
 
REVLibError SetPosition (double position) override
 
REVLibError Configure (DetachedEncoderConfig &config, rev::ResetMode resetMode)
 
Faults GetFaults () const
 
Faults GetStickyFaults () const
 
REVLibError ClearFaults ()
 
- Public Member Functions inherited from rev::RelativeEncoder
virtual ~RelativeEncoder ()=default
 
- Public Member Functions inherited from rev::detached::DetachedEncoderLowLevel
virtual ~DetachedEncoderLowLevel ()
 
int GetDeviceId () const
 
EncoderModel GetEncoderModel () const
 
FirmwareVersion GetFirmwareVersion () const
 
PeriodicStatus0 GetPeriodicStatus0 () const
 
PeriodicStatus1 GetPeriodicStatus1 () const
 
PeriodicStatus2 GetPeriodicStatus2 () const
 
PeriodicStatus3 GetPeriodicStatus3 () const
 
PeriodicStatus4 GetPeriodicStatus4 () const
 
void CreateSimFaultManager ()
 

Public Attributes

DetachedEncoderConfigAccessor configAccessor
 

Protected Member Functions

 DetachedEncoder (int deviceID, EncoderModel model)
 
- Protected Member Functions inherited from rev::detached::DetachedEncoderLowLevel
 DetachedEncoderLowLevel (int deviceID, EncoderModel model)
 

Additional Inherited Members

- Public Types inherited from rev::detached::DetachedEncoderLowLevel
enum class  EncoderModel { kUnknown = 0 , kMAXSplineEncoder = 1 }
 
- Protected Attributes inherited from rev::detached::DetachedEncoderLowLevel
void * m_detachedEncoderHandle {nullptr}
 

Constructor & Destructor Documentation

◆ DetachedEncoder() [1/3]

rev::detached::DetachedEncoder::DetachedEncoder ( DetachedEncoder &&  rhs)
default

◆ DetachedEncoder() [2/3]

rev::detached::DetachedEncoder::DetachedEncoder ( const DetachedEncoder rhs)
default

◆ ~DetachedEncoder()

rev::detached::DetachedEncoder::~DetachedEncoder ( )
overridedefault

Closes the Detached encoder controller

◆ DetachedEncoder() [3/3]

DetachedEncoder::DetachedEncoder ( int  deviceID,
EncoderModel  model 
)
protected

Create a new object to control a Detached Encoder

Parameters
deviceIDThe device ID.
modelThe specific model of detached encoder

Member Function Documentation

◆ operator=()

DetachedEncoder & rev::detached::DetachedEncoder::operator= ( DetachedEncoder &&  rhs)
default

◆ GetPosition()

double DetachedEncoder::GetPosition ( ) const
overridevirtual

Get the position of the encoder. This returns the native units of 'rotations' by default, and can be changed by a scale factor using DetachedEncoderConfig::PositionConversionFactor().

Returns
Number of rotations of the encoder

Implements rev::RelativeEncoder.

◆ GetVelocity()

double DetachedEncoder::GetVelocity ( ) const
overridevirtual

Get the velocity of the encoder. This returns the native units of 'RPM' by default, and can be changed by a scale factor using DetachedEncoderConfig::VelocityConversionFactor().

Returns
Number the RPM of the encoder

Implements rev::RelativeEncoder.

◆ GetAngle()

double DetachedEncoder::GetAngle ( ) const

Get the absolute position of the encoder. This returns the native units of 'rotations' [0, 1) by default, and can be changed by a scale factor using DetachedEncoderConfig::PositionConversionFactor().

Returns
Number of rotations of the encoder

◆ GetRawAngle()

double DetachedEncoder::GetRawAngle ( ) const

Get the absolute position of the encoder. This returns the native units of 'rotations' [0, 1) without scaling from conversion factors.

Returns
Number of rotations of the encoder

◆ SetPosition()

rev::REVLibError DetachedEncoder::SetPosition ( double  position)
overridevirtual

Set the position of the encoder.

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

Implements rev::RelativeEncoder.

◆ Configure()

rev::REVLibError DetachedEncoder::Configure ( DetachedEncoderConfig config,
rev::ResetMode  resetMode 
)

Set the configuration for the Detached encoder.

If resetMode is ResetMode::kResetSafeParameters, this method will reset safe writable parameters to their default values before setting the given configuration.

Parameters
configThe desired Detached encoder configuration
resetModeWhether to reset safe parameters before setting the configuration
Returns
REVLibError::kOk if successful

◆ GetFaults()

DetachedEncoder::Faults DetachedEncoder::GetFaults ( ) const

Get the active faults that are currently present on the detached encoder.

Returns
A struct with each fault and their active value

◆ GetStickyFaults()

DetachedEncoder::Faults DetachedEncoder::GetStickyFaults ( ) const

Get the sticky faults that were present on the detached encoder at one point since the sticky faults were last cleared.

Sticky faults can be cleared with DetachedEncoder::ClearFaults().

Returns
A struct with each fault and their sticky value

◆ ClearFaults()

rev::REVLibError DetachedEncoder::ClearFaults ( )

Clears all sticky faults.

Member Data Documentation

◆ configAccessor

DetachedEncoderConfigAccessor rev::detached::DetachedEncoder::configAccessor

Accessor for Detached encoder parameter values. This object contains fields and methods to retrieve parameters that have been applied to the device. To set parameters, see DetachedEncoderConfig and DetachedEncoder::Configure().

NOTE: This uses calls that are blocking to retrieve parameters and should be used infrequently.


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