yarp-devices
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
roboticslab::InterpolatedPositionBuffer Class Referenceabstract

Base class for a PT/PVT buffer of setpoints. More...

#include <InterpolatedPositionBuffer.hpp>

Inheritance diagram for roboticslab::InterpolatedPositionBuffer:
roboticslab::PtBuffer roboticslab::PvtBuffer

Public Member Functions

 InterpolatedPositionBuffer (double samplingPeriod, double interpolationPeriod)
 Constructor, sets internal invariable parameters.
 
virtual ~InterpolatedPositionBuffer ()=default
 Virtual destructor.
 
void setInitial (int initialTarget)
 Store initial position (internal units).
 
int getPeriodMs () const
 Get PT/PVT period if fixed (synchronous), zero otherwise (asynchronous).
 
virtual std::uint16_t getBufferSize () const =0
 Get PT/PVT buffer size.
 
std::uint16_t getBufferConfig () const
 Get buffer configuration (object 2074h).
 
virtual std::int16_t getSubMode () const =0
 Generate interpolation submode register value (object 60C0h).
 
void addSetpoint (int target)
 Place a new setpoint (internal units) at the end of the queue.
 
std::vector< std::uint64_t > popBatch (bool fullBuffer)
 Generate next batch of setpoints popped from the front of the queue.
 
int getPrevTarget () const
 Retrieve last point loaded into the buffer (internal units).
 
bool isQueueReady () const
 Report whether there are enough points in the queue to fill the buffer.
 
bool isQueueEmpty () const
 Report whether there are no more points in the queue.
 
void clearQueue ()
 Clear internal queue.
 

Protected Types

using ip_record = std::pair< int, double >
 

Protected Member Functions

std::uint8_t getIntegrityCounter () const
 Retrieve current integrity counter value.
 
virtual std::size_t getOffset () const
 Determine how many points should be left in the queue on each non-final batch update.
 
std::uint16_t getSampledTime (double currentTimestamp)
 Obtain time samples (internal units) for current segment, update internal counters.
 
double getMeanVelocity (const ip_record &earliest, const ip_record &latest) const
 Compute mean velocity (internal units) between two setpoints.
 
virtual std::uint64_t makeDataRecord (const ip_record &previous, const ip_record &current, const ip_record &next)=0
 Generate interpolation data record given three contiguous position target (object 60C1h).
 

Protected Attributes

const double samplingPeriod
 

Private Attributes

const std::uint16_t fixedSamples
 
std::uint8_t integrityCounter
 
ip_record prevTarget
 
double initialTimestamp
 
int sampleCount
 
std::deque< ip_record > pendingTargets
 
std::mutex queueMutex
 

Detailed Description

Stores an internal queue of setpoints aimed to be processed in batches on demand by client code.


The documentation for this class was generated from the following files: