5 #pragma warning(disable : 4996) 60 bool UpdatePLL(uint32_t sec, uint32_t nanoSec, uint32_t curtick);
156 bool PushIntoFifo(
double curTimeStamp, uint32_t curtick);
186 SoftwarePLL(
int fifo_length = 7) : FifoSize_(fifo_length), TickFifo_(fifo_length,0), ClockFifo_(fifo_length,0), IsInitialized_(false), FirstTimeStamp_(0), FirstTick_(0), InterpolationSlope_(0)
189 NumberValInFifo_ = 0;
bool NearSameTimeStamp(double relTimeStamp1, double relTimeStamp2)
static SoftwarePLL & Instance(const std::string &id="", int fifo_length=7)
Creates an instance of SoftwarePLL or returns an existing one, given its id.
class SoftwarePLL implements synchronisation between ticks and timestamp. See https://github.com/michael1309/SoftwarePLL/blob/master/README.md for details.
bool PushIntoFifo(double curTimeStamp, uint32_t curtick)
Pushes measurement timestamp and sensor ticks to the fifo, updates tick fifo and clock (timestamp) fi...
void AllowedTimeDeviation(double val)
Set the max. allowed time difference between estimated and measured receive timestamp in seconds...
void InterpolationSlope(double val)
Sets the interpolated slope (gradient of the regression line)
bool GetCorrectedTimeStamp(uint32_t &sec, uint32_t &nanoSec, uint32_t tick)
Computes the timestamp of a measurement from sensor ticks.
void FirstTimeStamp(double val)
Sets the first timestamp in the fifo buffer in seconds.
double ExtraPolateRelativeTimeStamp(uint32_t tick)
Extrapolates and returns the measurement timestamp in seconds relative to FirstTimeStamp. The timestamp of a measurement in seconds can be estimated from sensor ticks by ExtraPolateRelativeTimeStamp(tick) + FirstTimeStamp().
std::vector< uint32_t > TickFifo_
uint32_t ExtrapolationDivergenceCounter() const
Returns the counter of extrapolated divergences (number of times the estimated and measured receive t...
static const uint32_t MaxExtrapolationCounter_
void ExtrapolationDivergenceCounter(uint32_t val)
Sets the counter of extrapolated divergences (number of times the estimated and measured receive time...
bool UpdatePLL(uint32_t sec, uint32_t nanoSec, uint32_t curtick)
Updates PLL internale State should be called only with network send timestamps.
bool IsInitialized() const
Returns the initialization status, i.e. true, if SoftwarePLL is initialized, or false otherwise (inco...
double AllowedTimeDeviation() const
Returns the max. allowed time difference between estimated and measured timestamp time in seconds...
SoftwarePLL & operator=(const SoftwarePLL &)
double InterpolationSlope() const
Returns the interpolated slope (gradient of the regression line)
double FirstTimeStamp() const
Returns the first timestamp in the fifo buffer in seconds.
double AllowedTimeDeviation_
bool UpdateInterpolationSlope()
uint64_t FirstTick() const
Returns the first sensor tick in the fifo buffer.
std::vector< double > ClockFifo_
uint32_t ExtrapolationDivergenceCounter_
static std::map< std::string, SoftwarePLL * > _instances
void FirstTick(uint64_t val)
Sets the first sensor tick in the fifo buffer.
double InterpolationSlope_
static const double MaxAllowedTimeDeviation_
SoftwarePLL(int fifo_length=7)
void IsInitialized(bool val)
Sets the initialization status, i.e. true, if SoftwarePLL is initialized, or false otherwise (inconsi...