#include <CANAnalog.h>
Inherits rev::MotorFeedbackSensor.
Inherited by rev::SparkMaxAnalogSensor.
◆ AnalogMode
Analog sensors have the ability to either be absolute or relative. By default, GetAnalog() will return an absolute analog sensor, but it can also be configured to be a relative sensor instead.
- Deprecated:
- Use SparkMaxAnalogSensor::Mode instead
Enumerator |
---|
kAbsolute | |
kRelative | |
◆ ~CANAnalog()
virtual rev::CANAnalog::~CANAnalog |
( |
| ) |
|
|
inlinevirtual |
◆ GetVoltage()
virtual double rev::CANAnalog::GetVoltage |
( |
| ) |
const |
|
pure virtual |
◆ GetPosition()
virtual double rev::CANAnalog::GetPosition |
( |
| ) |
const |
|
pure virtual |
Get the position of the sensor. Returns value in the native unit of 'volt' by default, and can be changed by a scale factor using setPositionConversionFactor().
- Returns
- Position of the sensor in volts
Implemented in rev::SparkMaxAnalogSensor.
◆ GetVelocity()
virtual double rev::CANAnalog::GetVelocity |
( |
| ) |
const |
|
pure virtual |
Get the velocity of the sensor. Returns value in the native units of 'volts per second' by default, and can be changed by a scale factor using setVelocityConversionFactor().
- Returns
- Velocity of the sensor in volts per second
Implemented in rev::SparkMaxAnalogSensor.
◆ SetPositionConversionFactor()
virtual REVLibError rev::CANAnalog::SetPositionConversionFactor |
( |
double |
factor | ) |
|
|
pure virtual |
Set the conversion factor for the position of the analog sensor. By default, revolutions per volt is 1. Changing the position conversion factor will also change the position units.
- Parameters
-
factor | The conversion factor which will be multiplied by volts |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxAnalogSensor.
◆ GetPositionConversionFactor()
virtual double rev::CANAnalog::GetPositionConversionFactor |
( |
| ) |
const |
|
pure virtual |
Get the current conversion factor for the position of the analog sensor.
- Returns
- Analog position conversion factor
Implemented in rev::SparkMaxAnalogSensor.
◆ SetVelocityConversionFactor()
virtual REVLibError rev::CANAnalog::SetVelocityConversionFactor |
( |
double |
factor | ) |
|
|
pure virtual |
Set the conversion factor for the velocity of the analog sensor. By default, revolutions per volt second is 1. Changing the velocity conversion factor will also change the velocity units.
- Parameters
-
factor | The conversion factor which will be multipled by volts per second |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxAnalogSensor.
◆ GetVelocityConversionFactor()
virtual double rev::CANAnalog::GetVelocityConversionFactor |
( |
| ) |
const |
|
pure virtual |
Get the current conversion factor for the velocity of the analog sensor.
- Returns
- Analog velocity conversion factor
Implemented in rev::SparkMaxAnalogSensor.
◆ SetAverageDepth()
virtual REVLibError rev::CANAnalog::SetAverageDepth |
( |
uint32_t |
depth | ) |
|
|
pure virtual |
Set the number of samples in the average for velocity readings. This can be any value from 1 to 64.
When the SparkMax controller is in Brushless mode, this will not change any behavior.
- Parameters
-
depth | The average sampling depth between 1 and 64 (default) |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxAnalogSensor.
◆ SetMeasurementPeriod()
virtual REVLibError rev::CANAnalog::SetMeasurementPeriod |
( |
uint32_t |
period_ms | ) |
|
|
pure virtual |
Set the measurement period for velocity calculations.
The basic formula to calculate velocity is change in position / change in time. This parameter sets the change in time for measurement.
- Parameters
-
period_ms | Measurement period in milliseconds. This number may be between 1 and 100 (default). |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxAnalogSensor.
◆ GetAverageDepth()
virtual uint32_t rev::CANAnalog::GetAverageDepth |
( |
| ) |
const |
|
pure virtual |
Get the number of samples included in the average for velocity readings.
- Returns
- The average sampling depth
Implemented in rev::SparkMaxAnalogSensor.
◆ GetMeasurementPeriod()
virtual uint32_t rev::CANAnalog::GetMeasurementPeriod |
( |
| ) |
const |
|
pure virtual |
Get the measurement period used for velocity calculation.
- Returns
- Measurement period in microseconds
Implemented in rev::SparkMaxAnalogSensor.
◆ SetInverted()
REVLibError rev::CANAnalog::SetInverted |
( |
bool |
inverted | ) |
|
|
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.
- Parameters
-
inverted | The phase of the encoder |
- Returns
- REVLibError::kOk if successful
Implements rev::MotorFeedbackSensor.
Implemented in rev::SparkMaxAnalogSensor.
◆ GetInverted()
bool rev::CANAnalog::GetInverted |
( |
| ) |
const |
|
overridepure virtual |
◆ SparkMaxAnalogSensor
The documentation for this class was generated from the following file: