One of the core capabilities of a real-time framework is to isolate and maintain the guarantees to meet the deadlines while interacting with non-real-time systems. There are many different mechanisms that can be used to communicate into and out of the real-time thread without blocking it, a common one is lock-free buffers. Without being able to interact with the rest of a robotic systems the real-time system would lose a lot of it’s value, such as receiving commands and providing logging and feedback.
The ros2_control’s controller_manager launched with the provided ros2_control_node it spawns another thread to execute the read, update and write methods. This thread will be configured with FIFO priority on a real-time enabled system. All the services of the controller_manager are run on a non-RT thread, it shouldn’t affect any real-time performance in general.
What ros2_control ensures is a cleaner interaction between the main RT thread and the non-RT thread(from services and diagnostics etc). For instance, if a new controller is loaded or switched to activate (or) deactivate mode. It makes sure that it is effective from the next control cycle without affecting any realtimeness.
wow, thank you so much @JRTG, @tfoote and @saikishor. This does clarify a lot. I was coming from a standpoint where continuous activation / deactivation of controllers happens, which I am still not 100% convinced is real-time safe. But this might still be a misunderstanding / misuse on my end. I’ll think through it further.