A class for calling sleep() in a loop, such that the amount of sleep time will be computed to make the loop run at the desired rate (in Hz).
Definition at line 23 of file CRateTimer.h.
#include <mrpt/utils/CRateTimer.h>
Public Member Functions | |
CRateTimer (const double rate_hz=1.0) | |
Ctor: specifies the desired rate (Hz) More... | |
virtual | ~CRateTimer () |
Dtor. More... | |
void | setRate (const double rate_hz) |
Changes the object loop rate (Hz) More... | |
bool | sleep () |
Sleeps for some time, such as the return of this method is 1/rate (seconds) after the return of the previous call. More... | |
Private Attributes | |
double | m_rate_hz |
mrpt::utils::CTicTac | m_tictac |
mrpt::utils::CRateTimer::CRateTimer | ( | const double | rate_hz = 1.0 | ) |
Ctor: specifies the desired rate (Hz)
|
virtual |
Dtor.
void mrpt::utils::CRateTimer::setRate | ( | const double | rate_hz | ) |
Changes the object loop rate (Hz)
bool mrpt::utils::CRateTimer::sleep | ( | ) |
Sleeps for some time, such as the return of this method is 1/rate (seconds) after the return of the previous call.
|
private |
Definition at line 35 of file CRateTimer.h.
|
private |
Definition at line 36 of file CRateTimer.h.
Page generated by Doxygen 1.8.13 for MRPT 1.5.3 at Sun Nov 26 00:44:48 UTC 2017 |