Class WrappedEncoder¶
Defined in File wrapped_encoder.hpp
Inheritance Relationships¶
Base Type¶
public tap::encoder::EncoderInterface(Class EncoderInterface)
Derived Type¶
public tap::motor::DjiMotorEncoder(Class DjiMotorEncoder)
Class Documentation¶
-
class WrappedEncoder : public tap::encoder::EncoderInterface¶
Represents an encoder that reports its values as a wrapped number of ticks.
Subclassed by tap::motor::DjiMotorEncoder
Public Functions
-
WrappedEncoder(bool isInverted, uint32_t encoderResolution, float gearRatio = 1, uint32_t encoderHomePosition = 0)¶
- Parameters:
isInverted – if
falsethe positive rotation direction of the shaft is counter-clockwise when looking at the shaft from. Iftruethen the positive rotation direction will be clockwise.encoderResolution – the number of encoder ticks before the value wraps.
gearRatio – the ratio of input revolutions over output revolutions of this encoder.
encoderHomePosition – the zero position for the encoder in encoder ticks.
-
inline virtual void initialize() override¶
-
virtual tap::algorithms::WrappedFloat getPosition() const override¶
- inline mockable tap::algorithms::WrappedFloat getEncoder () const
Gets the raw encoder position.
-
virtual float getVelocity() const override¶
-
virtual void alignWith(EncoderInterface *other) override¶
-
virtual void resetEncoderValue() override¶
Protected Functions
-
void updateEncoderValue(uint32_t encoderActual)¶
Updates the stored encoder value given a newly received encoder value special logic necessary for keeping track of unwrapped encoder value.
Protected Attributes
-
tap::algorithms::WrappedFloat encoder¶
The current encoder position.
-
tap::algorithms::WrappedFloat position¶
The encoder position converted into output rotations
-
bool inverted¶
-
const uint32_t encoderResolution¶
-
const float gearRatio¶
-
WrappedEncoder(bool isInverted, uint32_t encoderResolution, float gearRatio = 1, uint32_t encoderHomePosition = 0)¶