10#include "wpi/units/frequency.hpp"
11#include "wpi/units/time.hpp"
182 void Init(
double fullRange,
double expectedZero);
183 double MapSensorRange(
double pos)
const;
185 std::shared_ptr<DutyCycle> m_dutyCycle;
186 wpi::units::hertz_t m_frequencyThreshold = {100_Hz};
188 double m_expectedZero;
189 wpi::units::second_t m_period{0_s};
190 double m_sensorMin{0.0};
191 double m_sensorMax{1.0};
192 bool m_isInverted{
false};
194 wpi::hal::SimDevice m_simDevice;
195 wpi::hal::SimDouble m_simPosition;
196 wpi::hal::SimBoolean m_simIsConnected;
DutyCycleEncoder(DutyCycleEncoder &&)=default
DutyCycleEncoder(DutyCycle *dutyCycle, double fullRange, double expectedZero)
Construct a new DutyCycleEncoder attached to an existing DutyCycle object.
DutyCycleEncoder(int channel)
Construct a new DutyCycleEncoder on a specific channel.
void SetConnectedFrequencyThreshold(wpi::units::hertz_t frequency)
Change the frequency threshold for detecting connection used by IsConnected.
bool IsConnected() const
Get if the sensor is connected.
void InitSendable(wpi::util::SendableBuilder &builder) override
Initializes this Sendable object.
DutyCycleEncoder(std::shared_ptr< DutyCycle > dutyCycle)
Construct a new DutyCycleEncoder attached to an existing DutyCycle object.
double Get() const
Get the encoder value.
DutyCycleEncoder & operator=(DutyCycleEncoder &&)=default
DutyCycleEncoder(int channel, double fullRange, double expectedZero)
Construct a new DutyCycleEncoder on a specific channel.
DutyCycleEncoder(DutyCycle &dutyCycle, double fullRange, double expectedZero)
Construct a new DutyCycleEncoder attached to an existing DutyCycle object.
void SetAssumedFrequency(wpi::units::hertz_t frequency)
Sets the assumed frequency of the connected device.
~DutyCycleEncoder() override=default
int GetSourceChannel() const
Get the channel of the source.
void SetDutyCycleRange(double min, double max)
Set the encoder duty cycle range.
wpi::units::hertz_t GetFrequency() const
Get the frequency of the duty cycle signal from the encoder.
void SetInverted(bool inverted)
Set if this encoder is inverted.
DutyCycleEncoder(DutyCycle &dutyCycle)
Construct a new DutyCycleEncoder attached to an existing DutyCycle object.
DutyCycleEncoder(DutyCycle *dutyCycle)
Construct a new DutyCycleEncoder attached to an existing DutyCycle object.
DutyCycleEncoder(std::shared_ptr< DutyCycle > dutyCycle, double fullRange, double expectedZero)
Construct a new DutyCycleEncoder attached to an existing DutyCycle object.
Class to read a duty cycle PWM input.
Definition DutyCycle.hpp:23
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
Definition CvSource.hpp:15