REVLib - C++
|
#include <RelativeEncoder.h>
Inherits rev::CANEncoder.
Inherited by rev::SparkFlexExternalEncoder, rev::SparkMaxAlternateEncoder, and rev::SparkMaxRelativeEncoder.
Public Member Functions | |
virtual | ~RelativeEncoder () |
double | GetPosition () const override=0 |
double | GetVelocity () const override=0 |
REVLibError | SetPosition (double position) override=0 |
REVLibError | SetPositionConversionFactor (double factor) override=0 |
REVLibError | SetVelocityConversionFactor (double factor) override=0 |
double | GetPositionConversionFactor () const override=0 |
double | GetVelocityConversionFactor () const override=0 |
REVLibError | SetAverageDepth (uint32_t depth) override=0 |
REVLibError | SetMeasurementPeriod (uint32_t period_ms) override=0 |
uint32_t | GetAverageDepth () const override=0 |
uint32_t | GetMeasurementPeriod () const override=0 |
uint32_t | GetCountsPerRevolution () const override=0 |
REVLibError | SetInverted (bool inverted) override=0 |
bool | GetInverted () const override=0 |
Public Member Functions inherited from rev::CANEncoder | |
virtual | ~CANEncoder () |
Public Member Functions inherited from rev::MotorFeedbackSensor | |
virtual | ~MotorFeedbackSensor () |
Public Member Functions inherited from rev::CANSensor | |
virtual | ~CANSensor () |
Friends | |
class | SparkMaxAlternateEncoder |
class | SparkMaxRelativeEncoder |
class | SparkFlexExternalEncoder |
Additional Inherited Members | |
Public Types inherited from rev::CANEncoder | |
enum class | EncoderType { kNoSensor = 0 , kHallSensor = 1 , kQuadrature = 2 } |
enum class | AlternateEncoderType { kQuadrature } |
|
inlinevirtual |
|
overridepure virtual |
Get the position of the motor. This returns the native units of 'rotations' by default, and can be changed by a scale factor using setPositionConversionFactor().
Implements rev::CANEncoder.
Implemented in rev::SparkFlexExternalEncoder, rev::SparkMaxAlternateEncoder, and rev::SparkMaxRelativeEncoder.
|
overridepure virtual |
Get the velocity of the motor. This returns the native units of 'RPM' by default, and can be changed by a scale factor using setVelocityConversionFactor().
Implements rev::CANEncoder.
Implemented in rev::SparkFlexExternalEncoder, rev::SparkMaxAlternateEncoder, and rev::SparkMaxRelativeEncoder.
|
overridepure virtual |
Set the position of the encoder.
position | Number of rotations of the motor |
Implements rev::CANEncoder.
Implemented in rev::SparkFlexExternalEncoder, rev::SparkMaxAlternateEncoder, and rev::SparkMaxRelativeEncoder.
|
overridepure virtual |
Set the conversion factor for position of the encoder. Multiplied by the native output units to give you position
factor | The conversion factor to multiply the native units by |
Implements rev::CANEncoder.
Implemented in rev::SparkFlexExternalEncoder, rev::SparkMaxAlternateEncoder, and rev::SparkMaxRelativeEncoder.
|
overridepure virtual |
Set the conversion factor for velocity of the encoder. Multiplied by the native output units to give you velocity
factor | The conversion factor to multiply the native units by |
Implements rev::CANEncoder.
Implemented in rev::SparkFlexExternalEncoder, rev::SparkMaxAlternateEncoder, and rev::SparkMaxRelativeEncoder.
|
overridepure virtual |
Get the conversion factor for position of the encoder. Multiplied by the native output units to give you position
Implements rev::CANEncoder.
Implemented in rev::SparkFlexExternalEncoder, rev::SparkMaxAlternateEncoder, and rev::SparkMaxRelativeEncoder.
|
overridepure virtual |
Get the conversion factor for velocity of the encoder. Multiplied by the native output units to give you velocity
Implements rev::CANEncoder.
Implemented in rev::SparkFlexExternalEncoder, rev::SparkMaxAlternateEncoder, and rev::SparkMaxRelativeEncoder.
|
overridepure virtual |
Set the sampling depth of the velocity calculation process for a quadrature or hall sensor 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). For a hall sensor, it must be either 1, 2, 4, or 8 (default).
depth | The velocity calculation process's sampling depth |
Implements rev::CANEncoder.
Implemented in rev::SparkFlexExternalEncoder, rev::SparkMaxAlternateEncoder, and rev::SparkMaxRelativeEncoder.
|
overridepure virtual |
Set the position measurement period used to calculate the velocity of a quadrature or hall sensor encoder. For a quadrature encoder, this number may be between 1 and 100 (default). For a hall sensor, this number may be between 8 and 64. The default for a hall sensor is 32ms.
The basic formula to calculate velocity is change in position / change in time. This parameter sets the change in time for measurement.
period_ms | Measurement period in milliseconds |
Implements rev::CANEncoder.
Implemented in rev::SparkFlexExternalEncoder, rev::SparkMaxAlternateEncoder, and rev::SparkMaxRelativeEncoder.
|
overridepure virtual |
Get the velocity calculation process's sampling depth for a quadrature or hall sensor encoder.
Implements rev::CANEncoder.
Implemented in rev::SparkFlexExternalEncoder, rev::SparkMaxAlternateEncoder, and rev::SparkMaxRelativeEncoder.
|
overridepure virtual |
Get the position measurement period used to calculate the velocity of a quadrature or hall sensor encoder.
Implements rev::CANEncoder.
Implemented in rev::SparkFlexExternalEncoder, rev::SparkMaxAlternateEncoder, and rev::SparkMaxRelativeEncoder.
|
overridepure virtual |
Get the counts per revolution of the quadrature encoder.
For a description on the difference between CPR, PPR, etc. go to https://www.cuidevices.com/blog/what-is-encoder-ppr-cpr-and-lpr
Implements rev::CANEncoder.
Implemented in rev::SparkFlexExternalEncoder, rev::SparkMaxAlternateEncoder, and rev::SparkMaxRelativeEncoder.
|
overridepure virtual |
Set the phase of the MotorFeedbackSensor so that it is set to be in phase with the motor itself. This only works for quadrature encoders. This will throw an error if the user tries to set inverted while the SparkMax is Brushless and using the hall effect sensor.
inverted | The phase of the encoder |
Implements rev::CANEncoder.
Implemented in rev::SparkFlexExternalEncoder, rev::SparkMaxAlternateEncoder, and rev::SparkMaxRelativeEncoder.
|
overridepure virtual |
Get the phase of the MotorFeedbackSensor. This will just return false if the user tries to get inverted while the SparkMax is Brushless and using the hall effect sensor.
Implements rev::CANEncoder.
Implemented in rev::SparkFlexExternalEncoder, rev::SparkMaxAlternateEncoder, and rev::SparkMaxRelativeEncoder.
|
friend |
|
friend |
|
friend |