72 units::turn_t
Get()
const;
148 std::shared_ptr<AnalogInput> m_analogInput;
151 double m_positionOffset = 0;
152 double m_distancePerRotation = 1.0;
153 mutable units::turn_t m_lastPosition{0.0};
155 hal::SimDevice m_simDevice;
156 hal::SimDouble m_simPosition;
157 hal::SimDouble m_simAbsolutePosition;
Class for supporting continuous analog encoders, such as the US Digital MA3.
Definition: AnalogEncoder.h:25
void InitSendable(wpi::SendableBuilder &builder) override
Initializes this Sendable object.
AnalogEncoder & operator=(AnalogEncoder &&)=default
double GetPositionOffset() const
Get the offset of position relative to the last reset.
double GetDistance() const
Get the distance the sensor has driven since the last reset as scaled by the value from SetDistancePe...
void SetDistancePerRotation(double distancePerRotation)
Set the distance per rotation of the encoder.
AnalogEncoder(int channel)
Construct a new AnalogEncoder attached to a specific AnalogIn channel.
double GetAbsolutePosition() const
Get the absolute position of the analog encoder.
int GetChannel() const
Get the channel number.
AnalogEncoder(AnalogInput &analogInput)
Construct a new AnalogEncoder attached to a specific AnalogInput.
AnalogEncoder(AnalogInput *analogInput)
Construct a new AnalogEncoder attached to a specific AnalogInput.
void SetPositionOffset(double offset)
Set the position offset.
~AnalogEncoder() override=default
AnalogEncoder(std::shared_ptr< AnalogInput > analogInput)
Construct a new AnalogEncoder attached to a specific AnalogInput.
units::turn_t Get() const
Get the encoder value since the last reset.
AnalogEncoder(AnalogEncoder &&)=default
void Reset()
Reset the Encoder distance to zero.
double GetDistancePerRotation() const
Get the distance per rotation for this encoder.
Definition: AnalogTrigger.h:21
Class for counting the number of ticks on a digital input channel.
Definition: Counter.h:35
Definition: SendableBuilder.h:18
A helper class for use with objects that add themselves to SendableRegistry.
Definition: SendableHelper.h:19
Interface for Sendable objects.
Definition: Sendable.h:16
Definition: AprilTagFieldLayout.h:22