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
 
rev::util::Signal< double > GetPosition () const override
 
rev::util::Signal< double > GetVelocity () const override
 
rev::util::Signal< double > GetAngle () const
 
rev::util::Signal< double > GetRawAngle () const
 
REVLibError SetPosition (double position) override
 
REVLibError Configure (DetachedEncoderConfig &config, rev::ResetMode resetMode)
 
rev::util::Signal< FaultsGetFaults () const
 
rev::util::Signal< FaultsGetStickyFaults () const
 
REVLibError ClearFaults ()
 
- Public Member Functions inherited from rev::RelativeEncoder
virtual ~RelativeEncoder ()=default
 
- Public Member Functions inherited from rev::detached::DetachedEncoderLowLevel
virtual ~DetachedEncoderLowLevel ()
 
int GetBusId () const
 
int GetDeviceId () const
 
EncoderModel GetEncoderModel () const
 
FirmwareVersion GetFirmwareVersion () const
 
PeriodicStatus0 GetPeriodicStatus0 () const
 
rev::util::Signal< PeriodicStatus1GetPeriodicStatus1 () const
 
rev::util::Signal< PeriodicStatus2GetPeriodicStatus2 () const
 
rev::util::Signal< PeriodicStatus3GetPeriodicStatus3 () const
 
rev::util::Signal< PeriodicStatus4GetPeriodicStatus4 () const
 
void CreateSimFaultManager ()
 

Public Attributes

DetachedEncoderConfigAccessor configAccessor
 

Protected Member Functions

 DetachedEncoder (int busID, int deviceID, EncoderModel model)
 
- Protected Member Functions inherited from rev::detached::DetachedEncoderLowLevel
 DetachedEncoderLowLevel (int busId, 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  busID,
int  deviceID,
EncoderModel  model 
)
protected

Create a new object to control a Detached Encoder

Parameters
busIDThe CAN bus ID this device will be on.
deviceIDThe device ID.
modelThe specific model of detached encoder

Member Function Documentation

◆ operator=()

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

◆ GetPosition()

Signal< 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
Signal containing the number of rotations of the encoder

Implements rev::RelativeEncoder.

◆ GetVelocity()

Signal< 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
Signal containing the RPM of the encoder

Implements rev::RelativeEncoder.

◆ GetAngle()

Signal< 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
Signal containing the number of rotations of the encoder

◆ GetRawAngle()

Signal< 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
Signal containing the 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. The following parameters will not be reset by this action: CAN ID and Absolute (Duty Cycle) Zero Offset.

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

◆ GetFaults()

Signal< DetachedEncoder::Faults > DetachedEncoder::GetFaults ( ) const

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

Returns
Signal containing a struct with each fault and their active value

◆ GetStickyFaults()

Signal< 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
Signal containing 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: