$search

ros::WallRate Class Reference

Class to help run loops at a desired frequency. This version always uses wall-clock time. More...

#include <rate.h>

List of all members.

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 (const Duration &)
 WallRate (double frequency)
 Constructor, creates a Rate.

Private Attributes

WallDuration actual_cycle_time_
WallDuration expected_cycle_time_
WallTime start_

Detailed Description

Class to help run loops at a desired frequency. This version always uses wall-clock time.

Definition at line 92 of file rate.h.


Constructor & Destructor Documentation

ros::WallRate::WallRate ( double  frequency  ) 

Constructor, creates a Rate.

Parameters:
frequency The desired rate to run at in Hz

Definition at line 102 of file rate.cpp.

ros::WallRate::WallRate ( const Duration d  )  [explicit]

Definition at line 108 of file rate.cpp.


Member Function Documentation

WallDuration ros::WallRate::cycleTime (  )  const

Get the actual run time of a cycle from start to sleep.

Returns:
The runtime of the cycle

Definition at line 155 of file rate.cpp.

WallDuration ros::WallRate::expectedCycleTime (  )  const [inline]

Get the expected cycle time -- one over the frequency passed in to the constructor.

Definition at line 122 of file rate.h.

void ros::WallRate::reset (  ) 

Sets the start time for the rate to now.

Definition at line 150 of file rate.cpp.

bool ros::WallRate::sleep (  ) 

Sleeps for any leftover time in a cycle. Calculated from the last time sleep, reset, or the constructor was called.

Returns:
Passes through the return value from WallDuration::sleep() if it slept, otherwise True

Definition at line 114 of file rate.cpp.


Member Data Documentation

Definition at line 126 of file rate.h.

Definition at line 126 of file rate.h.

Definition at line 125 of file rate.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Defines


rostime
Author(s): Josh Faust
autogenerated on Sat Mar 2 13:22:42 2013