[ros-users] [Discourse.ros.org] [Next Generation ROS] ROS2 for real-time applications

Dejan Pangercic ros.discourse at gmail.com
Thu Oct 18 06:10:21 UTC 2018



@lbegani real-time is a larger topic and as Jackie in above article points includes memory management (no allocations on the runtime), device IO (e.g. no logging to disk) and synchronization (thread priorities, no indefinitely blocking calls, ...).  

In addition you also need to have an RTOS that supports deterministic scheduling (e.g. QNX) and a real-time DDS implementation (currently only Connext Micro DDS is so and for that we do not have an rmw_* layer yet).

For below assume that I only talk about C++ code, so no python, java and friends.

Said that following has been done to make ROS 2 real-time so far:
1. all rmw_* implementations have static type support (https://github.com/ros2/rmw_fastrtps/pull/203, https://github.com/ros2/rmw_fastrtps/pull/218)
1. all data structures in rcutils, rmw, and rcl take in allocators (https://github.com/ros2/rcutils/pull/102, https://github.com/ros2/rcl/pull/261, https://github.com/ros2/rmw_fastrtps/pull/208/files)
1. @wjwwood you'd have more to add here ..., right? 

What would still need to happen:
1. rclcpp needs to be memory audited, e.g. if there are usages of STL containers, we need to use memory allocators for them (e.g. https://github.com/foonathan/memory)
1. allocators need to be passed correctly between rmw, rcl and rclcpp layers
1. threads need to have controllable stack sizes and priorities
1. [static exceptions](https://github.com/ApexAI/static_exception) need to be used
1. logging to memory needs to be implemented (as oppose to the file)
1. https://en.wikipedia.org/wiki/Run-time_type_information needs to be looked at. This is probably not real-time safe
1. waitset concept needs to be implemented in addition to callbacks (see https://github.com/ros2/rclcpp/issues/572)
1. ...

Finally developers should also use [managed nodes](https://github.com/ros2/rclcpp/tree/master/rclcpp_lifecycle) to be able to differentiate between memory pre-allocation and memory re-use on the runtime. Developers should also use an RTOS and a static DDS implementation.

I am probably still missing out on lots of other things but this is from the top of my head and as you see still quite some work to get there.





---
[Visit Topic](https://discourse.ros.org/t/ros2-for-real-time-applications/6493/4) or reply to this email to respond.




More information about the ros-users mailing list