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"
51 explicit AnalogEncoder(std::shared_ptr<AnalogInput> analogInput);
70 units::turn_t
Get()
const;
116 std::shared_ptr<AnalogInput> m_analogInput;
119 double m_positionOffset = 0;
120 double m_distancePerRotation = 1.0;
121 mutable units::turn_t m_lastPosition{0.0};
123 hal::SimDevice m_simDevice;
124 hal::SimDouble m_simPosition;
Definition: AnalogTrigger.h:25
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
void Reset()
Reset the Encoder distance to zero.
double GetDistancePerRotation() const
Get the distance per rotation for this encoder.
void SetDistancePerRotation(double distancePerRotation)
Set the distance per rotation of the encoder.
Base class for most objects.
Definition: ErrorBase.h:104
Class for supporting continuous analog encoders, such as the US Digital MA3.
Definition: AnalogEncoder.h:28
double GetPositionOffset() const
Get the offset of position relative to the last reset.
Interface for Sendable objects.
Definition: Sendable.h:17
double GetDistance() const
Get the distance the sensor has driven since the last reset as scaled by the value from SetDistancePe...
A class that enforces constraints on the differential drive kinematics.
Definition: SPIAccelerometerSim.h:16
AnalogEncoder(AnalogInput &analogInput)
Construct a new AnalogEncoder attached to a specific AnalogInput.
units::turn_t Get() const
Get the encoder value since the last reset.
Class for counting the number of ticks on a digital input channel.
Definition: Counter.h:37
A helper class for use with objects that add themselves to SendableRegistry.
Definition: SendableHelper.h:28
Definition: SendableBuilder.h:23