Mercurial > hg > beaglert
view include/intervals.h @ 149:134bff10e561 ClockSync
Added simple one-variable one-measurement Kalman filter, Pid controller(which output is not used). Virtual clock is now much more precise and reactive for period. Still it is lagging behind a bit on the overall offset.
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Mon, 21 Sep 2015 03:12:21 +0100 |
parents | 24af9a14b203 |
children |
line wrap: on
line source
/* * intervals.h * * Created on: 18 May 2015 * Author: unmanaged */ #ifndef INTERVALS_H_ #define INTERVALS_H_ #define TEN_POW_9 1000000000 #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <native/timer.h> #include <rtdk.h> class Interval { private: int intervalsPointer; long sum; RTIME startTime; RTIME *intervals; float maxTimeus; float timeus; float samplingRate; //used for getPrint() int numFrames; bool enabled; //whether it actually reads the clock or not int numAverages; char *name; void init(int aNumAverages, int aNumFrames, float aSamplingRate, const char *aName); public: Interval(); Interval(int aNumAverages); Interval(int aNumAverages, int aNumFrames, float aSamplingRate, const char *aName); ~Interval(); void setNumFrames(int aNumFrames); int start(); int resetMax(); int split(); void setEnabled(bool aActive); float getTimeus(); float getMaxTimeus(); void print(); }; #endif /* INTERVALS_H_ */