diff --git a/source/Concepts/About-Real-Time.rst b/source/Concepts/About-Real-Time.rst new file mode 100644 index 0000000000..0e9b804cda --- /dev/null +++ b/source/Concepts/About-Real-Time.rst @@ -0,0 +1,15 @@ +.. _RealTime: + +About Real-Time +========= + +.. contents:: Table of Contents + :local: + +Overview +-------- + +* take sections from design document +* explain operating system concepts (tasks, threads, priorities) +* explain capabilities of the ROS 2 middleware +* refer to Real-Time Tutorial diff --git a/source/Tutorials/Demos/Real-Time-Programming.rst b/source/Tutorials/Advanced/Real-Time/Develop-Real-Time-Application.rst similarity index 84% rename from source/Tutorials/Demos/Real-Time-Programming.rst rename to source/Tutorials/Advanced/Real-Time/Develop-Real-Time-Application.rst index c71e52b863..80802124a6 100644 --- a/source/Tutorials/Demos/Real-Time-Programming.rst +++ b/source/Tutorials/Advanced/Real-Time/Develop-Real-Time-Application.rst @@ -1,15 +1,88 @@ -.. redirect-from:: +.. _RealTimeTutorial: - Real-Time-Programming - Tutorials/Real-Time-Programming - -Understanding real-time programming -=================================== +How to develop a Real-Time Application +====================================== .. contents:: Table of Contents - :depth: 2 :local: + +TODO: +* create outline of the Tutorial +* fill each section +* update/review pendulum demo application +* possibly add the source code to github.com/ros2/examples + +Overview +-------- + +TODO + +What is real-time? +------------------ +* soft real-time, hard real-time +* given bound on latency ... + + +Real-Time configuration options by ROS 2 +---------------------------------------- +TODO +* multi-threaded Executors (just high-level), reference Executor document + +Real-Time configuration options by operating system +--------------------------------------------------- + +* pthreads (POSIX OS) +* intention using multiple cores for parallelism +* real-time Linux scheduler (FIFO) +* real-time priorities (not nice-levels) + +Putting it together +---------------------------------- + +* using multi-threaded executor +* 2 threads with low,high priority +* pendulum demo (updated) +* drawback: can only add one node to an Executor (all callbacks of the node are treated the same) + +Advanced: ROS 2 callback groups + real-time +------------------------------------- +* flexibility: group multiple callbacks from multiple nodes together +* using multi-threaded executor +* 2 threads with low, high priority +* application with 2 nodes with 2 callbacks each => how to use callback groups +* pendulum demo + +Further information +------------------- +* Links to ros-realtime further documentation + + +Code examples +-------------- + +.. code-block:: cpp + + int main(int argc, char* argv[]) + { + // Some example code + rclcpp::init(argc, argv); + ... + + // Instantiate a node. + rclcpp::Node::SharedPtr node = ... + + // Run the executor. + rclcpp::spin(node); + + // Shutdown and exit. + ... + return 0; + } + + +Below is a complete copy of Demos/Real-Time-Programming.rst + Background ---------- diff --git a/source/Tutorials/Miscellaneous/Building-Realtime-rt_preempt-kernel-for-ROS-2.rst b/source/Tutorials/Advanced/Real-Time/Operating-System-Setup-with-RT-Linux-Kernel.rst similarity index 98% rename from source/Tutorials/Miscellaneous/Building-Realtime-rt_preempt-kernel-for-ROS-2.rst rename to source/Tutorials/Advanced/Real-Time/Operating-System-Setup-with-RT-Linux-Kernel.rst index 8eddd54d0d..f81295dfd0 100644 --- a/source/Tutorials/Miscellaneous/Building-Realtime-rt_preempt-kernel-for-ROS-2.rst +++ b/source/Tutorials/Advanced/Real-Time/Operating-System-Setup-with-RT-Linux-Kernel.rst @@ -6,6 +6,9 @@ Building a real-time Linux kernel [community-contributed] ========================================================= +TODO: integrate tutorial from ros-realtime + + This tutorial begins with a clean Ubuntu 20.04.1 install on Intel x86_64. Actual kernel is 5.4.0-54-generic, but we will install the Latest Stable RT_PREEMPT Version. To build the kernel you need at least 30GB free disk space. Check https://wiki.linuxfoundation.org/realtime/start for the latest stable version, at the time of writing this is "Latest Stable Version 5.4-rt".