Template Class MultiEncoder

Inheritance Relationships

Base Type

Class Documentation

template<uint32_t COUNT>
class MultiEncoder : public tap::encoder::EncoderInterface

A way to combine multiple encoders into one functional unit. The first encoder in the array must not be null, as it is the primary encoder. All other values can be null. This encoder uses the primary encoder as an initial source of truth. This allows the other encoders to align themselves to it, and then have the primary encoder disconnect with the system still working. This encoder is not valid until the primary encoder comes online, and stays online until either all synced encoders disconnect, or the primary encoder is offline and no other encoders have been synced. The positions returned by this encoder are averaged between all synced and online encoders.

Public Functions

inline MultiEncoder(std::array<EncoderInterface*, COUNT> encoders)
inline virtual void initialize() override
inline virtual bool isOnline() const override
inline virtual tap::algorithms::WrappedFloat getPosition() const override
inline virtual float getVelocity() const override
inline virtual void resetEncoderValue() override
inline virtual void alignWith(EncoderInterface *other) override