183 void Init(
double fullRange,
double expectedZero);
184 double MapSensorRange(
double pos)
const;
186 std::shared_ptr<DutyCycle> m_dutyCycle;
187 units::hertz_t m_frequencyThreshold = {100_Hz};
189 double m_expectedZero;
190 units::second_t m_period{0_s};
191 double m_sensorMin{0.0};
192 double m_sensorMax{1.0};
193 bool m_isInverted{
false};
Class for supporting duty cycle/PWM encoders, such as the US Digital MA3 with PWM Output,...
Definition DutyCycleEncoder.h:25
double Get() const
Get the encoder value.
DutyCycleEncoder(DutyCycle &dutyCycle)
Construct a new DutyCycleEncoder attached to an existing DutyCycle object.
DutyCycleEncoder(int channel, double fullRange, double expectedZero)
Construct a new DutyCycleEncoder on a specific channel.
DutyCycleEncoder(DutyCycle *dutyCycle)
Construct a new DutyCycleEncoder attached to an existing DutyCycle object.
DutyCycleEncoder(DutyCycle *dutyCycle, double fullRange, double expectedZero)
Construct a new DutyCycleEncoder attached to an existing DutyCycle object.
bool IsConnected() const
Get if the sensor is connected.
~DutyCycleEncoder() override=default
int GetSourceChannel() const
Get the channel of the source.
void SetInverted(bool inverted)
Set if this encoder is inverted.
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.
void SetConnectedFrequencyThreshold(units::hertz_t frequency)
Change the frequency threshold for detecting connection used by IsConnected.
DutyCycleEncoder & operator=(DutyCycleEncoder &&)=default
DutyCycleEncoder(DutyCycle &dutyCycle, double fullRange, double expectedZero)
Construct a new DutyCycleEncoder attached to an existing DutyCycle object.
units::hertz_t GetFrequency() const
Get the frequency of the duty cycle signal from the encoder.
void SetAssumedFrequency(units::hertz_t frequency)
Sets the assumed frequency of the connected device.
void SetDutyCycleRange(double min, double max)
Set the encoder duty cycle range.
DutyCycleEncoder(int channel)
Construct a new DutyCycleEncoder on a specific channel.
DutyCycleEncoder(std::shared_ptr< DutyCycle > dutyCycle, double fullRange, double expectedZero)
Construct a new DutyCycleEncoder attached to an existing DutyCycle object.
DutyCycleEncoder(DutyCycleEncoder &&)=default
Class to read a duty cycle PWM input.
Definition DutyCycle.h:24
C++ wrapper around a HAL simulator boolean value handle.
Definition SimDevice.h:611
A move-only C++ wrapper around a HAL simulator device handle.
Definition SimDevice.h:645
C++ wrapper around a HAL simulator double value handle.
Definition SimDevice.h:536
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
Definition SystemServer.h:9