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. | |
Duration | expectedCycleTime () const |
Get the expected cycle time -- one over the frequency passed in to the constructor. | |
Rate (double frequency) | |
Constructor, creates a Rate. | |
Rate (const Duration &) | |
void | reset () |
Sets the start time for the rate to now. | |
bool | sleep () |
Sleeps for any leftover time in a cycle. Calculated from the last time sleep, reset, or the constructor was called. | |
Private Attributes | |
Duration | actual_cycle_time_ |
Duration | expected_cycle_time_ |
Time | start_ |
ros::Rate::Rate | ( | double | frequency | ) |
ros::Rate::Rate | ( | const Duration & | d | ) | [explicit] |
Duration ros::Rate::cycleTime | ( | ) | const |
Duration ros::Rate::expectedCycleTime | ( | ) | const [inline] |
void ros::Rate::reset | ( | ) |
bool ros::Rate::sleep | ( | ) |
Duration ros::Rate::actual_cycle_time_ [private] |
Duration ros::Rate::expected_cycle_time_ [private] |
Time ros::Rate::start_ [private] |