yarp-devices
|
Stores last encoder reads, obtains mean speeds and accelerations via differentiation.
#include <EncoderRead.hpp>
Public Member Functions | |
EncoderRead (double samplingPeriod) | |
Constructor. | |
void | update (std::int32_t newPos) |
Set new position (counts), update speeds (counts/sample) and accelerations (counts/sample^2). | |
void | reset (std::int32_t pos=0) |
Reset internals to zero, pick provided position (encoder counts). | |
std::int32_t | queryPosition () const |
Retrieve current position (encoder counts). | |
double | querySpeed () const |
Retrieve instantaneous speed (encoder counts/sample). | |
double | queryAcceleration () const |
Retrieve instantaneous acceleration (encoder counts/sample^2). | |
double | queryTime () const |
Retrieve last timestamp (seconds). | |
Private Attributes | |
const double | samplingFreq |
std::int32_t | lastPosition |
double | lastSpeed |
double | lastAcceleration |
yarp::os::Stamp | lastStamp |
std::mutex | encoderMutex |