Helper class for PHD. Fork of original code. Used for PHD_data_out... program. Changed bit precision from double to float and time seen to number of microseconds to increase accuracy.
Fork of Regrind by
Diff: Regrind.cpp
- Revision:
- 1:713783e6e8be
- Parent:
- 0:3f8f88e0fac6
diff -r 3f8f88e0fac6 -r 713783e6e8be Regrind.cpp --- a/Regrind.cpp Tue Nov 24 09:36:41 2015 +0000 +++ b/Regrind.cpp Wed Dec 09 20:09:28 2015 +0000 @@ -12,7 +12,7 @@ t = Timer(); }; -Regrind::Regrind (double tS, int l, double v, double a, int d, int pD){ +Regrind::Regrind (int tS, int l, float v, float a, int d, int pD){ timeSeen = tS; location = l; velocity = v; @@ -23,13 +23,13 @@ t.start(); }; -void Regrind::setVelocity(double distance){ +void Regrind::setVelocity(float distance){ int timePassed_us = t.read_us(); velocity = 2*distance/timePassed_us/1e6; location = 2; }; -void Regrind::setAcceleration(double distance){ +void Regrind::setAcceleration(float distance){ t.stop(); int timePassed_us = t.read_us(); acceleration = (2*distance)/((timePassed_us/1e6)*(timePassed_us/1e6));