Class to help run loops at a desired frequency. This version always uses wall-clock time. More...
#include <rate.h>
Public Member Functions | |
WallDuration | cycleTime () const |
Get the actual run time of a cycle from start to sleep. | |
WallDuration | expectedCycleTime () const |
Get the expected cycle time -- one over the frequency passed in to the constructor. | |
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. | |
WallRate (double frequency) | |
Constructor, creates a Rate. | |
WallRate (const Duration &) | |
Private Attributes | |
WallDuration | actual_cycle_time_ |
WallDuration | expected_cycle_time_ |
WallTime | start_ |
Class to help run loops at a desired frequency. This version always uses wall-clock time.
ros::WallRate::WallRate | ( | double | frequency | ) |
ros::WallRate::WallRate | ( | const Duration & | d | ) | [explicit] |
WallDuration ros::WallRate::cycleTime | ( | ) | const |
WallDuration ros::WallRate::expectedCycleTime | ( | ) | const [inline] |
void ros::WallRate::reset | ( | ) |
bool ros::WallRate::sleep | ( | ) |
Sleeps for any leftover time in a cycle. Calculated from the last time sleep, reset, or the constructor was called.
WallTime ros::WallRate::start_ [private] |