59 Encoder(
int aChannel,
int bChannel,
bool reverseDirection =
false,
77 int Get()
const override;
98 [[deprecated(
"Use GetRate() in favor of this method")]]
117 "Use SetMinRate() in favor of this method. This takes unscaled periods "
118 "and SetMinRate() scales using value from SetDistancePerPulse().")]]
271 void InitEncoder(
int aChannel,
int bChannel,
bool reverseDirection,
278 double DecodingScaleFactor()
const;
Interface for counting the number of ticks on a digital input channel.
Definition CounterBase.h:20
EncodingType
Definition CounterBase.h:22
@ k4X
Definition CounterBase.h:22
Class to read quad encoders.
Definition Encoder.h:34
int GetRaw() const
Gets the raw value from the encoder.
Encoder(int aChannel, int bChannel, bool reverseDirection=false, EncodingType encodingType=k4X)
Encoder constructor.
bool GetDirection() const override
The last direction the encoder value changed.
void SetMinRate(double minRate)
Set the minimum rate of the device before the hardware reports it stopped.
int Get() const override
Gets the current count.
void SetReverseDirection(bool reverseDirection)
Set the direction sensing for this encoder.
int GetEncodingScale() const
The encoding scale factor 1x, 2x, or 4x, per the requested encodingType.
void InitSendable(wpi::SendableBuilder &builder) override
Initializes this Sendable object.
void Reset() override
Reset the Encoder distance to zero.
double GetRate() const
Get the current rate of the encoder.
void SetSimDevice(HAL_SimDeviceHandle device)
Indicates this encoder is used by a simulated device.
void SetSamplesToAverage(int samplesToAverage)
Set the Samples to Average which specifies the number of samples of the timer to average when calcula...
int GetSamplesToAverage() const
Get the Samples to Average which specifies the number of samples of the timer to average when calcula...
void SetMaxPeriod(units::second_t maxPeriod) override
Sets the maximum period for stopped detection.
Encoder & operator=(Encoder &&)=default
void SetDistancePerPulse(double distancePerPulse)
Set the distance per pulse for this encoder.
bool GetStopped() const override
Determine if the encoder is stopped.
~Encoder() override=default
double GetDistance() const
Get the distance the robot has driven since the last reset.
double GetDistancePerPulse() const
Get the distance per pulse for this encoder.
units::second_t GetPeriod() const override
Returns the period of the most recent pulse.
Encoder(Encoder &&)=default
A move-only C++ wrapper around a HAL handle.
Definition Types.h:98
Helper class for building Sendable dashboard representations.
Definition SendableBuilder.h:21
A helper class for use with objects that add themselves to SendableRegistry.
Definition SendableHelper.h:21
Interface for Sendable objects.
Definition Sendable.h:16
HAL_Handle HAL_SimDeviceHandle
Definition Types.h:51
Definition SystemServer.h:9