#include <timer.h>
|
using | Seconds = std::chrono::duration< double > |
|
using | Clock = std::chrono::steady_clock |
|
Timer utility class for use in control loops.
- See also
- Python: spatialdyn.Timer
◆ Timer() [1/2]
ctrl_utils::Timer::Timer |
( |
| ) |
|
|
inline |
Default constructor that sets the loop frequency to 1000 Hz.
◆ Timer() [2/2]
ctrl_utils::Timer::Timer |
( |
double |
frequency | ) |
|
|
inline |
Constructor that sets the loop frequency.
- Parameters
-
frequency | Frequency of the timer loop [Hz]. |
- See also
- Python: spatialdyn.Timer.__init__()
◆ average_freq()
double ctrl_utils::Timer::average_freq |
( |
| ) |
const |
|
inline |
- Returns
- Average frequency since last timer reset in Hz.
◆ dt()
double ctrl_utils::Timer::dt |
( |
| ) |
const |
|
inline |
- Returns
- Timer loop time interval in seconds (1 / frequency).
- See also
- Python: spatialdyn.Timer.dt
◆ freq()
double ctrl_utils::Timer::freq |
( |
| ) |
const |
|
inline |
- Returns
- Timer loop frequency in Hz.
- See also
- Python: spatialdyn.Timer.freq
◆ num_iters()
unsigned long long ctrl_utils::Timer::num_iters |
( |
| ) |
const |
|
inline |
- Returns
- Number of loop iterations since last timer reset.
- See also
- Python: spatialdyn.Timer.num_iters
◆ Reset()
void ctrl_utils::Timer::Reset |
( |
| ) |
|
|
inline |
Reset timer.
- See also
- Python: spatialdyn.Timer.reset()
◆ set_dt()
void ctrl_utils::Timer::set_dt |
( |
double |
dt | ) |
|
|
inline |
Set the timer loop time interval in seconds (1 / frequency).
◆ set_freq()
void ctrl_utils::Timer::set_freq |
( |
double |
frequency | ) |
|
|
inline |
Set the timer loop frequency in Hz.
◆ Sleep()
void ctrl_utils::Timer::Sleep |
( |
| ) |
|
|
inline |
Wait for the next timer loop.
- See also
- Python: spatialdyn.Timer.sleep()
◆ time()
double ctrl_utils::Timer::time |
( |
bool |
update = false | ) |
const |
|
inline |
- Returns
- Current CPU time since epoch in seconds.
- See also
- Python: spatialdyn.Timer.time
◆ time_elapsed()
double ctrl_utils::Timer::time_elapsed |
( |
bool |
update = false | ) |
const |
|
inline |
- Returns
- CPU time since last timer reset in seconds.
- See also
- Python: spatialdyn.Timer.time_elapsed
◆ time_sim()
double ctrl_utils::Timer::time_sim |
( |
| ) |
const |
|
inline |
- Returns
- Simulation time since last timer reset in seconds.
- See also
- Python: spatialdyn.Timer.time_sim
The documentation for this class was generated from the following file:
- /home/runner/work/ctrl-utils/ctrl-utils/include/ctrl_utils/timer.h