WPILibC++ 2025.2.1
|
Class for supporting continuous analog encoders, such as the US Digital MA3. More...
#include <frc/AnalogEncoder.h>
Public Member Functions | |
AnalogEncoder (int channel) | |
Construct a new AnalogEncoder attached to a specific AnalogIn channel. | |
AnalogEncoder (AnalogInput &analogInput) | |
Construct a new AnalogEncoder attached to a specific AnalogInput. | |
AnalogEncoder (AnalogInput *analogInput) | |
Construct a new AnalogEncoder attached to a specific AnalogInput. | |
AnalogEncoder (std::shared_ptr< AnalogInput > analogInput) | |
Construct a new AnalogEncoder attached to a specific AnalogInput. | |
AnalogEncoder (int channel, double fullRange, double expectedZero) | |
Construct a new AnalogEncoder attached to a specific AnalogIn channel. | |
AnalogEncoder (AnalogInput &analogInput, double fullRange, double expectedZero) | |
Construct a new AnalogEncoder attached to a specific AnalogInput. | |
AnalogEncoder (AnalogInput *analogInput, double fullRange, double expectedZero) | |
Construct a new AnalogEncoder attached to a specific AnalogInput. | |
AnalogEncoder (std::shared_ptr< AnalogInput > analogInput, double fullRange, double expectedZero) | |
Construct a new AnalogEncoder attached to a specific AnalogInput. | |
~AnalogEncoder () override | |
AnalogEncoder (AnalogEncoder &&)=default | |
AnalogEncoder & | operator= (AnalogEncoder &&)=default |
double | Get () const |
Get the encoder value. | |
void | SetVoltagePercentageRange (double min, double max) |
Set the encoder voltage percentage range. | |
void | SetInverted (bool inverted) |
Set if this encoder is inverted. | |
int | GetChannel () const |
Get the channel number. | |
void | InitSendable (wpi::SendableBuilder &builder) override |
Initializes this Sendable object. | |
Public Member Functions inherited from wpi::Sendable | |
virtual constexpr | ~Sendable ()=default |
Public Member Functions inherited from wpi::SendableHelper< AnalogEncoder > | |
constexpr | SendableHelper (const SendableHelper &rhs)=default |
constexpr | SendableHelper (SendableHelper &&rhs) |
constexpr SendableHelper & | operator= (const SendableHelper &rhs)=default |
constexpr SendableHelper & | operator= (SendableHelper &&rhs) |
Additional Inherited Members | |
Protected Member Functions inherited from wpi::SendableHelper< AnalogEncoder > | |
constexpr | SendableHelper ()=default |
constexpr | ~SendableHelper () |
Class for supporting continuous analog encoders, such as the US Digital MA3.
|
explicit |
Construct a new AnalogEncoder attached to a specific AnalogIn channel.
This has a fullRange of 1 and an expectedZero of 0.
channel | the analog input channel to attach to |
|
explicit |
Construct a new AnalogEncoder attached to a specific AnalogInput.
This has a fullRange of 1 and an expectedZero of 0.
analogInput | the analog input to attach to |
|
explicit |
Construct a new AnalogEncoder attached to a specific AnalogInput.
This has a fullRange of 1 and an expectedZero of 0.
analogInput | the analog input to attach to |
|
explicit |
Construct a new AnalogEncoder attached to a specific AnalogInput.
This has a fullRange of 1 and an expectedZero of 0.
analogInput | the analog input to attach to |
frc::AnalogEncoder::AnalogEncoder | ( | int | channel, |
double | fullRange, | ||
double | expectedZero ) |
Construct a new AnalogEncoder attached to a specific AnalogIn channel.
channel | the analog input channel to attach to |
fullRange | the value to report at maximum travel |
expectedZero | the reading where you would expect a 0 from get() |
frc::AnalogEncoder::AnalogEncoder | ( | AnalogInput & | analogInput, |
double | fullRange, | ||
double | expectedZero ) |
Construct a new AnalogEncoder attached to a specific AnalogInput.
analogInput | the analog input to attach to |
fullRange | the value to report at maximum travel |
expectedZero | the reading where you would expect a 0 from get() |
frc::AnalogEncoder::AnalogEncoder | ( | AnalogInput * | analogInput, |
double | fullRange, | ||
double | expectedZero ) |
Construct a new AnalogEncoder attached to a specific AnalogInput.
analogInput | the analog input to attach to |
fullRange | the value to report at maximum travel |
expectedZero | the reading where you would expect a 0 from get() |
frc::AnalogEncoder::AnalogEncoder | ( | std::shared_ptr< AnalogInput > | analogInput, |
double | fullRange, | ||
double | expectedZero ) |
Construct a new AnalogEncoder attached to a specific AnalogInput.
analogInput | the analog input to attach to |
fullRange | the value to report at maximum travel |
expectedZero | the reading where you would expect a 0 from get() |
|
override |
|
default |
double frc::AnalogEncoder::Get | ( | ) | const |
Get the encoder value.
int frc::AnalogEncoder::GetChannel | ( | ) | const |
Get the channel number.
|
overridevirtual |
|
default |
void frc::AnalogEncoder::SetInverted | ( | bool | inverted | ) |
Set if this encoder is inverted.
inverted | true to invert the encoder, false otherwise |
void frc::AnalogEncoder::SetVoltagePercentageRange | ( | double | min, |
double | max ) |
Set the encoder voltage percentage range.
Analog sensors are not always fully stable at the end of their travel ranges. Shrinking this range down can help mitigate issues with that.
min | minimum voltage percentage (0-1 range) |
max | maximum voltage percentage (0-1 range) |