Skip to content

Commit 54f25d0

Browse files
committed
docs: helper functions example
1 parent 551a81e commit 54f25d0

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

doc/examples/rtde_client.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,40 @@ to initialize the RTDE client.
2525
:start-at: const std::string OUTPUT_RECIPE
2626
:end-at: const std::string INPUT_RECIPE
2727

28+
Configuring real-time scheduling
29+
--------------------------------
30+
31+
To reduce scheduling jitter, the example configures CPU affinity and scheduling priorities before
32+
starting RTDE communication.
33+
34+
The Universal Robots Client Library provides helper functions that simplify configuring these
35+
settings on both Linux and Windows.
36+
37+
.. literalinclude:: ../../examples/rtde_client.cpp
38+
:language: c++
39+
:caption: examples/rtde_client.cpp
40+
:linenos:
41+
:lineno-match:
42+
:start-at: pprocess_t process = pprocess_self();
43+
:end-at: URCL_LOG_ERROR("Failed to set FIFO scheduling");
44+
45+
The example assigns dedicated CPU cores and configures the highest available scheduling priority
46+
for the current thread.
47+
48+
On Linux, ``setFiFoScheduling()`` configures ``SCHED_FIFO`` scheduling.
49+
50+
On Windows, ``setFiFoScheduling()`` configures the process to use
51+
``REALTIME_PRIORITY_CLASS`` and the thread to use
52+
``THREAD_PRIORITY_TIME_CRITICAL``.
53+
54+
For a detailed explanation of the available helper functions and platform-specific real-time
55+
configuration recommendations, see :ref:`real time setup`.
56+
57+
.. note::
58+
59+
The selected CPU indices are only examples. Applications should choose CPU affinities according
60+
to the available hardware and system configuration.
61+
2862
Creating an RTDE Client
2963
-----------------------
3064

0 commit comments

Comments
 (0)