REVLib - C++
rev::spark::ExternalEncoderConfig Class Reference

#include <ExternalEncoderConfig.h>

Inherits rev::spark::BaseConfig.

Public Types

enum  Type { kQuadrature = 0 }
 

Public Member Functions

 ExternalEncoderConfig ()=default
 
 ~ExternalEncoderConfig () override=default
 
 ExternalEncoderConfig (const ExternalEncoderConfig &)=delete
 
ExternalEncoderConfigoperator= (const ExternalEncoderConfig &)=delete
 
 ExternalEncoderConfig (ExternalEncoderConfig &&) noexcept=delete
 
ExternalEncoderConfigoperator= (ExternalEncoderConfig &&) noexcept=delete
 
ExternalEncoderConfigApply (ExternalEncoderConfig &config)
 
ExternalEncoderConfigCountsPerRevolution (int cpr)
 
ExternalEncoderConfigInverted (bool inverted)
 
ExternalEncoderConfigPositionConversionFactor (double factor)
 
ExternalEncoderConfigVelocityConversionFactor (double factor)
 
ExternalEncoderConfigAverageDepth (int depth)
 
ExternalEncoderConfigMeasurementPeriod (int periodMs)
 
- Public Member Functions inherited from rev::spark::BaseConfig
virtual ~BaseConfig ()=default
 
virtual std::string Flatten ()
 

Static Public Member Functions

static Type FromId (int id)
 

Additional Inherited Members

- Protected Types inherited from rev::spark::BaseConfig
using SparkConfig_t = std::variant< int32_t, uint32_t, float, bool >
 
- Protected Member Functions inherited from rev::spark::BaseConfig
 BaseConfig ()=default
 
 BaseConfig (const BaseConfig &)=delete
 
BaseConfigoperator= (const BaseConfig &)=delete
 
 BaseConfig (BaseConfig &&) noexcept=delete
 
BaseConfigoperator= (BaseConfig &&) noexcept=delete
 
template<typename ConfigType >
void PutParameter (uint8_t parameterId, ConfigType value)
 
std::optional< SparkConfig_tGetParameter (uint8_t parameterId)
 
std::optional< SparkConfig_tGetParameter (BaseConfig &fromConfig, uint8_t parameterId)
 
void RemoveParameter (uint8_t parameterId)
 
void RemoveParameter (BaseConfig &fromConfig, uint8_t parameterId)
 
void Apply (BaseConfig &config)
 

Member Enumeration Documentation

◆ Type

Enumerator
kQuadrature 

Constructor & Destructor Documentation

◆ ExternalEncoderConfig() [1/3]

rev::spark::ExternalEncoderConfig::ExternalEncoderConfig ( )
default

◆ ~ExternalEncoderConfig()

rev::spark::ExternalEncoderConfig::~ExternalEncoderConfig ( )
overridedefault

◆ ExternalEncoderConfig() [2/3]

rev::spark::ExternalEncoderConfig::ExternalEncoderConfig ( const ExternalEncoderConfig )
delete

◆ ExternalEncoderConfig() [3/3]

rev::spark::ExternalEncoderConfig::ExternalEncoderConfig ( ExternalEncoderConfig &&  )
deletenoexcept

Member Function Documentation

◆ FromId()

static Type rev::spark::ExternalEncoderConfig::FromId ( int  id)
inlinestatic

◆ operator=() [1/2]

ExternalEncoderConfig & rev::spark::ExternalEncoderConfig::operator= ( const ExternalEncoderConfig )
delete

◆ operator=() [2/2]

ExternalEncoderConfig & rev::spark::ExternalEncoderConfig::operator= ( ExternalEncoderConfig &&  )
deletenoexcept

◆ Apply()

ExternalEncoderConfig & ExternalEncoderConfig::Apply ( ExternalEncoderConfig config)

Applies settings from another ExternalEncoderConfig to this one.

Settings in the provided config will overwrite existing values in this object. Settings not specified in the provided config remain unchanged.

Parameters
configThe ExternalEncoderConfig to copy settings from
Returns
The updated ExternalEncoderConfig for method chaining

◆ CountsPerRevolution()

ExternalEncoderConfig & ExternalEncoderConfig::CountsPerRevolution ( int  cpr)

Set the counts per revolutions of the External encoder.

Parameters
cprThe counts per rotation
Returns
The modified ExternalEncoderConfig object for method chaining

◆ Inverted()

ExternalEncoderConfig & ExternalEncoderConfig::Inverted ( bool  inverted)

Set the phase of the External encoder so that it is in phase with the motor itself.

Parameters
invertedThe phase of the encoder
Returns
The modified ExternalEncoderConfig object for method chaining

◆ PositionConversionFactor()

ExternalEncoderConfig & ExternalEncoderConfig::PositionConversionFactor ( double  factor)

Set the conversion factor for the position of the External encoder. Position is returned in native units of rotations and will be multiplied by this conversion factor.

Parameters
factorThe conversion factor to multiply the native units by
Returns
The modified ExternalEncoderConfig object for method chaining

◆ VelocityConversionFactor()

ExternalEncoderConfig & ExternalEncoderConfig::VelocityConversionFactor ( double  factor)

Set the conversion factor for the velocity of the External encoder. Velocity is returned in native units of rotations per minute and will be multiplied by this conversion factor.

Parameters
factorThe conversion factor to multiply the native units by
Returns
The modified ExternalEncoderConfig object for method chaining

◆ AverageDepth()

ExternalEncoderConfig & ExternalEncoderConfig::AverageDepth ( int  depth)

Set the sampling depth of the velocity calculation process of the External encoder. This value sets the number of samples in the average for velocity readings. For a quadrature encoder, this can be any value from 1 to 64 (default).

Parameters
depthThe velocity calculation process's sampling depth
Returns
The modified ExternalEncoderConfig object for method chaining

◆ MeasurementPeriod()

ExternalEncoderConfig & ExternalEncoderConfig::MeasurementPeriod ( int  periodMs)

Set the position measurement period used to calculate the velocity of the External encoder. For a quadrature encoder, this number may be between 1 and 100 (default).

The basic formula to calculate velocity is change in position / change in time. This parameter sets the change in time for measurement.

Parameters
periodMsMeasurement period in milliseconds
Returns
The modified ExternalEncoderConfig object for method chaining

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