|
Fang-Robotics-MCB
Fang Robotics Team Codebase
|
#include <wrapped_encoder.hpp>


Public Member Functions | |
| WrappedEncoder (bool isInverted, uint32_t encoderResolution, float gearRatio=1, uint32_t encoderHomePosition=0) | |
| void | initialize () override |
| tap::algorithms::WrappedFloat | getPosition () const override |
| mockable tap::algorithms::WrappedFloat | getEncoder () const |
| float | getVelocity () const override |
| void | alignWith (EncoderInterface *other) override |
| void | resetEncoderValue () override |
Public Member Functions inherited from tap::encoder::EncoderInterface | |
| virtual bool | isOnline () const =0 |
Protected Member Functions | |
| void | updateEncoderValue (uint32_t encoderActual) |
Protected Attributes | |
| tap::algorithms::WrappedFloat | encoder |
| tap::algorithms::WrappedFloat | position |
| bool | inverted |
| const uint32_t | encoderResolution |
| const float | gearRatio |
Represents an encoder that reports its values as a wrapped number of ticks.
| tap::encoder::WrappedEncoder::WrappedEncoder | ( | bool | isInverted, |
| uint32_t | encoderResolution, | ||
| float | gearRatio = 1, |
||
| uint32_t | encoderHomePosition = 0 |
||
| ) |
| isInverted | if false the positive rotation direction of the shaft is counter-clockwise when looking at the shaft from. If true then 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. |
|
overridevirtual |
Aligns this encoder to another encoder so that their positions are equal. If the two encoders are mechanically linked, they would then continue to report the same position.
Implements tap::encoder::EncoderInterface.
|
inline |
Gets the raw encoder position.
|
overridevirtual |
Gets the current position of the encoder, in a wrapped float on the range [0, M_TWOPI)
Implements tap::encoder::EncoderInterface.
|
overridevirtual |
Gets the current velocity reported by the encoder. Returned in a value of radians / second
Implements tap::encoder::EncoderInterface.
|
inlineoverridevirtual |
Initialize the encoder. For instance: attaching a can receiver.
Implements tap::encoder::EncoderInterface.
|
overridevirtual |
Zeros the encoder to its current position. All encoder positions will be based from this position.
Implements tap::encoder::EncoderInterface.
|
protected |
Updates the stored encoder value given a newly received encoder value special logic necessary for keeping track of unwrapped encoder value.
|
protected |
The current encoder position.
|
protected |
|
protected |
|
protected |
|
protected |
The encoder position converted into output rotations