Robotiq::Platform Class
The OS services Gripper's threaded runtime needs, as an injectable interface: one exchange thread, one lockable object, and a yielding sleep.
Every Gripper runs on one: hosted applications pass makeDefaultPlatform(); an RTOS target implements this over the native primitives — ports/threadx/threadx_platform.hpp is the working reference. A single-threaded target (bare superloop) should skip Gripper entirely and drive GripperModbusClient itself — that layer needs no Platform. Read that class's warning first: it is the exception, not an alternative.
Concurrency contract for implementations: the sleeps may be called from several threads at once (the exchange thread paces with sleepUntil() while a blocked procedure like activate() polls with sleepFor()); makeMutex() and spawn() are called during gripper construction only.
RTOS-specific integration caveats (a yielding Serial::read, the backing of steady_clock, task priorities) are documented in the reference port, ports/threadx/threadx_platform.hpp — read them before implementing this interface for an RTOS.
Included Headers
Members
| Public Destructor | |
| ~Platform ()=default | |
| Public Member Functions | |
| std::unique_ptr< Mutex > | makeMutex ()=0 |
| std::unique_ptr< Thread > | spawn (std::function< void()> fn)=0 |
|
Start a thread running fn. More... | |
| void | sleepUntil (std::chrono::steady_clock::time_point timePoint)=0 |
|
Sleep the calling thread until a monotonic time point, yielding the CPU. More... | |
| void | sleepFor (std::chrono::milliseconds duration)=0 |
|
Sleep the calling thread for a duration, yielding the CPU. More... | |
Public Member Functions
makeMutex()
|
- Returns
A newly constructed lockable object.
sleepFor()
|
Sleep the calling thread for a duration, yielding the CPU.
- Parameters
-
duration How long to sleep.
sleepUntil()
|
Sleep the calling thread until a monotonic time point, yielding the CPU.
- Parameters
-
timePoint The point in time to sleep until.
spawn()
|
Start a thread running fn.
fn returns when its owner stops it; the returned handle is then join()ed before destruction.
- Parameters
-
fn The thread's entry function.
- Returns
A handle to the running thread.
The documentation for this class was generated from the following file:
- platform.hpp
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.