File frequency_manager.hppΒΆ

Tools for enforcing a desired frequency in a loop.

Author

Vincent Berenz (vberenz@tue.mpg.de) license License BSD-3-Clause

Copyright

Copyright (c) 2019, New York University and Max Planck Gesellschaft.

Date

2020-03-22

namespace real_time_tools
class FrequencyManager

Class to have threads / loops running at a desired frequency.

Public Functions

FrequencyManager(double frequency)
FrequencyManager()
void set_frequency(double frequency)
void set_period(double period_s)
double predict_sleeping_time() const
bool wait()

waits for the time such that successive calls to wait will result in wait being called at the desired frequency

Returns:

true if the desired frequency could be enforced

Private Members

double period_ms_
double previous_time_ms_