122 units::turn_t
Get()
const;
219 double MapSensorRange(
double pos)
const;
221 std::shared_ptr<DutyCycle> m_dutyCycle;
222 std::unique_ptr<AnalogTrigger> m_analogTrigger;
223 std::unique_ptr<Counter> m_counter;
224 int m_frequencyThreshold = 100;
225 double m_positionOffset = 0;
226 double m_distancePerRotation = 1.0;
227 mutable units::turn_t m_lastPosition{0.0};
228 double m_sensorMin = 0;
229 double m_sensorMax = 1;
DigitalSource Interface.
Definition: DigitalSource.h:22
Class for supporting duty cycle/PWM encoders, such as the US Digital MA3 with PWM Output,...
Definition: DutyCycleEncoder.h:28
DutyCycleEncoder(std::shared_ptr< DigitalSource > digitalSource)
Construct a new DutyCycleEncoder attached to a DigitalSource object.
DutyCycleEncoder(DutyCycle &dutyCycle)
Construct a new DutyCycleEncoder attached to an existing DutyCycle object.
double GetAbsolutePosition() const
Get the absolute position of the duty cycle encoder encoder.
DutyCycleEncoder(DutyCycle *dutyCycle)
Construct a new DutyCycleEncoder attached to an existing DutyCycle object.
double GetDistance() const
Get the distance the sensor has driven since the last reset as scaled by the value from SetDistancePe...
bool IsConnected() const
Get if the sensor is connected.
DutyCycleEncoder(DigitalSource &digitalSource)
Construct a new DutyCycleEncoder attached to a DigitalSource object.
void SetPositionOffset(double offset)
Set the position offset.
DutyCycleEncoder(DigitalSource *digitalSource)
Construct a new DutyCycleEncoder attached to a DigitalSource object.
double GetDistancePerRotation() const
Get the distance per rotation for this encoder.
~DutyCycleEncoder() override=default
int GetFrequency() const
Get the frequency in Hz of the duty cycle signal from the encoder.
int GetSourceChannel() const
Get the channel of the source.
void SetDistancePerRotation(double distancePerRotation)
Set the distance per rotation of the encoder.
int GetFPGAIndex() const
Get the FPGA index for the DutyCycleEncoder.
DutyCycleEncoder(std::shared_ptr< DutyCycle > dutyCycle)
Construct a new DutyCycleEncoder attached to an existing DutyCycle object.
void InitSendable(wpi::SendableBuilder &builder) override
Initializes this Sendable object.
units::turn_t Get() const
Get the encoder value since the last reset.
DutyCycleEncoder & operator=(DutyCycleEncoder &&)=default
double GetPositionOffset() const
Get the offset of position relative to the last reset.
void Reset()
Reset the Encoder distance to zero.
void SetDutyCycleRange(double min, double max)
Set the encoder duty cycle range.
void SetConnectedFrequencyThreshold(int frequency)
Change the frequency threshold for detecting connection used by IsConnected.
DutyCycleEncoder(int channel)
Construct a new DutyCycleEncoder on a specific channel.
DutyCycleEncoder(DutyCycleEncoder &&)=default
Class to read a duty cycle PWM input.
Definition: DutyCycle.h:31
C++ wrapper around a HAL simulator boolean value handle.
Definition: SimDevice.h:608
A move-only C++ wrapper around a HAL simulator device handle.
Definition: SimDevice.h:642
C++ wrapper around a HAL simulator double value handle.
Definition: SimDevice.h:533
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:19
Interface for Sendable objects.
Definition: Sendable.h:16
Definition: AprilTagPoseEstimator.h:15
UnitTypeLhs() max(const UnitTypeLhs &lhs, const UnitTypeRhs &rhs)
Definition: base.h:3417
UnitTypeLhs() min(const UnitTypeLhs &lhs, const UnitTypeRhs &rhs)
Definition: base.h:3409