ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Couple of things which we found in ROS1 that are making it non hard RT capable:

  1. use of STL threads which neither have timeout argument (can not be pre-empted) not argument for the priority control
  2. memory allocation/de-alocation on the runtime which fragments the memory (as oppose to allocation of memory on the startup only)
  3. use of potentially blocking calls: malloc, free, fopen, fread, fwrite, ...
  4. use of non lock-free queues (example of lock-free queue http://natsys-lab.blogspot.com/2013/05/lock-free-multi-producer-multi-consumer.html)

See also this very good article: https://github.com/ros2/ros2/wiki/Real-Time-Programming.

In general as Geoff already mentioned above, for real-time, you need a host OS that provides certain guarantees such as scheduling sequence with a proper scheduler, always enough compute time, static memory, etc. Then you need to have fixed all of the points above in ROS (in ROS2 we are doing this as we speak) and finally you also need to avoid having the same in your application. In the final step you need to design and optimize your application by using tools such as valgrind or LTTng to make sure that you don't spend too much waiting around.