Rate objects can be used to run loops at a desired rate.
More...
#include <time.h>
Rate objects can be used to run loops at a desired rate.
while (1)
{
rate.sleep();
}
This class is inspired and based on the ROS class ros::Time http://wiki.ros.org/roscpp/Overview/Time
- See also
- Time Duration
- Author
- Christoph Rösmann (chris.nosp@m.toph.nosp@m..roes.nosp@m.mann.nosp@m.@tu-d.nosp@m.ortm.nosp@m.und.d.nosp@m.e)
Definition at line 353 of file time.h.
◆ Rate() [1/2]
corbo::Rate::Rate |
( |
double |
frequency | ) |
|
|
inlineexplicit |
Construct rate object from frequency [1/s].
Definition at line 357 of file time.h.
◆ Rate() [2/2]
corbo::Rate::Rate |
( |
const Duration & |
dt | ) |
|
|
inlineexplicit |
Cosntruct rate object from duration object (interval length)
Definition at line 359 of file time.h.
◆ lastCycleTime()
Duration corbo::Rate::lastCycleTime |
( |
| ) |
const |
|
inline |
Return actual execution time of the last cycle.
Definition at line 368 of file time.h.
◆ reset()
void corbo::Rate::reset |
( |
| ) |
|
|
inline |
◆ sleep()
bool corbo::Rate::sleep |
( |
| ) |
|
Sleep for the remaining duration to met the desired frequency (w.r.t previous sleep call)
Definition at line 31 of file time.cpp.
◆ updateCycleTime()
void corbo::Rate::updateCycleTime |
( |
const Duration & |
dt | ) |
|
|
inline |
Update cycle time without resetting start time.
Definition at line 365 of file time.h.
◆ _cycle_time
◆ _last_cycle_time
◆ _start
The documentation for this class was generated from the following files: