12 #include <hal/SimDevice.h>
13 #include <hal/Types.h>
14 #include <units/units.h>
16 #include "frc/AnalogTrigger.h"
17 #include "frc/Counter.h"
18 #include "frc/ErrorBase.h"
19 #include "frc/smartdashboard/Sendable.h"
20 #include "frc/smartdashboard/SendableHelper.h"
127 units::turn_t
Get()
const;
162 std::shared_ptr<DutyCycle> m_dutyCycle;
165 int m_frequencyThreshold = 100;
166 double m_positionOffset = 0;
167 double m_distancePerRotation = 1.0;
168 mutable units::turn_t m_lastPosition{0.0};
170 hal::SimDevice m_simDevice;
171 hal::SimDouble m_simPosition;
172 hal::SimBoolean m_simIsConnected;
void SetConnectedFrequencyThreshold(int frequency)
Change the frequency threshold for detecting connection used by IsConnected.
int GetFrequency() const
Get the frequency in Hz of the duty cycle signal from the encoder.
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
void Reset()
Reset the Encoder distance to zero.
Definition: AnalogTrigger.h:25
Class for supporting duty cycle/PWM encoders, such as the US Digital MA3 with PWM Output,...
Definition: DutyCycleEncoder.h:31
void SetDistancePerRotation(double distancePerRotation)
Set the distance per rotation of the encoder.
Class to read a duty cycle PWM input.
Definition: DutyCycle.h:35
Base class for most objects.
Definition: ErrorBase.h:104
Interface for Sendable objects.
Definition: Sendable.h:17
units::turn_t Get() const
Get the encoder value since the last reset.
double GetDistancePerRotation() const
Get the distance per rotation for this encoder.
A class that enforces constraints on the differential drive kinematics.
Definition: SPIAccelerometerSim.h:16
bool IsConnected() const
Get if the sensor is connected.
double GetDistance() const
Get the distance the sensor has driven since the last reset as scaled by the value from SetDistancePe...
Class for counting the number of ticks on a digital input channel.
Definition: Counter.h:37
DutyCycleEncoder(int channel)
Construct a new DutyCycleEncoder on a specific channel.
DigitalSource Interface.
Definition: DigitalSource.h:25
A helper class for use with objects that add themselves to SendableRegistry.
Definition: SendableHelper.h:28
Definition: SendableBuilder.h:23