I would suggest the following approach:
1) Setup RT_Preempt
You will need an RTOS anyway, I think RT_Preempt fits your demands.
https://wiki.linuxfoundation.org/realtime/documentation/howto/applications/preemptrt_setup
2) Setup your Controller as RT-application
https://wiki.linuxfoundation.org/realtime/documentation/howto/applications/application_base
https://wiki.linuxfoundation.org/realtime/documentation/howto/applications/cyclic
3) Allow RT priorities from Userspace
https://rt.wiki.kernel.org/index.php/Frequently_Asked_Questions#Do_I_need_root_privileges_to_start_a_realtime_application.3F
4) Find a suitable RT priority
When your controller does not require the entire CPU, this is not a problem. Just pick one (e.g. 80). This should work.
If this is not enough I would recommend trying ros_control.
Originally posted by Jan Carstensen with karma: 66 on 2017-05-12
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by Winston on 2017-05-17:
Does ros_control provide realt-time capability already?
Comment by Jan Carstensen on 2017-05-18:
ros_control on its own cannot provide real-time capabilities. It can, however, offer real-time safe functions. In any case, a real-time operating system (e.g. RT Preempt) is required.
Comment by Winston on 2017-05-18:
What do you mean by real-time safe functions? If I use ros_control, do I still needs to do 1) to 4) steps as you posted as the answer?
Comment by Jan Carstensen on 2017-05-18:
Your controller node will need to communicate with other ROS-nodes, this communication is not real-time safe. ros_control offers functions that separate this into a second thread.
You will either need 1-4 or only 1 and use orocos (e.g. https://github.com/skohlbr/rtt_ros_control_example).