Utility functions.
More...
◆ configure_cpu()
void vulp::utils::configure_cpu |
( |
int |
cpu | ) |
|
|
inline |
Set the current thread to run on a given CPU core.
- Parameters
-
cpu | CPU core for this thread (on the Pi, CPUID in {0, 1, 2, 3}). |
- Exceptions
-
std::runtime_error | If the operation failed. |
Definition at line 23 of file realtime.h.
◆ configure_scheduler()
void vulp::utils::configure_scheduler |
( |
int |
priority | ) |
|
|
inline |
Configure the scheduler policy to round-robin for this thread.
- Parameters
-
priority | Priority of this thread for the scheduler, ranging from 1 (low) to 99 (high). See man sched . For agents, this priority should be lower than that of the spine. |
- Exceptions
-
std::runtime_error | If the operation failed. |
Definition at line 45 of file realtime.h.
◆ handle_interrupts()
const bool & vulp::utils::handle_interrupts |
( |
| ) |
|
Redirect interrupts to setting a global interrupt boolean.
Direct interrupts (e.g.
- Returns
- Reference to the interrupt boolean.
Ctrl-C) to a boolean flag.
- Returns
- Reference to a boolean flag, which is initially false and becomes true the first time an interruption is caught.
Definition at line 20 of file handle_interrupts.cpp.
◆ lock_memory()
bool vulp::utils::lock_memory |
( |
| ) |
|
|
inline |
Lock all memory to RAM so that the kernel doesn't page it to swap.
The Linux man pages have a great NOTES section on this. Worth a read!
Definition at line 63 of file realtime.h.
◆ low_pass_filter()
double vulp::utils::low_pass_filter |
( |
double |
prev_output, |
|
|
double |
cutoff_period, |
|
|
double |
new_input, |
|
|
double |
dt |
|
) |
| |
|
inline |
Low-pass filter as an inline function.
- Parameters
-
prev_output | Previous filter output, or initial value. |
cutoff_period | Cutoff period in [s]. |
new_input | New filter input. |
dt | Sampling period in [s]. |
- Returns
- New filter output.
Definition at line 24 of file low_pass_filter.h.
◆ random_string()
std::string vulp::utils::random_string |
( |
unsigned |
length = 16 | ) |
|
|
inline |
Generate a random string.
- Parameters
-
- Returns
- Random string.
The generated string contains only alphanumeric characters with no repetition.
Definition at line 21 of file random_string.h.