126 <<
"Number of errors: " <<
numErrors_ <<
".");
177 return std::numeric_limits<double>::quiet_NaN();
189 return std::numeric_limits<double>::quiet_NaN();
201 return std::numeric_limits<double>::quiet_NaN();
216 return (end.tv_sec - start.tv_sec) + (end.tv_nsec - start.tv_nsec) *
SEC_PER_N_SEC;
221 time.tv_nsec +=
static_cast<long int>(duration *
N_SEC_PER_SEC);
double getAwakeTimeMean() const
static void addDuration(timespec &time, const double duration)
unsigned int numWarnings_
Counter storing how many times a time step took longer than the warning threshold.
double getAwakeTime() const
double awakeTime_
Most recent time which elapsed between subsequent calls of sleep().
double getAwakeTimeStdDev() const
std::atomic< double > maxTimeStepFactorError_
If the awake time is bigger than the time step multiplied by this factor, it counts as an error...
unsigned int numTimeSteps_
Counter storing how many times sleep has been called.
static constexpr long int N_SEC_PER_SEC
Factor storing nanoseconds per seconds.
std::atomic< double > timeStep_
Time step in seconds.
Rate(const std::string &name, const double timeStep)
#define ROS_WARN_STREAM(args)
RateOptions options_
Rate options.
timespec lastErrorPrintTime_
Point in time when the last error message was printed.
timespec lastWarningPrintTime_
Point in time when the last warning message was printed.
std::atomic< bool > enforceRate_
Boolean indicating whether the rate should be enforced.
double awakeTimeMean_
Mean of the time which elapsed between subsequent calls of sleep().
double getAwakeTimeVar() const
double awakeTimeM2_
Helper variable to compute the variance of the time step which elapsed between subsequent calls of sl...
timespec sleepStartTime_
Point in time when the most recent sleep() started.
unsigned int numErrors_
Counter storing how many times a time step took longer than the error threshold, not considering warn...
timespec sleepEndTime_
Point in time when the most recent sleep() ended.
std::string name_
Name for printing.
#define ROS_ERROR_STREAM(args)
std::atomic< clockid_t > clockId_
Linux clock ID.
static double getDuration(const timespec &start, const timespec &end)
std::atomic< double > maxTimeStepFactorWarning_
If the awake time is bigger than the time step multiplied by this factor, it counts as an warning...
static constexpr double SEC_PER_N_SEC
Factor storing seconds per nanoseconds.