MRPT
2.0.1
|
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 21 of file system/CRateTimer.h.
#include <mrpt/system/CRateTimer.h>
Public Member Functions | |
CRateTimer (const double rate_hz=1.0) | |
Ctor: specifies the desired rate (Hz) More... | |
virtual | ~CRateTimer ()=default |
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 {1.0} |
mrpt::system::CTicTac | m_tictac |
CRateTimer::CRateTimer | ( | const double | rate_hz = 1.0 | ) |
Ctor: specifies the desired rate (Hz)
Definition at line 19 of file CRateTimer.cpp.
References setRate().
|
virtualdefault |
Dtor.
void CRateTimer::setRate | ( | const double | rate_hz | ) |
Changes the object loop rate (Hz)
Definition at line 20 of file CRateTimer.cpp.
References ASSERT_ABOVE_, and m_rate_hz.
Referenced by CRateTimer(), and mrpt::apps::RawlogGrabberApp::SensorThread().
bool CRateTimer::sleep | ( | ) |
Sleeps for some time, such as the return of this method is 1/rate (seconds) after the return of the previous call.
Definition at line 25 of file CRateTimer.cpp.
References m_rate_hz, m_tictac, mrpt::system::CTicTac::Tac(), and mrpt::system::CTicTac::Tic().
Referenced by mrpt::apps::RawlogGrabberApp::SensorThread().
|
private |
Definition at line 39 of file system/CRateTimer.h.
|
private |
Definition at line 40 of file system/CRateTimer.h.
Referenced by sleep().
Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020 |