ros::Rate Class Reference

Class to help run loops at a desired frequency. More...

#include <rate.h>

List of all members.

Public Member Functions

Duration cycleTime ()
 Get the actual run time of a cycle from start to sleep.
Duration expectedCycleTime ()
 Get the expected cycle time -- one over the frequency passed in to the constructor.
 Rate (double frequency)
 Constructor, creates a Rate.
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_

Detailed Description

Class to help run loops at a desired frequency.

Definition at line 46 of file rate.h.


Constructor & Destructor Documentation

ros::Rate::Rate ( double  frequency  ) 

Constructor, creates a Rate.

Parameters:
frequency The desired rate to run at in Hz

Definition at line 40 of file rate.cpp.


Member Function Documentation

Duration ros::Rate::cycleTime (  ) 

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

Returns:
The runtime of the cycle

Definition at line 87 of file rate.cpp.

Duration ros::Rate::expectedCycleTime (  )  [inline]

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

Definition at line 75 of file rate.h.

void ros::Rate::reset (  ) 

Sets the start time for the rate to now.

Definition at line 82 of file rate.cpp.

bool ros::Rate::sleep (  ) 

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

Returns:
True if the desired rate was met for the cycle, false otherwise.

Definition at line 46 of file rate.cpp.


Member Data Documentation

Definition at line 79 of file rate.h.

Definition at line 79 of file rate.h.

Definition at line 78 of file rate.h.


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


rostime
Author(s): Josh Faust
autogenerated on Fri Jan 11 10:03:29 2013