41 const std::string
RT_DOC_URL =
"https://docs.universal-robots.com/Universal_Robots_ROS_Documentation/doc/ur_client_library/doc/real_time.html";
49 return ::SetThreadPriority(thread, priority);
51 struct sched_param params;
52 params.sched_priority = priority;
53 int ret = pthread_setschedparam(thread, SCHED_FIFO, ¶ms);
60 URCL_LOG_WARN(
"Your system/user seems not to be setup for FIFO scheduling. We recommend using a lowlatency "
61 "kernel with FIFO scheduling. See "
69 URCL_LOG_ERROR(
"Unsuccessful in setting thread to FIFO scheduling with priority %i. %s", priority,
79 ret = pthread_getschedparam(thread, &policy, ¶ms);
87 if (policy != SCHED_FIFO)
94 URCL_LOG_INFO(
"SCHED_FIFO OK, priority %i", params.sched_priority);
95 if (params.sched_priority != priority)
97 URCL_LOG_ERROR(
"Thread priority is %i instead of the expected %i", params.sched_priority, priority);
105 void waitFor(std::function<
bool()> condition,
const std::chrono::milliseconds timeout,
106 const std::chrono::milliseconds check_interval)
108 auto start_time = std::chrono::system_clock::now();
109 while (std::chrono::system_clock::now() - start_time < timeout)
116 std::this_thread::sleep_for(check_interval);