Class to help run loops at a desired frequency.
More...
#include <rate.h>
Class to help run loops at a desired frequency.
Definition at line 86 of file rate.h.
◆ Rate() [1/2]
ros::Rate::Rate |
( |
double |
frequency | ) |
|
Constructor, creates a Rate.
- Parameters
-
frequency | The desired rate to run at in Hz |
Definition at line 77 of file rate.cpp.
◆ Rate() [2/2]
◆ cycleTime()
Get the actual run time of a cycle from start to sleep.
- Returns
- The runtime of the cycle
Definition at line 131 of file rate.cpp.
◆ expectedCycleTime()
Duration ros::Rate::expectedCycleTime |
( |
| ) |
const |
|
inline |
Get the expected cycle time – one over the frequency passed in to the constructor.
Definition at line 116 of file rate.h.
◆ reset()
void ros::Rate::reset |
( |
| ) |
|
Sets the start time for the rate to now.
Definition at line 126 of file rate.cpp.
◆ sleep()
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 89 of file rate.cpp.
◆ actual_cycle_time_
◆ expected_cycle_time_
Duration ros::Rate::expected_cycle_time_ |
|
private |
◆ start_
The documentation for this class was generated from the following files: