44 , expected_cycle_time_(1.0 / frequency)
45 , actual_cycle_time_(0.0)
69 Duration sleep_time = expected_end - actual_end;
75 start_ = expected_end;
82 if (actual_end > expected_end + expected_cycle_time_)
90 return sleep_time.
sleep();
134 start_ = expected_end;
141 if (actual_end > expected_end + expected_cycle_time_)
148 return sleep_time.
sleep();
bool sleep() const
sleep for the amount of time specified by this Duration. If a signal interrupts the sleep...
Duration actual_cycle_time_
static WallTime now()
Returns the current wall clock time.
void reset()
Sets the start time for the rate to now.
Duration cycleTime() const
Get the actual run time of a cycle from start to sleep.
::std_msgs::Duration_< std::allocator< void > > Duration
bool sleep()
Sleeps for any leftover time in a cycle. Calculated from the last time sleep, reset, or the constructor was called.
Duration representation for use with the Time class.
WallDuration expected_cycle_time_
Duration representation for use with the WallTime class.
bool sleep() const
sleep for the amount of time specified by this Duration. If a signal interrupts the sleep...
Time representation. Always wall-clock time.
Time representation. May either represent wall clock time or ROS clock time.
WallRate(double frequency)
Constructor, creates a Rate.
WallDuration actual_cycle_time_
static Time now()
Retrieve the current time. If ROS clock time is in use, this returns the time according to the ROS cl...
Duration expected_cycle_time_
bool sleep()
Sleeps for any leftover time in a cycle. Calculated from the last time sleep, reset, or the constructor was called.
WallDuration cycleTime() const
Get the actual run time of a cycle from start to sleep.
Rate(double frequency)
Constructor, creates a Rate.
void reset()
Sets the start time for the rate to now.