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