Class to help run loops at a desired frequency. More...
#include <rate.h>
Public Member Functions | |
| Duration | cycleTime () const |
| Get the actual run time of a cycle from start to sleep. More... | |
| Duration | expectedCycleTime () const |
| Get the expected cycle time – one over the frequency passed in to the constructor. More... | |
| Rate (const Duration &) | |
| Rate (double frequency) | |
| Constructor, creates a Rate. More... | |
| void | reset () |
| Sets the start time for the rate to now. More... | |
| bool | sleep () |
| Sleeps for any leftover time in a cycle. Calculated from the last time sleep, reset, or the constructor was called. More... | |
Private Attributes | |
| Duration | actual_cycle_time_ |
| Duration | expected_cycle_time_ |
| Time | start_ |
| roswrap::Rate::Rate | ( | double | frequency | ) |
| Duration roswrap::Rate::cycleTime | ( | ) | const |
|
inline |
| void roswrap::Rate::reset | ( | ) |
| bool roswrap::Rate::sleep | ( | ) |