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

#include <AlternateEncoderConfig.h>

Inherits rev::spark::BaseConfig.

Public Types

enum  Type { kQuadrature = 0 }
 

Public Member Functions

 AlternateEncoderConfig ()=default
 
 ~AlternateEncoderConfig () override=default
 
 AlternateEncoderConfig (const AlternateEncoderConfig &)=delete
 
AlternateEncoderConfigoperator= (const AlternateEncoderConfig &)=delete
 
 AlternateEncoderConfig (AlternateEncoderConfig &&) noexcept=delete
 
AlternateEncoderConfigoperator= (AlternateEncoderConfig &&) noexcept=delete
 
AlternateEncoderConfigApply (AlternateEncoderConfig &config)
 
AlternateEncoderConfigSetSparkMaxDataPortConfig ()
 
AlternateEncoderConfigCountsPerRevolution (int cpr)
 
AlternateEncoderConfigInverted (bool inverted)
 
AlternateEncoderConfigPositionConversionFactor (double factor)
 
AlternateEncoderConfigVelocityConversionFactor (double factor)
 
AlternateEncoderConfigAverageDepth (int depth)
 
AlternateEncoderConfigMeasurementPeriod (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

◆ AlternateEncoderConfig() [1/3]

rev::spark::AlternateEncoderConfig::AlternateEncoderConfig ( )
default

◆ ~AlternateEncoderConfig()

rev::spark::AlternateEncoderConfig::~AlternateEncoderConfig ( )
overridedefault

◆ AlternateEncoderConfig() [2/3]

rev::spark::AlternateEncoderConfig::AlternateEncoderConfig ( const AlternateEncoderConfig )
delete

◆ AlternateEncoderConfig() [3/3]

rev::spark::AlternateEncoderConfig::AlternateEncoderConfig ( AlternateEncoderConfig &&  )
deletenoexcept

Member Function Documentation

◆ FromId()

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

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ Apply()

AlternateEncoderConfig & AlternateEncoderConfig::Apply ( AlternateEncoderConfig config)

Applies settings from another AlternateEncoderConfig 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 AlternateEncoderConfig to copy settings from
Returns
The updated AlternateEncoderConfig for method chaining

◆ SetSparkMaxDataPortConfig()

AlternateEncoderConfig & AlternateEncoderConfig::SetSparkMaxDataPortConfig ( )

Configures the data port to use the alternate encoder, which is specifically required for SPARK MAX.

NOTE: This method is only necessary when using an alternate encoder with a SPARK MAX without configuring any of its settings

IMPORTANT: SPARK MAX does not support using an alternate encoder in conjunction with an absolute encoder and/or limit switches.

Returns
The modified AlternateEncoderConfig object for method chaining

◆ CountsPerRevolution()

AlternateEncoderConfig & AlternateEncoderConfig::CountsPerRevolution ( int  cpr)

Set the counts per revolutions of the alternate encoder.

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

◆ Inverted()

AlternateEncoderConfig & AlternateEncoderConfig::Inverted ( bool  inverted)

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

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

◆ PositionConversionFactor()

AlternateEncoderConfig & AlternateEncoderConfig::PositionConversionFactor ( double  factor)

Set the conversion factor for the position of the alternate 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 AlternateEncoderConfig object for method chaining

◆ VelocityConversionFactor()

AlternateEncoderConfig & AlternateEncoderConfig::VelocityConversionFactor ( double  factor)

Set the conversion factor for the velocity of the alternate 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 AlternateEncoderConfig object for method chaining

◆ AverageDepth()

AlternateEncoderConfig & AlternateEncoderConfig::AverageDepth ( int  depth)

Set the sampling depth of the velocity calculation process of the alternate 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 AlternateEncoderConfig object for method chaining

◆ MeasurementPeriod()

AlternateEncoderConfig & AlternateEncoderConfig::MeasurementPeriod ( int  periodMs)

Set the position measurement period used to calculate the velocity of the alternate 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 AlternateEncoderConfig object for method chaining

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