#pragma once #include "Thing.h" namespace RoboidControl { /// @brief An Incremental Encoder measures the rotations of an axle using a /// rotary sensor. Some encoders are able to detect direction, while others can /// not. class RelativeEncoder : public Thing { public: /// @brief Creates a sensor which measures distance from pulses /// @param pulsesPerRevolution The number of pulse edges which make a /// full rotation /// @param distancePerRevolution The distance a wheel travels per full /// rotation RelativeEncoder(Participant* owner); // RelativeEncoder(Thing* parent); RelativeEncoder(Thing* parent = Thing::LocalRoot()); /// @brief Get the rotation speed /// @return The speed in revolutions per second virtual float GetRotationSpeed(); float rotationSpeed; /// @brief Function used to generate binary data for this touch sensor /// @param buffer The byte array for thw binary data /// @param ix The starting position for writing the binary data int GenerateBinary(char* bytes, unsigned char* ix) override; /// @brief Function used to process binary data received for this touch sensor /// @param bytes The binary data to process virtual void ProcessBinary(char* bytes) override; protected: /// @brief rotation speed in revolutions per second //float _rotationSpeed; }; } // namespace RoboidControl