From: Erik Andresen Date: Fri, 8 May 2026 17:23:32 +0000 (+0200) Subject: set rt priority X-Git-Url: https://defiant.homedns.org/gitweb/?a=commitdiff_plain;h=a9e197b43b85df777af19f6e2365b0245c7a93e9;p=a4wd3.git set rt priority --- diff --git a/src/hw_node.cpp b/src/hw_node.cpp index 7f3cfab..0ac70c4 100644 --- a/src/hw_node.cpp +++ b/src/hw_node.cpp @@ -367,7 +367,18 @@ class A4wd3 : public rclcpp::Node { int main(int argc, char ** argv) { rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); + auto node = std::make_shared(); + auto spin_thread = std::thread( + [&]() { + rclcpp::spin(node); + }); + struct sched_param param; + param.sched_priority = 10; + if (pthread_setschedparam(spin_thread.native_handle(), SCHED_FIFO, ¶m) != 0) { + perror("Unable to set realtime priority"); + } + spin_thread.join(); + rclcpp::shutdown(); return 0;