REVLib - C++
Loading...
Searching...
No Matches
rev::spark::ExternalEncoderConfig Class Reference

#include <ExternalEncoderConfig.h>

Inherits rev::BaseConfig.

Classes

struct  Presets
 

Public Types

enum  Type { kQuadrature = 0 }
 

Public Member Functions

 ExternalEncoderConfig ()=default
 
 ~ExternalEncoderConfig () override=default
 
 ExternalEncoderConfig (const ExternalEncoderConfig &)=default
 
ExternalEncoderConfig & operator= (const ExternalEncoderConfig &)=delete
 
 ExternalEncoderConfig (ExternalEncoderConfig &&) noexcept=delete
 
ExternalEncoderConfig & operator= (ExternalEncoderConfig &&) noexcept=delete
 
ExternalEncoderConfig & Apply (ExternalEncoderConfig &config)
 
ExternalEncoderConfig & CountsPerRevolution (int cpr)
 
ExternalEncoderConfig & Inverted (bool inverted)
 
ExternalEncoderConfig & AverageDepth (int depth)
 
ExternalEncoderConfig & MeasurementPeriod (int periodMs)
 
- Public Member Functions inherited from rev::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::BaseConfig
using ParameterType_t = std::variant<int32_t, uint32_t, float, bool>
 
- Protected Member Functions inherited from rev::BaseConfig
 BaseConfig ()=default
 
 BaseConfig (const BaseConfig &)=default
 
BaseConfig & operator= (const BaseConfig &)=delete
 
 BaseConfig (BaseConfig &&) noexcept=delete
 
BaseConfig & operator= (BaseConfig &&) noexcept=delete
 
template<typename ParameterType >
void PutParameter (uint8_t parameterId, ParameterType value)
 
std::optional< ParameterType_t > GetParameter (uint8_t parameterId)
 
void RemoveParameter (uint8_t parameterId)
 
void Apply (BaseConfig &config)
 
- Static Protected Member Functions inherited from rev::BaseConfig
static std::optional< ParameterType_t > GetParameter (BaseConfig &fromConfig, uint8_t parameterId)
 
static void RemoveParameter (BaseConfig &fromConfig, uint8_t parameterId)
 

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 & )
default

◆ 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

◆ 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 is 8.

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 is 10ms (sample delta 20).

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: