3 #ifndef __ENCODER_READ_HPP__
4 #define __ENCODER_READ_HPP__
10 #include <yarp/os/Stamp.h>
27 void update(std::int32_t newPos);
30 void reset(std::int32_t pos = 0);
45 const double samplingFreq;
46 std::int32_t lastPosition;
48 double lastAcceleration;
49 yarp::os::Stamp lastStamp;
50 mutable std::mutex encoderMutex;
Stores last encoder reads, obtains mean speeds and accelerations via differentiation.
Definition: EncoderRead.hpp:21
double queryTime() const
Retrieve last timestamp (seconds).
Definition: EncoderRead.cpp:72
void reset(std::int32_t pos=0)
Reset internals to zero, pick provided position (encoder counts).
Definition: EncoderRead.cpp:38
std::int32_t queryPosition() const
Retrieve current position (encoder counts).
Definition: EncoderRead.cpp:48
EncoderRead(double samplingPeriod)
Constructor.
Definition: EncoderRead.cpp:9
double queryAcceleration() const
Retrieve instantaneous acceleration (encoder counts/sample^2).
Definition: EncoderRead.cpp:64
double querySpeed() const
Retrieve instantaneous speed (encoder counts/sample).
Definition: EncoderRead.cpp:56
void update(std::int32_t newPos)
Set new position (counts), update speeds (counts/sample) and accelerations (counts/sample^2).
Definition: EncoderRead.cpp:20
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:6