Threading & Time Utilities#
These helper classes provide task scheduling, thread management, and lightweight timing measurements. They are lower-level building blocks that sit beneath the main robot client APIs.
Headers
Type |
Header |
|---|---|
|
|
|
|
|
|
Public Member Functions
Type or method group |
Purpose |
Notes |
|---|---|---|
|
Queue one-shot or cyclic work, pause execution, and wait for tasks. |
Use in support utilities rather than high-level robot control. |
|
Configure thread name, affinity, and OS priority before running work. |
Useful when timing behavior matters. |
|
Record elapsed time measurements. |
Handy in profiling and timing-sensitive utilities. |
Detailed Reference
-
class EventLoop#
Public Functions
-
inline EventLoop()#
-
inline ~EventLoop() noexcept#
-
template<typename F, typename ...A, typename R = std::invoke_result_t<std::decay_t<F>, std::decay_t<A>...>>
inline R DoTask(F &&task, A&&... args)#
-
inline void Pause()#
-
inline void PurgeTasks()#
-
inline void PushCyclicTask(const std::function<void()> &cb, std::chrono::nanoseconds period, std::chrono::nanoseconds offset = std::chrono::nanoseconds{0})#
-
inline void Stop()#
-
template<typename F, typename ...A, typename R = std::invoke_result_t<std::decay_t<F>, std::decay_t<A>...>>
inline std::future<R> Submit(F &&task, A&&... args)#
-
inline void Unpause()#
-
inline void WaitForTasks() noexcept#
-
inline EventLoop()#
-
class Thread#
Public Types
-
using Functor = std::function<void()>#
Public Functions
-
inline Thread(std::string name = "", int cpuid = -1, int priority = 0, int policy = POLICY_DEFAULT_VALUE)#
-
inline ~Thread()#
-
inline bool IsRunning() const#
-
inline void Join()#
-
inline void SetAffinity(int cpuid)#
-
inline void SetName(const std::string &name)#
-
inline void SetOSPriority(int priority, int policy)#
-
using Functor = std::function<void()>#
-
class TimeWatch#
Related Types
Examples
real_time_control_command.cppis the most relevant example whenever execution timing matters.