|
| 1 | +# Minimal ROS 2 real-time cookbook recipes |
| 2 | + |
| 3 | +Collection of ROS 2 minimal examples showing how to leverage different POSIX and ROS 2 features to |
| 4 | +create real-time applications. |
| 5 | + |
| 6 | + |
| 7 | +TODO: Add other packages after review (currently in rolling-experimental branch): |
| 8 | +* minimal_memory_lock: shows how to lock the process memory and |
| 9 | + pre-allocate dynamic memory to avoid memory page faults |
| 10 | +* minimal_deadline_qos: shows how to use the DDS deadline QoS policy |
| 11 | +* minimal_lifecycle: shows how to use node lifecycle to separate configuration and runtime |
| 12 | + real-time phases |
| 13 | +* minimal_memory_check: shows how use verify that functions used in the real-time path |
| 14 | +does not allocate dynamic memory |
| 15 | +* minimal_memory_allocator: shows how to use different memory strategies to avoid dynamic |
| 16 | + memory allocations during the runtime phase |
| 17 | +* minimal_loaned_messages: shows how to use loaned messages APIs |
| 18 | +* minimal_data_sharing: shows how to use different data sharing approached to avoid |
| 19 | + blocking calls when sharing data between real-time and non real-time threads |
| 20 | +* minimal_dds_tuning: shows how to use DDS specific configurations to tune real-time |
| 21 | + related settings (TODO: add XML profiles for more DDS implementations) |
| 22 | + |
| 23 | + |
| 24 | +## Requirements |
| 25 | + |
| 26 | +- ROS 2 rolling release |
| 27 | +- Linux based operating system (RT_PREEMPT is not mandatory to run the examples) |
| 28 | +- Privileges to set priority, scheduling and memory lock limits. This can be achieved by having |
| 29 | + root privileges or adding user privileges to `/etc/security/limits.conf` |
| 30 | + |
| 31 | + |
| 32 | +## Build instructions |
| 33 | + |
| 34 | +### Create workspace |
| 35 | + |
| 36 | +```bash |
| 37 | +$ mkdir -p ros2_realtime_examples_ws/src |
| 38 | +$ cd ros2_realtime_examples_ws/src |
| 39 | +$ git clone https://github.com/carlossvg/ros2-realtime-examples.git |
| 40 | +# Optional: Build rmw_iceoryx for zero-copy examples |
| 41 | +$ git clone https://github.com/ros2/rmw_iceoryx |
| 42 | +``` |
| 43 | + |
| 44 | +### Install dependencies |
| 45 | + |
| 46 | +Use [rosdep](http://wiki.ros.org/ROS/Tutorials/rosdep) to install the required dependencies: |
| 47 | + |
| 48 | +```bash |
| 49 | +$ cd ros2_realtime_examples_ws |
| 50 | +$ rosdep install --from-paths src/ --ignore-src |
| 51 | +``` |
| 52 | + |
| 53 | +### Build |
| 54 | + |
| 55 | +Build examples |
| 56 | + |
| 57 | +```bash |
| 58 | +$ cd ros2_realtime_examples_ws |
| 59 | +$ colcon build |
| 60 | +``` |
| 61 | + |
| 62 | +**Note: Some examples might require to install additional RMW implementations** |
0 commit comments